Skip to content

Prepare release (#72) #158

Prepare release (#72)

Prepare release (#72) #158

Workflow file for this run

name: Build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
matrix-build:
runs-on: ubuntu-latest
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-java-${{ matrix.java }}
cancel-in-progress: true
strategy:
fail-fast: true
matrix:
java: [17, 21]
name: "Build with Java ${{ matrix.java }}"
env:
DEFAULT_JAVA: 17
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: |
17
21
cache: 'maven'
- name: Cache SonarQube packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-java-${{ matrix.java }}-sonar
restore-keys: ${{ runner.os }}-java-${{ matrix.java }}-sonar
- name: Build with Maven
run: mvn --errors --batch-mode clean org.jacoco:jacoco-maven-plugin:prepare-agent install -Djava.version=${{ matrix.java }}
- name: Build example projects
run: |
cd src/test/resources/empty-project/
mvn --batch-mode verify
cd ../simple-project/
mvn --batch-mode verify
cd ../html-report/
mvn --batch-mode verify
cd ../project-with-tracing-defects
mvn --batch-mode verify
cd ../project-with-tracing-defects-fail-build/
mvn --batch-mode verify || true
- name: Sonar analysis
if: ${{ env.DEFAULT_JAVA == matrix.java && env.SONAR_TOKEN != null }}
run: |
mvn --errors --batch-mode \
-Dsonar.token=$SONAR_TOKEN \
org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Verify reproducible build
run: |
mvn --batch-mode clean verify artifact:compare -DskipTests \
-Djava.version=${{ matrix.java }}
- name: Archive aggregated reproducible build report
uses: actions/upload-artifact@v4
with:
name: reproducible-build-report-java-${{ matrix.java }}
path: |
target/*.buildcompare
target/*.buildinfo
if-no-files-found: error
build:
needs: matrix-build
runs-on: ubuntu-latest
steps:
- run: echo "Build successful"