mirror of
https://github.com/gradle/actions.git
synced 2025-08-19 07:21:28 +08:00
Always set the GRADLE_USER_HOME env var
This commit is contained in:
parent
77266ec345
commit
917439d87d
10
.github/workflows/integ-test-cache-cleanup.yml
vendored
10
.github/workflows/integ-test-cache-cleanup.yml
vendored
@ -79,20 +79,20 @@ jobs:
|
|||||||
cache-read-only: true
|
cache-read-only: true
|
||||||
- name: Report Gradle User Home
|
- name: Report Gradle User Home
|
||||||
run: |
|
run: |
|
||||||
du -hc ~/.gradle/caches/modules-2
|
du -hc $GRADLE_USER_HOME/caches/modules-2
|
||||||
du -hc ~/.gradle/wrapper/dists
|
du -hc $GRADLE_USER_HOME/wrapper/dists
|
||||||
- name: Verify cleaned cache
|
- name: Verify cleaned cache
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
if [ ! -e ~/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-math3/3.1.1 ]; then
|
if [ ! -e $GRADLE_USER_HOME/caches/modules-2/files-2.1/org.apache.commons/commons-math3/3.1.1 ]; then
|
||||||
echo "::error ::Should find commons-math3 3.1.1 in cache"
|
echo "::error ::Should find commons-math3 3.1.1 in cache"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ -e ~/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-math3/3.1 ]; then
|
if [ -e $GRADLE_USER_HOME/caches/modules-2/files-2.1/org.apache.commons/commons-math3/3.1 ]; then
|
||||||
echo "::error ::Should NOT find commons-math3 3.1 in cache"
|
echo "::error ::Should NOT find commons-math3 3.1 in cache"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ ! -e ~/.gradle/wrapper/dists/gradle-8.0.2-bin ]; then
|
if [ ! -e $GRADLE_USER_HOME/wrapper/dists/gradle-8.0.2-bin ]; then
|
||||||
echo "::error ::Should find gradle-8.0.2 in wrapper/dists"
|
echo "::error ::Should find gradle-8.0.2 in wrapper/dists"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -172,7 +172,7 @@ cache-cleanup: 'on-success' # Valid values are 'never' (default), 'on-success' a
|
|||||||
|
|
||||||
### Overwriting an existing Gradle User Home
|
### Overwriting an existing Gradle User Home
|
||||||
|
|
||||||
When the action detects that the Gradle User Home caches directory already exists (`~/.gradle/caches`), then by default it will not overwrite the existing content of this directory.
|
When the action detects that the Gradle User Home caches directory already exists (`$GRADLE_USER_HOME/caches`), then by default it will not overwrite the existing content of this directory.
|
||||||
This can occur when a prior action initializes this directory, or when using a self-hosted runner that retains this directory between uses.
|
This can occur when a prior action initializes this directory, or when using a self-hosted runner that retains this directory between uses.
|
||||||
|
|
||||||
In this case, the Job Summary will display a message like:
|
In this case, the Job Summary will display a message like:
|
||||||
|
@ -84,6 +84,7 @@ async function determineGradleUserHome(): Promise<string> {
|
|||||||
// Use the default Gradle User Home if it already exists
|
// Use the default Gradle User Home if it already exists
|
||||||
if (fs.existsSync(defaultGradleUserHome)) {
|
if (fs.existsSync(defaultGradleUserHome)) {
|
||||||
core.info(`Gradle User Home already exists at ${defaultGradleUserHome}`)
|
core.info(`Gradle User Home already exists at ${defaultGradleUserHome}`)
|
||||||
|
core.exportVariable('GRADLE_USER_HOME', defaultGradleUserHome)
|
||||||
return defaultGradleUserHome
|
return defaultGradleUserHome
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,6 +96,7 @@ async function determineGradleUserHome(): Promise<string> {
|
|||||||
return fasterGradleUserHome
|
return fasterGradleUserHome
|
||||||
}
|
}
|
||||||
|
|
||||||
|
core.exportVariable('GRADLE_USER_HOME', defaultGradleUserHome)
|
||||||
return defaultGradleUserHome
|
return defaultGradleUserHome
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user