Add option to fork default branch only #4384
Workflow file for this run
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: CI | |
on: | |
push: | |
branches: | |
- main | |
- main-2.x | |
- '!/refs/heads/dependabot/*' | |
pull_request: | |
branches: | |
- '*' | |
- '!/refs/heads/patch*' | |
# this is required by spotless for JDK 16+ | |
env: | |
JAVA_11_PLUS_MAVEN_OPTS: "--add-opens jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED" | |
permissions: | |
contents: read | |
jobs: | |
build: | |
name: build-only (Java 17) | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: Maven Install (skipTests) | |
env: | |
MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }} | |
run: mvn -B clean install -DskipTests --file pom.xml | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: maven-target-directory | |
path: target/ | |
retention-days: 3 | |
site: | |
name: site (Java 17) | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: Maven Site | |
env: | |
MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }} | |
# running install site seems to more closely imitate real site deployment, | |
# more likely to prevent failed deployment | |
run: mvn -B clean install site -DskipTests --file pom.xml | |
test: | |
name: test (${{ matrix.os }}, Java ${{ matrix.java }}) | |
# Does not require build output, but orders execution to prevent launching test workflows when simple build fails | |
needs: build | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu, windows ] | |
java: [ 17, 21 ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: 'temurin' | |
cache: 'maven' | |
# JDK 11+ | |
- name: Maven Install without Code Coverage | |
if: matrix.os == 'windows' | |
env: | |
MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }} | |
run: mvn -B clean install -D japicmp.skip=true --file pom.xml "-Dsurefire.argLine=--add-opens java.base/java.net=ALL-UNNAMED" | |
- name: Maven Install with Code Coverage | |
if: matrix.os != 'windows' | |
env: | |
MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }} | |
run: mvn -B clean install -D enable-ci --file pom.xml "-Dsurefire.argLine=--add-opens java.base/java.net=ALL-UNNAMED" | |
- name: Save coverage data | |
if: matrix.os == 'ubuntu' && matrix.java == '17' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: maven-test-target-directory | |
path: target/ | |
retention-days: 3 | |
codecov-upload: | |
name: codecov-upload (Upload to codecov.io) | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: maven-test-target-directory | |
path: target | |
- name: Codecov Report | |
uses: codecov/[email protected] | |
with: | |
# Codecov token from https://app.codecov.io/gh/hub4j/github-api/settings | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
verbose: true | |
test-java-11: | |
name: test Java 11 (no-build) | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: maven-target-directory | |
path: target | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 11 | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: Maven Test (no build) Java 11 | |
run: mvn -B surefire:test -DfailIfNoTests -Dsurefire.excludesFile=src/test/resources/slow-or-flaky-tests.txt |