mirror of
https://gitea.com/actions/setup-java.git
synced 2025-04-06 23:39:37 +00:00
fix sbt/scala cache key (#478)
This commit is contained in:
@ -145,7 +145,7 @@ describe('dependency cache', () => {
|
||||
await expect(restore('sbt')).rejects.toThrow(
|
||||
`No file in ${projectRoot(
|
||||
workspace
|
||||
)} matched to [**/*.sbt,**/project/build.properties,**/project/**.{scala,sbt}], make sure you have checked out the target repository`
|
||||
)} matched to [**/*.sbt,**/project/build.properties,**/project/**.scala,**/project/**.sbt], make sure you have checked out the target repository`
|
||||
);
|
||||
});
|
||||
it('downloads cache', async () => {
|
||||
@ -156,6 +156,28 @@ describe('dependency cache', () => {
|
||||
expect(spyWarning).not.toHaveBeenCalled();
|
||||
expect(spyInfo).toHaveBeenCalledWith('sbt cache is not found');
|
||||
});
|
||||
it('detects scala and sbt changes under **/project/ folder', async () => {
|
||||
createFile(join(workspace, 'build.sbt'));
|
||||
createDirectory(join(workspace, 'project'));
|
||||
createFile(join(workspace, 'project/DependenciesV1.scala'));
|
||||
|
||||
await restore('sbt');
|
||||
const firstCall = spySaveState.mock.calls.toString();
|
||||
|
||||
spySaveState.mockClear();
|
||||
await restore('sbt');
|
||||
const secondCall = spySaveState.mock.calls.toString();
|
||||
|
||||
// Make sure multiple restores produce the same cache
|
||||
expect(firstCall).toBe(secondCall);
|
||||
|
||||
spySaveState.mockClear();
|
||||
createFile(join(workspace, 'project/DependenciesV2.scala'));
|
||||
await restore('sbt');
|
||||
const thirdCall = spySaveState.mock.calls.toString();
|
||||
|
||||
expect(firstCall).not.toBe(thirdCall);
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('save', () => {
|
||||
|
Reference in New Issue
Block a user