Move testLatestDeps to reusable workflow
MODIFY
.github/workflows/ci.yml
.github/workflows/ci.yml
@@ -84,28 +84,15 @@ jobs:
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
# release branches are excluded
# because any time a new library version is released to maven central it can fail
# which requires unnecessary release branch maintenance, especially for patches
if: ${{ !startsWith(github.ref_name, 'v') }}
- steps:
- - uses: actions/checkout@v3
-
- - name: Set up JDK 11 for running Gradle
- uses: actions/setup-java@v2
- with:
- distribution: adopt
- java-version: 11
-
- - name: Test
- env:
+ uses: ./.github/workflows/test-latest-deps.yml
+ secrets:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
- uses: gradle/gradle-build-action@v2
- with:
- arguments: test -PtestLatestDeps=true
smoke-test:
uses: ./.github/workflows/smoke-test.yml

MODIFY
.github/workflows/nightly-no-cache.yml
.github/workflows/nightly-no-cache.yml
@@ -79,22 +79,11 @@ jobs:
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 --no-build-cache
testLatestDeps:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
-
- - name: Set up JDK 11 for running Gradle
- uses: actions/setup-java@v2
+ uses: ./.github/workflows/test-latest-deps.yml
with:
- distribution: adopt
- java-version: 11
-
- - name: Test
- env:
+ no-build-cache: true
+ secrets:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
- uses: gradle/gradle-build-action@v2
- with:
- arguments: test -PtestLatestDeps=true --no-build-cache
smoke-test:
uses: ./.github/workflows/smoke-test.yml

MODIFY
.github/workflows/nightly.yml
.github/workflows/nightly.yml
@@ -83,24 +83,11 @@ jobs:
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
- steps:
- - uses: actions/checkout@v3
-
- - name: Set up JDK 11 for running Gradle
- uses: actions/setup-java@v2
- with:
- distribution: adopt
- java-version: 11
-
- - name: Test
- env:
+ uses: ./.github/workflows/test-latest-deps.yml
+ secrets:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
- uses: gradle/gradle-build-action@v2
- with:
- arguments: test -PtestLatestDeps=true
smoke-test:
uses: ./.github/workflows/smoke-test.yml

MODIFY
.github/workflows/pr.yml
.github/workflows/pr.yml
@@ -139,23 +139,9 @@ jobs:
#
# and the name is updated when the steps below are skipped which makes what's happening clearer
# in the GitHub UI
- name: testLatestDeps${{ !contains(github.event.pull_request.labels.*.name, 'test latest deps') && ' (skipped)' || '' }}
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
-
- - name: Set up JDK 11 for running Gradle
- if: ${{ contains(github.event.pull_request.labels.*.name, 'test latest deps') }}
- uses: actions/setup-java@v2
- with:
- distribution: adopt
- java-version: 11
-
- - name: Test
- if: ${{ contains(github.event.pull_request.labels.*.name, 'test latest deps') }}
- uses: gradle/gradle-build-action@v2
+ uses: ./.github/workflows/test-latest-deps.yml
with:
- arguments: test -PtestLatestDeps=true
+ skip: ${{ !contains(github.event.pull_request.labels.*.name, 'test latest deps') }}
cache-read-only: true
smoke-test:

ADD
.github/workflows/test-latest-deps.yml
+name: Test latest deps
+
+on:
+ workflow_call:
+ inputs:
+ skip:
+ type: boolean
+ required: false
+ cache-read-only:
+ type: boolean
+ required: false
+ no-build-cache:
+ type: boolean
+ required: false
+ secrets:
+ GRADLE_ENTERPRISE_ACCESS_KEY:
+ required: false
+ GE_CACHE_USERNAME:
+ required: false
+ GE_CACHE_PASSWORD:
+ required: false
+
+jobs:
+ testLatestDeps:
+ # the condition is on the steps below instead of here on the job, because skipping the job
+ # causes the job to show up as canceled in the GitHub UI which prevents the build section from
+ # collapsing when everything (else) is green
+ #
+ # and the name is updated when the steps below are skipped which makes what's happening clearer
+ # in the GitHub UI
+ name: testLatestDeps${{ inputs.skip && ' (skipped)' || '' }}
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Set up JDK 11 for running Gradle
+ if: ${{ inputs.skipped }}
+ uses: actions/setup-java@v2
+ with:
+ distribution: adopt
+ java-version: 11
+
+ - name: Test
+ if: ${{ inputs.skipped }}
+ uses: gradle/gradle-build-action@v2
+ with:
+ arguments: test -PtestLatestDeps=true ${{ inputs.no-build-cache && ' --no-build-cache' || '' }}
+ cache-read-only: ${{ inputs.cache-read-only }}

Move testLatestDeps to reusable workflow (#5487)