Skip to content

Enable building & testing with Java 21 #138

Enable building & testing with Java 21

Enable building & testing with Java 21 #138

Workflow file for this run

name: CI
on:
# allow to manually trigger a build through the Actions tab
workflow_dispatch:
# trigger build on PR
pull_request:
# trigger build when a branch is pushed
push:
# put here a list of branches like master, release/x.y, or any branch name activated for building. This also applies to forks.
branches:
- master
jobs:
event_file:
name: "Publish Github Event Information"
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Upload
uses: actions/upload-artifact@v2
with:
name: Event File
path: ${{ github.event_path }}
with-container-root:
# uncomment to disable this job
#if: ${{ false }}
name: Inside container almalinux ${{matrix.distribution}}-${{matrix.java}} as root
runs-on: ubuntu-latest
container:
image: almalinux:latest
strategy:
matrix:
java: [ 8, 11, 17, 21 ]
distribution: [ zulu ]
fail-fast: false
max-parallel: 4
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install ${{matrix.distribution}}-${{matrix.java}}
uses: actions/setup-java@v2
with:
java-version: ${{matrix.java}}
distribution: ${{matrix.distribution}}
- name: Install lsof
run: yum -y install lsof procps
- name: Test with Gradle
run: ./gradlew --show-version check
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v2
with:
name: Test Results (container almalinux ${{matrix.distribution}}-${{matrix.java}} as root)
path: |
**/build/reports/**
**/build/test-results/**
with-container-user:
# uncomment to disable this job
#if: ${{ false }}
name: Inside container almalinux ${{matrix.distribution}}-${{matrix.java}} as user
runs-on: ubuntu-latest
container:
image: almalinux:latest
options: --user 1001:1001
strategy:
matrix:
java: [ 8, 11, 17, 21 ]
distribution: [ zulu ]
fail-fast: false
max-parallel: 4
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install ${{matrix.distribution}}-${{matrix.java}}
uses: actions/setup-java@v2
with:
java-version: ${{matrix.java}}
distribution: ${{matrix.distribution}}
- name: Test with Gradle
# When running in a container using an "anonymous" non-root user, 'user.home' is likely not set to a usable value
# and must be set manually. (See https://bugs.openjdk.java.net/browse/JDK-8193433) Since this task uses an
# anonymous non-root user, a Gradle init script is used to set 'user.home' to "$HOME" and amend the testing tasks
# to pass that value through to the testing JVMs.
run: >
java -XshowSettings:all -version &&
./gradlew --show-version --init-script .github/workflows/propagateUserHome.gradle.kts check
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v2
with:
name: Test Results (container almalinux ${{matrix.distribution}}-${{matrix.java}} as user)
path: |
**/build/reports/**
**/build/test-results/**
without-container:
# uncomment to disable this job
#if: ${{ false }}
name: ${{matrix.os}} ${{matrix.distribution}}-${{matrix.java}}
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ ubuntu-latest, macOS-latest, windows-latest ]
java: [ 8, 11, 17, 21 ]
distribution: [ zulu ]
fail-fast: false
max-parallel: 4
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install ${{matrix.distribution}}-${{matrix.java}}
uses: actions/setup-java@v2
with:
java-version: ${{matrix.java}}
distribution: ${{matrix.distribution}}
- name: Test with Gradle
# Uses 'build' to include construction of jars and, on Windows, javadoc
run: ./gradlew --show-version ${{ startsWith(matrix.os, 'windows') && 'build' || 'build --exclude-task javadoc' }}
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v2
with:
name: Test Results (${{matrix.os}} ${{matrix.distribution}}-${{matrix.java}})
path: |
**/build/reports/**
**/build/test-results/**
# this job will publish test results when the build is executed:
# - either within someone's fork, for a fork's branch
# - either for master build
# Actions run on a pull_request event for a fork repository cannot
# do anything useful like creating check runs or pull request comments
# as part of the CI script
# More info: https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.20/README.md#support-fork-repositories-and-dependabot-branches
publish-test-results:
name: "Publish Tests Results (non-PR build)"
needs: [ with-container-root, with-container-user, without-container ]
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' }}
steps:
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
with:
report_individual_runs: true
comment_mode: update last
check_name: Tests Results
files: |
**/build/test-results/**/*.xml