Use Gradle GitHub Action
MODIFY
.github/workflows/ci.yml
.github/workflows/ci.yml
@@ -20,23 +20,14 @@ jobs:
distribution: adopt
java-version: 11
- - name: Restore cache
- uses: burrunan/gradle-cache-action@v1.10
- with:
- job-id: jdk11
-
- - name: Cache Gradle Wrapper
- uses: actions/cache@v2
- with:
- path: ~/.gradle/wrapper
- key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
-
- name: Build
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
- run: ./gradlew build
+ uses: gradle/gradle-build-action@v2
+ with:
+ arguments: build
build-gradle-plugins:
runs-on: ubuntu-latest
@@ -51,12 +42,6 @@ jobs:
distribution: adopt
java-version: 11
- - name: Cache Gradle Wrapper
- uses: actions/cache@v2
- with:
- path: ~/.gradle/wrapper
- key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
-
- name: Build
run: ../gradlew build
working-directory: gradle-plugins
@@ -91,24 +76,14 @@ jobs:
distribution: adopt
java-version: 11
- - name: Restore cache
- uses: burrunan/gradle-cache-action@v1.10
- with:
- job-id: jdk${{ matrix.test-java-version }}
- read-only: true
-
- - name: Cache Gradle Wrapper
- uses: actions/cache@v2
- with:
- path: ~/.gradle/wrapper
- key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
-
- name: Test
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
- run: ./gradlew test -PtestJavaVersion=${{ matrix.test-java-version }} -PtestJavaVM=${{ matrix.vm }} -Porg.gradle.java.installations.paths=${{ steps.setup-test-java.outputs.path }} -Porg.gradle.java.installations.auto-download=false
+ uses: gradle/gradle-build-action@v2
+ with:
+ arguments: test -PtestJavaVersion=${{ matrix.test-java-version }} -PtestJavaVM=${{ matrix.vm }} -Porg.gradle.java.installations.paths=${{ steps.setup-test-java.outputs.path }} -Porg.gradle.java.installations.auto-download=false
testLatestDeps:
runs-on: ubuntu-latest
@@ -123,30 +98,14 @@ jobs:
distribution: adopt
java-version: 11
- # Workaround https://github.com/burrunan/gradle-cache-action/issues/46
- - name: Set dependencies cache key
- shell: bash
- run: echo "testLatestDeps" > gradle/otel-gradle-dependencies-key
-
- - name: Restore cache
- uses: burrunan/gradle-cache-action@v1.10
- with:
- job-id: latestDepTest
- gradle-dependencies-cache-key: |
- gradle/otel-gradle-dependencies-key
-
- - name: Cache Gradle Wrapper
- uses: actions/cache@v2
- with:
- path: ~/.gradle/wrapper
- key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
-
- name: Test
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
- run: ./gradlew test -PtestLatestDeps=true
+ uses: gradle/gradle-build-action@v2
+ with:
+ arguments: test -PtestLatestDeps=true
smoke-test:
runs-on: ${{ matrix.os }}
@@ -183,24 +142,14 @@ jobs:
distribution: adopt
java-version: 11
- - name: Restore cache
- uses: burrunan/gradle-cache-action@v1.10
- with:
- job-id: smokeTests
- read-only: true
-
- - name: Cache Gradle Wrapper
- uses: actions/cache@v2
- with:
- path: ~/.gradle/wrapper
- key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
-
- name: Test
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
- run: ./gradlew :smoke-tests:test -PsmokeTestSuite=${{ matrix.smoke-test-suite }}
+ uses: gradle/gradle-build-action@v2
+ with:
+ arguments: :smoke-tests:test -PsmokeTestSuite=${{ matrix.smoke-test-suite }}
setup-muzzle-matrix:
runs-on: ubuntu-latest
@@ -273,32 +222,37 @@ jobs:
distribution: adopt
java-version: 11
- - name: Cache Gradle Wrapper
- uses: actions/cache@v2
- with:
- path: ~/.gradle/wrapper
- key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('examples/distro/gradle/wrapper/gradle-wrapper.properties') }}
-
- name: Local publish of artifacts
+ uses: gradle/gradle-build-action@v2
+ with:
# javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/
- run: ./gradlew publishToMavenLocal -x javadoc
+ arguments: publishToMavenLocal -x javadoc
- name: Local publish of gradle plugins
+ uses: gradle/gradle-build-action@v2
+ with:
# javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/
- run: ../gradlew publishToMavenLocal -x javadoc
- working-directory: gradle-plugins
+ arguments: publishToMavenLocal -x javadoc
+ build-root-directory: gradle-plugins
- name: Build distro
- run: ./gradlew build --init-script ../../.github/scripts/local.init.gradle.kts
- working-directory: examples/distro
+ uses: gradle/gradle-build-action@v2
+ with:
+ arguments: build --init-script ../../.github/scripts/local.init.gradle.kts
+ build-root-directory: examples/distro
- name: Build extension
- run: ./gradlew build --init-script ../../.github/scripts/local.init.gradle.kts
- working-directory: examples/extension
+ uses: gradle/gradle-build-action@v2
+ with:
+ arguments: build --init-script ../../.github/scripts/local.init.gradle.kts
+ build-root-directory: examples/extension
- name: Run muzzle check against extension
- run: ./gradlew muzzle --init-script ../../.github/scripts/local.init.gradle.kts
- working-directory: examples/extension
+ uses: gradle/gradle-build-action@v2
+ with:
+ cache-read-only: true
+ arguments: muzzle --init-script ../../.github/scripts/local.init.gradle.kts
+ build-root-directory: examples/extension
snapshot:
runs-on: ubuntu-latest
@@ -319,18 +273,6 @@ jobs:
distribution: adopt
java-version: 11
- - name: Restore cache
- uses: burrunan/gradle-cache-action@v1.10
- with:
- job-id: jdk11
- read-only: true
-
- - name: Cache Gradle Wrapper
- uses: actions/cache@v2
- with:
- path: ~/.gradle/wrapper
- key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
-
- name: Build and publish artifact snapshots
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
@@ -338,7 +280,9 @@ jobs:
SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
- run: ./gradlew assemble publishToSonatype
+ uses: gradle/gradle-build-action@v2
+ with:
+ arguments: assemble publishToSonatype
- name: Build and publish gradle plugin snapshots
env:
@@ -347,5 +291,7 @@ jobs:
SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
- run: ../gradlew build publishToSonatype
- working-directory: gradle-plugins
+ uses: gradle/gradle-build-action@v2
+ with:
+ arguments: build publishToSonatype
+ build-root-directory: gradle-plugins

