[CI] Ensure that the HEAD of the PR branch is checked out instead of … #699
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
name: Continuous Integration | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
types: [opened, synchronize] | |
branches: | |
- master | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dfix.core.debug=STATE_CLEANUP -Dfix.core.ci=true" | |
permissions: | |
contents: read | |
jobs: | |
build: | |
name: Java ${{ matrix.java }} (${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
java: [ '8', '11', '17', '21' ] | |
os: [ 'ubuntu-22.04', 'windows-latest' ] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Cache Gradle dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Cache Gradle wrappers | |
uses: actions/cache@v4 | |
with: | |
path: ~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} | |
- name: Setup java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: ${{ matrix.java }} | |
- name: Setup BUILD_JAVA_HOME & BUILD_JAVA_VERSION | |
run: | | |
java -Xinternalversion | |
echo "BUILD_JAVA_HOME=${JAVA_HOME}" >> $GITHUB_ENV | |
echo "BUILD_JAVA_VERSION=${{ matrix.java }}" >> $GITHUB_ENV | |
- name: Setup java 8 to run the Gradle script | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 8 | |
- name: Build with Gradle | |
run: ./gradlew | |
- name: Copy test logs | |
id: copy_test_logs | |
if: failure() | |
run: | | |
echo "dir=build/test_logs" >> $GITHUB_OUTPUT | |
./gradlew copyTestLogs | |
- name: Upload crash logs | |
if: always() && steps.copy_test_logs.outputs.dir == 'build/test_logs' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: crash-logs-${{ matrix.os }}-java-${{ matrix.java }} | |
path: ${{ steps.copy_test_logs.outputs.dir }} |