Skip to content

Commit

Permalink
Improve caching in GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ajoberstar committed Apr 9, 2020
1 parent a08ca80 commit 09e307a
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 9 deletions.
30 changes: 26 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,32 @@ jobs:
java: [8, 11, 14]
fail-fast: false
steps:
- uses: "actions/checkout@master"
- uses: "actions/setup-java@master"
- name: "Checkout repo"
uses: "actions/checkout@v2"
with:
fetch-depth: 0
- name: "Fetch all tags"
run: "git fetch origin +refs/tags/*:refs/tags/*"
- name: "Setup Java ${{ matrix.java }}"
uses: "actions/setup-java@v1"
with:
java-version: ${{ matrix.java }}
- uses: gradle/wrapper-validation-action@v1
- name: "Validate Gradle Wrapper"
uses: gradle/wrapper-validation-action@v1
- name: "Cache Gradle wrapper"
uses: "actions/cache@v1"
with:
path: "~/.gradle/wrapper"
key: "gradle-wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}"
- name: "Cache Gradle welcome message"
uses: "actions/cache@v1"
with:
path: "~/.gradle/notifications"
key: "gradle-notifications-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}"
- name: "Cache Gradle dependencies"
uses: "actions/cache@v1"
with:
path: "~/.gradle/caches"
key: "gradle-caches-${{ runner.os }}-${{ hashFiles('**/gradle/dependency-locks/*.lockfile') }}"
- name: "Gradle check"
run: "./gradlew check"
run: "./gradlew check --continue"
55 changes: 50 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,64 @@ jobs:
java: [8, 11, 14]
fail-fast: false
steps:
- uses: "actions/checkout@master"
- uses: "actions/setup-java@master"
- name: "Checkout repo"
uses: "actions/checkout@v2"
with:
fetch-depth: 0
- name: "Fetch all tags"
run: "git fetch origin +refs/tags/*:refs/tags/*"
- name: "Setup Java ${{ matrix.java }}"
uses: "actions/setup-java@v1"
with:
java-version: ${{ matrix.java }}
- run: "./gradlew check --continue"
- name: "Validate Gradle Wrapper"
uses: gradle/wrapper-validation-action@v1
- name: "Cache Gradle wrapper"
uses: "actions/cache@v1"
with:
path: "~/.gradle/wrapper"
key: "gradle-wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}"
- name: "Cache Gradle welcome message"
uses: "actions/cache@v1"
with:
path: "~/.gradle/notifications"
key: "gradle-notifications-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}"
- name: "Cache Gradle dependencies"
uses: "actions/cache@v1"
with:
path: "~/.gradle/caches"
key: "gradle-caches-${{ runner.os }}-${{ hashFiles('**/gradle/dependency-locks/*.lockfile') }}"
- name: "Gradle check"
run: "./gradlew check --continue"
publish:
runs-on: ubuntu-latest
needs: check
steps:
- uses: "actions/checkout@master"
- uses: "actions/setup-java@master"
- name: "Checkout repo"
uses: "actions/checkout@v2"
with:
fetch-depth: 0
- name: "Fetch all tags"
run: "git fetch origin +refs/tags/*:refs/tags/*"
- name: "Setup Java"
uses: "actions/setup-java@v1"
with:
java-version: 8
- name: "Cache Gradle wrapper"
uses: "actions/cache@v1"
with:
path: "~/.gradle/wrapper"
key: "gradle-wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}"
- name: "Cache Gradle welcome message"
uses: "actions/cache@v1"
with:
path: "~/.gradle/notifications"
key: "gradle-notifications-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}"
- name: "Cache Gradle dependencies"
uses: "actions/cache@v1"
with:
path: "~/.gradle/caches"
key: "gradle-caches-${{ runner.os }}-${{ hashFiles('**/gradle/dependency-locks/*.lockfile') }}"
- name: "Gradle publish"
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
Expand Down

0 comments on commit 09e307a

Please sign in to comment.