MODIFY
.github/workflows/nightly.yml
.github/workflows/nightly.yml
@@ -20,23 +20,14 @@ jobs:
distribution: adopt
java-version: 11
- - name: Restore cache
- uses: burrunan/gradle-cache-action@v1.10
- with:
- job-id: jdk11
-
- - name: Cache Gradle Wrapper
- uses: actions/cache@v2
- with:
- path: ~/.gradle/wrapper
- key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
-
- name: Build
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
- run: ./gradlew build
+ uses: gradle/gradle-build-action@v2
+ with:
+ arguments: build
build-gradle-plugins:
runs-on: ubuntu-latest
@@ -51,12 +42,6 @@ jobs:
distribution: adopt
java-version: 11
- - name: Cache Gradle Wrapper
- uses: actions/cache@v2
- with:
- path: ~/.gradle/wrapper
- key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
-
- name: Build
run: ../gradlew build
working-directory: gradle-plugins
@@ -91,24 +76,14 @@ jobs:
distribution: adopt
java-version: 11
- - name: Restore cache
- uses: burrunan/gradle-cache-action@v1.10
- with:
- job-id: jdk${{ matrix.test-java-version }}
- read-only: true
-
- - name: Cache Gradle Wrapper
- uses: actions/cache@v2
- with:
- path: ~/.gradle/wrapper
- key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
-
- name: Test
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
- run: ./gradlew test -PtestJavaVersion=${{ matrix.test-java-version }} -PtestJavaVM=${{ matrix.vm }} -Porg.gradle.java.installations.paths=${{ steps.setup-test-java.outputs.path }} -Porg.gradle.java.installations.auto-download=false
+ uses: gradle/gradle-build-action@v2
+ with:
+ arguments: test -PtestJavaVersion=${{ matrix.test-java-version }} -PtestJavaVM=${{ matrix.vm }} -Porg.gradle.java.installations.paths=${{ steps.setup-test-java.outputs.path }} -Porg.gradle.java.installations.auto-download=false
testLatestDeps:
runs-on: ubuntu-latest
@@ -123,30 +98,14 @@ jobs:
distribution: adopt
java-version: 11
- # Workaround https://github.com/burrunan/gradle-cache-action/issues/46
- - name: Set dependencies cache key
- shell: bash
- run: echo "testLatestDeps" > gradle/otel-gradle-dependencies-key
-
- - name: Restore cache
- uses: burrunan/gradle-cache-action@v1.10
- with:
- job-id: latestDepTest
- gradle-dependencies-cache-key: |
- gradle/otel-gradle-dependencies-key
-
- - name: Cache Gradle Wrapper
- uses: actions/cache@v2
- with:
- path: ~/.gradle/wrapper
- key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
-
- name: Test
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
- run: ./gradlew test -PtestLatestDeps=true
+ uses: gradle/gradle-build-action@v2
+ with:
+ arguments: test -PtestLatestDeps=true
smoke-test:
runs-on: ${{ matrix.os }}
@@ -183,24 +142,14 @@ jobs:
distribution: adopt
java-version: 11
- - name: Restore cache
- uses: burrunan/gradle-cache-action@v1.10
- with:
- job-id: smokeTests
- read-only: true
-
- - name: Cache Gradle Wrapper
- uses: actions/cache@v2
- with:
- path: ~/.gradle/wrapper
- key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
-
- name: Test
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
- run: ./gradlew :smoke-tests:test -PsmokeTestSuite=${{ matrix.smoke-test-suite }}
+ uses: gradle/gradle-build-action@v2
+ with:
+ arguments: :smoke-tests:test -PsmokeTestSuite=${{ matrix.smoke-test-suite }}
setup-muzzle-matrix:
runs-on: ubuntu-latest
@@ -273,32 +222,37 @@ jobs:
distribution: adopt
java-version: 11
- - name: Cache Gradle Wrapper
- uses: actions/cache@v2
- with:
- path: ~/.gradle/wrapper
- key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('examples/distro/gradle/wrapper/gradle-wrapper.properties') }}
-
- name: Local publish of artifacts
+ uses: gradle/gradle-build-action@v2
+ with:
# javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/
- run: ./gradlew publishToMavenLocal -x javadoc
+ arguments: publishToMavenLocal -x javadoc
- name: Local publish of gradle plugins
+ uses: gradle/gradle-build-action@v2
+ with:
# javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/
- run: ../gradlew publishToMavenLocal -x javadoc
- working-directory: gradle-plugins
+ arguments: publishToMavenLocal -x javadoc
+ build-root-directory: gradle-plugins
- name: Build distro
- run: ./gradlew build --init-script ../../.github/scripts/local.init.gradle.kts
- working-directory: examples/distro
+ uses: gradle/gradle-build-action@v2
+ with:
+ arguments: build --init-script ../../.github/scripts/local.init.gradle.kts
+ build-root-directory: examples/distro
- name: Build extension
- run: ./gradlew build --init-script ../../.github/scripts/local.init.gradle.kts
- working-directory: examples/extension
+ uses: gradle/gradle-build-action@v2
+ with:
+ arguments: build --init-script ../../.github/scripts/local.init.gradle.kts
+ build-root-directory: examples/extension
- name: Run muzzle check against extension
- run: ./gradlew muzzle --init-script ../../.github/scripts/local.init.gradle.kts
- working-directory: examples/extension
+ uses: gradle/gradle-build-action@v2
+ with:
+ cache-read-only: true
+ arguments: muzzle --init-script ../../.github/scripts/local.init.gradle.kts
+ build-root-directory: examples/extension
issue:
name: Open issue on failure

