Compare commits

..

1 Commits

Author SHA1 Message Date
Guillaume Nodet
de69dd7792
Merge 91f49aa1b0 into 4fb397523b 2023-07-19 10:58:33 +02:00
5 changed files with 5176 additions and 5198 deletions

View File

@ -113,8 +113,8 @@ Currently, the following distributions are supported:
**NOTE:** For Azul Zulu OpenJDK architectures x64 and arm64 are mapped to x86 / arm with proper hw_bitness. **NOTE:** For Azul Zulu OpenJDK architectures x64 and arm64 are mapped to x86 / arm with proper hw_bitness.
### Caching packages dependencies ### Caching packages dependencies
The action has a built-in functionality for caching and restoring dependencies. It uses [toolkit/cache](https://github.com/actions/toolkit/tree/main/packages/cache) under hood for caching dependencies but requires less configuration settings. Supported package managers are gradle, maven and sbt. The format of the used cache key is `setup-java-${{ platform }}-${{ packageManager }}-${{ fileHash }}`, where the hash is based on the following files: The action has a built-in functionality for caching and restoring dependencies. It uses [actions/cache](https://github.com/actions/cache) under hood for caching dependencies but requires less configuration settings. Supported package managers are gradle, maven and sbt. The format of the used cache key is `setup-java-${{ platform }}-${{ packageManager }}-${{ fileHash }}`, where the hash is based on the following files:
- gradle: `**/*.gradle*`, `**/gradle-wrapper.properties`, `buildSrc/**/Versions.kt`, `buildSrc/**/Dependencies.kt`, `gradle/*.versions.toml`, and `**/versions.properties` - gradle: `**/*.gradle*`, `**/gradle-wrapper.properties`, `buildSrc/**/Versions.kt`, `buildSrc/**/Dependencies.kt`, and `gradle/*.versions.toml`
- maven: `**/pom.xml` - maven: `**/pom.xml`
- sbt: all sbt build definition files `**/*.sbt`, `**/project/build.properties`, `**/project/**.scala`, `**/project/**.sbt` - sbt: all sbt build definition files `**/*.sbt`, `**/project/build.properties`, `**/project/**.scala`, `**/project/**.sbt`

View File

@ -102,7 +102,7 @@ describe('dependency cache', () => {
await expect(restore('gradle')).rejects.toThrow( await expect(restore('gradle')).rejects.toThrow(
`No file in ${projectRoot( `No file in ${projectRoot(
workspace workspace
)} matched to [**/*.gradle*,**/gradle-wrapper.properties,buildSrc/**/Versions.kt,buildSrc/**/Dependencies.kt,gradle/*.versions.toml,**/versions.properties], make sure you have checked out the target repository` )} matched to [**/*.gradle*,**/gradle-wrapper.properties,buildSrc/**/Versions.kt,buildSrc/**/Dependencies.kt,gradle/*.versions.toml], make sure you have checked out the target repository`
); );
}); });
it('downloads cache based on build.gradle', async () => { it('downloads cache based on build.gradle', async () => {
@ -179,14 +179,6 @@ describe('dependency cache', () => {
expect(firstCall).not.toBe(thirdCall); expect(firstCall).not.toBe(thirdCall);
}); });
}); });
it('downloads cache based on versions.properties', async () => {
createFile(join(workspace, 'versions.properties'));
await restore('gradle');
expect(spyCacheRestore).toHaveBeenCalled();
expect(spyWarning).not.toHaveBeenCalled();
expect(spyInfo).toHaveBeenCalledWith('gradle cache is not found');
});
}); });
describe('save', () => { describe('save', () => {
let spyCacheSave: jest.SpyInstance< let spyCacheSave: jest.SpyInstance<
@ -341,17 +333,6 @@ describe('dependency cache', () => {
expect.stringMatching(/^Cache saved with the key:.*/) expect.stringMatching(/^Cache saved with the key:.*/)
); );
}); });
it('uploads cache based on versions.properties', async () => {
createFile(join(workspace, 'versions.properties'));
createStateForSuccessfulRestore();
await save('gradle');
expect(spyCacheSave).toHaveBeenCalled();
expect(spyWarning).not.toHaveBeenCalled();
expect(spyInfo).toHaveBeenCalledWith(
expect.stringMatching(/^Cache saved with the key:.*/)
);
});
}); });
}); });
}); });

View File

@ -66632,8 +66632,7 @@ const supportedPackageManager = [
'**/gradle-wrapper.properties', '**/gradle-wrapper.properties',
'buildSrc/**/Versions.kt', 'buildSrc/**/Versions.kt',
'buildSrc/**/Dependencies.kt', 'buildSrc/**/Dependencies.kt',
'gradle/*.versions.toml', 'gradle/*.versions.toml'
'**/versions.properties'
] ]
}, },
{ {

3
dist/setup/index.js vendored
View File

@ -101837,8 +101837,7 @@ const supportedPackageManager = [
'**/gradle-wrapper.properties', '**/gradle-wrapper.properties',
'buildSrc/**/Versions.kt', 'buildSrc/**/Versions.kt',
'buildSrc/**/Dependencies.kt', 'buildSrc/**/Dependencies.kt',
'gradle/*.versions.toml', 'gradle/*.versions.toml'
'**/versions.properties'
] ]
}, },
{ {

View File

@ -39,8 +39,7 @@ const supportedPackageManager: PackageManager[] = [
'**/gradle-wrapper.properties', '**/gradle-wrapper.properties',
'buildSrc/**/Versions.kt', 'buildSrc/**/Versions.kt',
'buildSrc/**/Dependencies.kt', 'buildSrc/**/Dependencies.kt',
'gradle/*.versions.toml', 'gradle/*.versions.toml'
'**/versions.properties'
] ]
}, },
{ {