Move build to reusable workflow
* Move build to reusable workflow
* pass secrets where needed
* pass secrets where needed
* build -> assemble
* and check
* Revert "and check"
This reverts commit
* Revert "build -> assemble"
This reverts commit
ADD
.github/workflows/build.yml
+name: Build
+
+on:
+ workflow_call:
+ inputs:
+ 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:
+ build:
+ 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: Start deadlock detector
+ run: .github/scripts/deadlock-detector.sh
+
+ - name: Build
+ uses: gradle/gradle-build-action@v2
+ env:
+ GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
+ GE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
+ GE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
+ with:
+ # javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/
+ arguments: build -x javadoc ${{ inputs.no-build-cache && '--no-build-cache' || '' }}
+ cache-read-only: ${{ inputs.cache-read-only }}
+
+ - name: Upload deadlock detector artifacts if any
+ if: always()
+ uses: actions/upload-artifact@v2
+ with:
+ name: deadlock-detector-build
+ path: /tmp/deadlock-detector-*
+ if-no-files-found: ignore
+
+ - name: Upload jvm crash dump files if any
+ if: always()
+ uses: actions/upload-artifact@v2
+ with:
+ name: javacore-build
+ path: |
+ "**/hs_err_pid*.log"
+ "**/javacore.*.txt"
+ "**/Snap.*.trc"
+ "**/core.*.dmp"
+ "**/jitdump.*.dmp"
+ if-no-files-found: ignore
+
+ build-gradle-plugins:
+ 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: Build
+ uses: gradle/gradle-build-action@v2
+ with:
+ arguments: build ${{ inputs.no-build-cache && '--no-build-cache' || '' }}
+ build-root-directory: gradle-plugins
+ cache-read-only: ${{ inputs.cache-read-only }}

MODIFY
.github/workflows/ci.yml
.github/workflows/ci.yml
@@ -9,42 +9,11 @@ on:
jobs:
build:
- 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: Build
- env:
+ uses: ./.github/workflows/build.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:
- # javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/
- arguments: build -x javadoc
-
- build-gradle-plugins:
- 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: Build
- uses: gradle/gradle-build-action@v2
- with:
- arguments: build
- build-root-directory: gradle-plugins
test:
uses: ./.github/workflows/test.yml

MODIFY
.github/workflows/nightly-no-cache.yml
.github/workflows/nightly-no-cache.yml
@@ -8,40 +8,11 @@ on:
jobs:
build:
- 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/build.yml
with:
- distribution: adopt
- java-version: 11
-
- - name: Build
- env:
+ no-build-cache: true
+ secrets:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
- uses: gradle/gradle-build-action@v2
- with:
- # javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/
- arguments: build --no-build-cache -x javadoc
-
- build-gradle-plugins:
- 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: Build
- uses: gradle/gradle-build-action@v2
- with:
- arguments: build --no-build-cache
- build-root-directory: gradle-plugins
test:
uses: ./.github/workflows/test.yml

MODIFY
.github/workflows/nightly.yml
.github/workflows/nightly.yml
@@ -8,42 +8,11 @@ on:
jobs:
build:
- 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: Build
- env:
+ uses: ./.github/workflows/build.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:
- # javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/
- arguments: build -x javadoc
-
- build-gradle-plugins:
- 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: Build
- uses: gradle/gradle-build-action@v2
- with:
- arguments: build
- root-build-directory: gradle-plugins
test:
uses: ./.github/workflows/test.yml

MODIFY
.github/workflows/pr.yml
.github/workflows/pr.yml
@@ -8,64 +8,9 @@ concurrency:
jobs:
build:
- 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: Start deadlock detector
- run: .github/scripts/deadlock-detector.sh
-
- - name: Build
- uses: gradle/gradle-build-action@v2
- with:
- # javadoc task fails sporadically fetching https://docs.oracle.com/javase/8/docs/api/
- arguments: build -x javadoc
- cache-read-only: true
-
- - name: Upload deadlock detector artifacts if any
- if: always()
- uses: actions/upload-artifact@v2
- with:
- name: deadlock-detector-build
- path: /tmp/deadlock-detector-*
- if-no-files-found: ignore
-
- - name: Upload jvm crash dump files if any
- if: always()
- uses: actions/upload-artifact@v2
- with:
- name: javacore-build
- path: |
- "**/hs_err_pid*.log"
- "**/javacore.*.txt"
- "**/Snap.*.trc"
- "**/core.*.dmp"
- "**/jitdump.*.dmp"
- if-no-files-found: ignore
-
- build-gradle-plugins:
- 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: Build
- uses: gradle/gradle-build-action@v2
+ uses: ./.github/workflows/build.yml
with:
cache-read-only: true
- arguments: build
- build-root-directory: gradle-plugins
test:
uses: ./.github/workflows/test.yml
@@ -125,7 +70,7 @@ jobs:
./bin/misspell -error ./**/*
accept-pr:
- needs: [ build, build-gradle-plugins, test, smoke-test, muzzle, examples, markdown-misspell-check ]
+ needs: [ build, test, smoke-test, muzzle, examples, markdown-misspell-check ]
runs-on: ubuntu-latest
if: always()
steps:

Move build to reusable workflow (#5483)

* Move build to reusable workflow

* pass secrets where needed

* pass secrets where needed

* build -> assemble

* and check

* Revert "and check"

This reverts commit aa981d0f4e8a89431d23d2e56a113e87b3923481.

* Revert "build -> assemble"

This reverts commit c00f6d1d35a691357ace378ab3bd4a42650f938b.