MODIFY
.github/workflows/pr.yml
.github/workflows/pr.yml
@@ -20,22 +20,14 @@ jobs:
distribution: adopt
java-version: 11
- - name: Restore cache
- uses: burrunan/gradle-cache-action@v1.10
- with:
- job-id: jdk11
-
- - name: Cache Gradle Wrapper
- uses: actions/cache@v2
- with:
- path: ~/.gradle/wrapper
- key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
-
- name: Start deadlock detector
run: .github/scripts/deadlock-detector.sh
- name: Build
- run: ./gradlew build
+ uses: gradle/gradle-build-action@v2
+ with:
+ arguments: build
+ cache-read-only: true
- name: Upload deadlock detector artifacts if any
if: always()
@@ -66,15 +58,13 @@ jobs:
distribution: adopt
java-version: 11
- - name: Cache Gradle Wrapper
- uses: actions/cache@v2
- with:
- path: ~/.gradle/wrapper
- key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
-
- name: Build
- run: ../gradlew build
- working-directory: gradle-plugins
+ uses: gradle/gradle-build-action@v2
+ with:
+ cache-read-only: true
+ arguments: build
+ build-root-directory: gradle-plugins
+ gradle-executable: ./gradlew
test:
runs-on: ubuntu-latest
@@ -106,23 +96,14 @@ jobs:
distribution: adopt
java-version: 11
- - name: Restore cache
- uses: burrunan/gradle-cache-action@v1.10
- with:
- job-id: jdk${{ matrix.test-java-version }}
- read-only: true
-
- - name: Cache Gradle Wrapper
- uses: actions/cache@v2
- with:
- path: ~/.gradle/wrapper
- key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
-
- name: Start deadlock detector
run: .github/scripts/deadlock-detector.sh
- name: Test
- run: ./gradlew test -PtestJavaVersion=${{ matrix.test-java-version }} -PtestJavaVM=${{ matrix.vm }} -Porg.gradle.java.installations.paths=${{ steps.setup-test-java.outputs.path }} -Porg.gradle.java.installations.auto-download=false
+ uses: gradle/gradle-build-action@v2
+ with:
+ arguments: test -PtestJavaVersion=${{ matrix.test-java-version }} -PtestJavaVM=${{ matrix.vm }} -Porg.gradle.java.installations.paths=${{ steps.setup-test-java.outputs.path }} -Porg.gradle.java.installations.auto-download=false
+ cache-read-only: true
- name: Upload deadlock detector artifacts if any
if: always()
@@ -182,20 +163,11 @@ jobs:
distribution: adopt
java-version: 11
- - name: Restore cache
- uses: burrunan/gradle-cache-action@v1.10
- with:
- job-id: smokeTests
- read-only: true
-
- - name: Cache Gradle Wrapper
- uses: actions/cache@v2
- with:
- path: ~/.gradle/wrapper
- key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
-
- name: Test
- run: ./gradlew :smoke-tests:test -PsmokeTestSuite=${{ matrix.smoke-test-suite }}
+ uses: gradle/gradle-build-action@v2
+ with:
+ cache-read-only: true
+ arguments: :smoke-tests:test -PsmokeTestSuite=${{ matrix.smoke-test-suite }}
setup-muzzle-matrix:
runs-on: ubuntu-latest
@@ -240,12 +212,6 @@ jobs:
distribution: adopt
java-version: 11
- - name: Cache Gradle Wrapper
- uses: actions/cache@v2
- with:
- path: ~/.gradle/wrapper
- key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
-
- name: Run muzzle
# using retry because of sporadic gradle download failures
uses: nick-invision/retry@v2.6.0
@@ -268,32 +234,42 @@ jobs:
distribution: adopt
java-version: 11
- - name: Cache Gradle Wrapper
- uses: actions/cache@v2
- with:
- path: ~/.gradle/wrapper
- key: ${{ runner.os }}-gradle-wrapper-cache-${{ hashFiles('examples/distro/gradle/wrapper/gradle-wrapper.properties') }}
-
- name: Local publish of artifacts
+ uses: gradle/gradle-build-action@v2
+ with:
+ cache-read-only: true
# javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/
- run: ./gradlew publishToMavenLocal -x javadoc
+ arguments: publishToMavenLocal -x javadoc
- name: Local publish of gradle plugins
+ uses: gradle/gradle-build-action@v2
+ with:
+ cache-read-only: true
# javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/
- run: ../gradlew publishToMavenLocal -x javadoc
- working-directory: gradle-plugins
+ arguments: publishToMavenLocal -x javadoc
+ build-root-directory: gradle-plugins
+ gradle-executable: ./gradlew
- name: Build distro
- run: ./gradlew build --init-script ../../.github/scripts/local.init.gradle.kts
- working-directory: examples/distro
+ uses: gradle/gradle-build-action@v2
+ with:
+ cache-read-only: true
+ arguments: build --init-script ../../.github/scripts/local.init.gradle.kts
+ build-root-directory: examples/distro
- name: Build extension
- run: ./gradlew build --init-script ../../.github/scripts/local.init.gradle.kts
- working-directory: examples/extension
+ uses: gradle/gradle-build-action@v2
+ with:
+ cache-read-only: true
+ arguments: build --init-script ../../.github/scripts/local.init.gradle.kts
+ build-root-directory: examples/extension
- name: Run muzzle check against extension
- run: ./gradlew muzzle --init-script ../../.github/scripts/local.init.gradle.kts
- working-directory: examples/extension
+ uses: gradle/gradle-build-action@v2
+ with:
+ cache-read-only: true
+ arguments: muzzle --init-script ../../.github/scripts/local.init.gradle.kts
+ build-root-directory: examples/extension
accept-pr:
needs: [ build, test, smoke-test, muzzle, examples ]

Use Gradle GitHub Action (#4887)