Save and restore caches in parallel

This commit is contained in:
Daz DeBoer 2021-09-06 13:23:36 -06:00
parent 6d1455a33e
commit 378bd0b6f8
No known key found for this signature in database
GPG key ID: DD6B9F0B06683D5D

View file

@ -11,11 +11,13 @@ export async function restore(buildRootDirectory: string): Promise<void> {
return
}
core.startGroup('Restore Gradle state from cache')
core.saveState(BUILD_ROOT_DIR, buildRootDirectory)
new GradleUserHomeCache().restore()
new ProjectDotGradleCache(buildRootDirectory).restore()
core.endGroup()
await core.group('Restore Gradle state from cache', async () => {
core.saveState(BUILD_ROOT_DIR, buildRootDirectory)
return Promise.all([
new GradleUserHomeCache().restore(),
new ProjectDotGradleCache(buildRootDirectory).restore()
])
})
}
export async function save(): Promise<void> {
@ -24,9 +26,11 @@ export async function save(): Promise<void> {
return
}
core.startGroup('Caching Gradle state')
const buildRootDirectory = core.getState(BUILD_ROOT_DIR)
new GradleUserHomeCache().save()
new ProjectDotGradleCache(buildRootDirectory).save()
core.endGroup()
await core.group('Caching Gradle state', async () => {
const buildRootDirectory = core.getState(BUILD_ROOT_DIR)
return Promise.all([
new GradleUserHomeCache().save(),
new ProjectDotGradleCache(buildRootDirectory).save()
])
})
}