mirror of
https://github.com/gradle/gradle-build-action.git
synced 2025-07-03 05:45:59 +02:00
Use monolithic cache for Gradle User Home
- Do not restore cache when GUH exists - Include RUNNER_OS in the cache key - Do not save cache on exact hit - Only save cache in the final post action - Log before saving cache
This commit is contained in:
parent
b3afdc78a7
commit
c211be411e
7 changed files with 247 additions and 22 deletions
11
src/main.ts
11
src/main.ts
|
@ -2,13 +2,15 @@ import * as core from '@actions/core'
|
|||
import * as path from 'path'
|
||||
import {parseArgsStringToArgv} from 'string-argv'
|
||||
|
||||
import * as cacheWrapper from './cache-wrapper'
|
||||
import * as cacheGradleUserHome from './cache-gradle-user-home'
|
||||
import * as execution from './execution'
|
||||
import * as gradlew from './gradlew'
|
||||
import * as provision from './provision'
|
||||
|
||||
// Invoked by GitHub Actions
|
||||
export async function run(): Promise<void> {
|
||||
await cacheGradleUserHome.restore()
|
||||
|
||||
try {
|
||||
const workspaceDirectory = process.env[`GITHUB_WORKSPACE`] || ''
|
||||
const buildRootDirectory = resolveBuildRootDirectory(workspaceDirectory)
|
||||
|
@ -47,11 +49,6 @@ async function resolveGradleExecutable(
|
|||
|
||||
const gradleExecutable = core.getInput('gradle-executable')
|
||||
if (gradleExecutable !== '') {
|
||||
if (gradleExecutable.endsWith(gradlew.wrapperFilename())) {
|
||||
await cacheWrapper.restoreCachedWrapperDist(
|
||||
path.resolve(gradleExecutable, '..')
|
||||
)
|
||||
}
|
||||
return path.resolve(workspaceDirectory, gradleExecutable)
|
||||
}
|
||||
|
||||
|
@ -62,8 +59,6 @@ async function resolveGradleExecutable(
|
|||
: buildRootDirectory
|
||||
|
||||
gradlew.validateGradleWrapper(gradlewDirectory)
|
||||
await cacheWrapper.restoreCachedWrapperDist(gradlewDirectory)
|
||||
|
||||
return path.resolve(gradlewDirectory, gradlew.wrapperFilename())
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue