Update to JUnit Jupiter 5.10 (#799) #1043
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: Main build | |
env: | |
EXPERIMENTAL_JAVA: 22 | |
on: | |
# We want to trigger our builds all the time for the default branch | |
# except when Shipkit creates a new version tag | |
push: | |
branches: ['main'] | |
tags-ignore: | |
- 'v**' | |
# Each pull request is important to us, doesn't matter from which branch. | |
# Furthermore, we do not want to build on just the default GitHub Action | |
# events, we also want to react onto `labeled` events for our extended | |
# build execution | |
pull_request: | |
types: [labeled, opened, synchronize, reopened] | |
# We also utilize this pipeline for releasing. By providing a `version` | |
# and setting `releasing` to `true`, we can trigger a release. | |
workflow_dispatch: | |
inputs: | |
releasing: | |
description: "Release build" | |
type: boolean | |
default: false | |
version: | |
description: 'Version string, e.g. 2.3.1:' | |
required: true | |
jobs: | |
# Basic Gradle wrapper validation. This step is run first, due to security | |
# concerns. Running our whole pipeline with Gradle with a corrupt wrapper, | |
# could expose our secrets, and we definitely want to prevent this. | |
validation: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
name: Gradle wrapper validation | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
- name: Validate Gradle wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
# Our basic build step as we want contributors to have a nice developer | |
# experience with little build time and sufficient feedback. Therefore, we | |
# only build this on our default Java version but for all operating systems | |
# we are supporting. This allows for a fast execution and fast feedback. The | |
# extended tests will run later under certain conditions. | |
basic: | |
runs-on: ${{ matrix.os }}-latest | |
needs: validation | |
timeout-minutes: 15 | |
strategy: | |
matrix: | |
os: [ubuntu, macos, windows] | |
name: with Java 11 on ${{ matrix.os }} | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 11 | |
distribution: temurin | |
cache: 'gradle' | |
- name: Gradle build | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: --refresh-dependencies --stacktrace --scan clean build -x spotlessCheck | |
# SonarCloud analysis | |
sonar-cloud-analysis: | |
runs-on: ubuntu-latest | |
needs: validation | |
timeout-minutes: 15 | |
name: SonarCloud analysis | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
with: | |
# Sonar needs the whole Git history for issue assignment | |
fetch-depth: 0 | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: temurin | |
cache: 'gradle' | |
- name: Cache SonarCloud results | |
uses: actions/cache@v3 | |
with: | |
path: ~/.sonar/cache/ | |
key: ubuntu-sonar | |
- name: Gradle build | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: --refresh-dependencies --stacktrace --scan clean build -x spotlessCheck | |
- name: SonarCloud analysis | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: "61ab2579215aa8a0024a2f9368fc1298fdecfd18" | |
run: ./gradlew jacocoTestReport sonarqube --stacktrace -i | |
# Code format check | |
code-format-check: | |
runs-on: ubuntu-latest | |
needs: validation | |
timeout-minutes: 15 | |
name: Code format check | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 11 | |
distribution: temurin | |
cache: 'gradle' | |
- name: Spotless check | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: --scan spotlessCheck | |
# Our full integration job, which will build for a matrix out of our | |
# supported Java versions, operating systems and various JUnit versions. | |
# This build is executed on all tags and the default branch as well as | |
# for pull requests with the label `full-build`. | |
full-featured: | |
if: (contains(github.event.pull_request.labels.*.name, 'full-build') || !github.event.pull_request) | |
needs: basic | |
runs-on: ${{ matrix.os }}-latest | |
timeout-minutes: 15 | |
strategy: | |
matrix: | |
java: [ 11, 17, 21 ] | |
junit-version: [ '5.9.2', '5.10.0' ] | |
os: [ubuntu, macos, windows] | |
name: with Java ${{ matrix.java }}, JUnit ${{ matrix.junit-version }} on ${{ matrix.os }} | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: temurin | |
cache: 'gradle' | |
- name: Gradle build | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: --refresh-dependencies -PjunitVersion=${{ matrix.junit-version }} --stacktrace --scan clean build -x spotlessCheck | |
# We want to be up-to-date and know issues with future Java versions as soon as possible. | |
# Furthermore, we also would love to see our build working with the latest Gradle version. | |
# As those builds might fail, they are allowed to fail, and should not prevent merges. | |
experimental: | |
if: (contains(github.event.pull_request.labels.*.name, 'full-build') || !github.event.pull_request) | |
needs: full-featured | |
runs-on: ${{ matrix.os }}-latest | |
continue-on-error: true | |
timeout-minutes: 15 | |
strategy: | |
matrix: | |
junit-version: [ '5.9.2', '5.10.0' ] | |
os: [ubuntu, macos, windows] | |
name: Experimental build with newest JDK early-access build and Gradle release candidate | |
# Gradle doesn't work with JDK EA builds, so we launch it with a supported Java version, | |
# but set the Gradle toolchain to use the experimental version. | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
- name: Set up experimental Java | |
uses: oracle-actions/setup-java@v1 | |
with: | |
website: jdk.java.net | |
release: ${{ env.EXPERIMENTAL_JAVA }} | |
- name: Prepare JDK_EXPERIMENTAL env var | |
shell: bash | |
run: echo "JDK_EXPERIMENTAL=$JAVA_HOME" >> $GITHUB_ENV | |
- name: Set up supported Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: temurin | |
cache: 'gradle' | |
- name: Gradle toolchains | |
uses: gradle/gradle-build-action@v2 | |
with: | |
gradle-version: release-candidate | |
arguments: -Porg.gradle.java.installations.auto-download=false javaToolchains | |
- name: Gradle build | |
uses: gradle/gradle-build-action@v2 | |
with: | |
gradle-version: release-candidate | |
arguments: --refresh-dependencies -PexperimentalJavaVersion=${{ env.EXPERIMENTAL_JAVA }} -PjunitVersion=${{ matrix.junit-version }} -Porg.gradle.java.installations.auto-download=false --stacktrace --scan clean build -x spotlessCheck | |
# A release will be created if there is a `version` defined and `releasing` is set to `true`. | |
# If not, this stage will be ignored. | |
release: | |
if: github.event.inputs.version != '' && github.event.inputs.releasing == 'true' | |
runs-on: ubuntu-latest | |
needs: full-featured | |
timeout-minutes: 15 | |
name: Release Pioneer into the wild | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
with: | |
# Shipkit needs the whole Git history for changelog generation | |
fetch-depth: 0 | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
# we build the Javadoc with JDK 17 (for better results), | |
# so install that as well | |
java-version: | | |
21 | |
11 | |
distribution: temurin | |
- name: Perform release | |
uses: gradle/gradle-build-action@v2 | |
env: | |
# used to trigger website build | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# used by `io.github.gradle-nexus.publish-plugin` to sign artifacts | |
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.JUNIT_PIONEER_PGP_SECRET_KEY }} | |
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.JUNIT_PIONEER_PGP_PASSWORD }} | |
# used by `io.github.gradle-nexus.publish-plugin` to publish to Maven Central | |
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.NEXUS_TOKEN_USERNAME }} | |
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.NEXUS_TOKEN_PASSWORD }} | |
# defines released version according to GitHub Action input | |
ORG_GRADLE_PROJECT_version: ${{ github.event.inputs.version }} | |
with: | |
arguments: publishToSonatype closeAndReleaseSonatypeStagingRepository githubRelease | |
# After our release, we also need to trigger an update for our website build | |
update-website: | |
runs-on: ubuntu-latest | |
needs: release | |
timeout-minutes: 15 | |
name: Update website | |
steps: | |
- name: Trigger website build | |
uses: peter-evans/repository-dispatch@v2 | |
with: | |
token: ${{ secrets.GH_WRITE_TOKEN }} | |
repository: junit-pioneer/junit-pioneer.github.io | |
event-type: triggerSiteBuild |