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