-
Notifications
You must be signed in to change notification settings - Fork 763
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement an E2E test for cache-dependency-path option
- Loading branch information
Showing
6 changed files
with
123 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
name: Validate cache with cache-dependency-path option | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- releases/* | ||
paths-ignore: | ||
- '**.md' | ||
pull_request: | ||
paths-ignore: | ||
- '**.md' | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
gradle1-save: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [macos-latest, windows-latest, ubuntu-latest] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Run setup-java with the cache for gradle | ||
uses: ./ | ||
id: setup-java | ||
with: | ||
distribution: 'adopt' | ||
java-version: '11' | ||
cache: gradle | ||
cache-dependency-path: __tests__/cache/gradle1/*.gradle* | ||
- name: Create files to cache | ||
# Need to avoid using Gradle daemon to stabilize the save process on Windows | ||
# https://github.com/actions/cache/issues/454#issuecomment-840493935 | ||
run: | | ||
gradle downloadDependencies --no-daemon -p __tests__/cache/gradle1 | ||
if [ ! -d ~/.gradle/caches ]; then | ||
echo "::error::The ~/.gradle/caches directory does not exist unexpectedly" | ||
exit 1 | ||
fi | ||
gradle1-restore: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [macos-latest, windows-latest, ubuntu-latest] | ||
needs: gradle1-save | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Run setup-java with the cache for gradle | ||
uses: ./ | ||
id: setup-java | ||
with: | ||
distribution: 'adopt' | ||
java-version: '11' | ||
cache: gradle | ||
cache-dependency-path: __tests__/cache/gradle1/*.gradle* | ||
- name: Confirm that ~/.gradle/caches directory has been made | ||
run: | | ||
if [ ! -d ~/.gradle/caches ]; then | ||
echo "::error::The ~/.gradle/caches directory does not exist unexpectedly" | ||
exit 1 | ||
fi | ||
ls ~/.gradle/caches/ | ||
gradle2-restore: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [macos-latest, windows-latest, ubuntu-latest] | ||
needs: gradle1-save | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Run setup-java with the cache for gradle | ||
uses: ./ | ||
id: setup-java | ||
with: | ||
distribution: 'adopt' | ||
java-version: '11' | ||
cache: gradle | ||
cache-dependency-path: __tests__/cache/gradle2/*.gradle* | ||
- name: Confirm that ~/.gradle/caches directory has not been made | ||
run: | | ||
if [ -d ~/.gradle/caches ]; then | ||
echo "::error::The ~/.gradle/caches directory exists unexpectedly" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.gradle | ||
**/build/ | ||
!src/**/build/ | ||
|
||
# Ignore Gradle GUI config | ||
gradle-app.setting | ||
|
||
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) | ||
!gradle-wrapper.jar | ||
|
||
# Cache of project | ||
.gradletasknamecache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
plugins { | ||
id 'java' | ||
} | ||
repositories { | ||
mavenCentral() | ||
} | ||
dependencies { | ||
implementation 'org.junit.jupiter:junit-jupiter-api:5.7.2' | ||
} | ||
tasks.register('downloadDependencies') { | ||
doLast { | ||
def total = configurations.compileClasspath.inject (0) { sum, file -> | ||
sum + file.length() | ||
} | ||
println total | ||
} | ||
} |