Merge pull request #857 from EmbedITCZ/dependabot/maven/commons-io-co… #1830
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, pull_request] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
build: | |
name: Build on Java ${{ matrix.java }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java: [ 17, 21, 22 ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Set up Java ${{ matrix.java }} | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: 'zulu' | |
- name: Build with Java ${{ matrix.java }} | |
run: mvn clean install -Dspring-boot.build-image.skip=true -DskipTests=true -Dmaven.javadoc.skip=true -B -V | |
test: | |
needs: build | |
name: Test on Java ${{ matrix.java }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java: [ 17, 21, 22 ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Set up Java ${{ matrix.java }} | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: 'zulu' | |
- name: Test with Java ${{ matrix.java }} | |
run: | | |
mvn org.jacoco:jacoco-maven-plugin:prepare-agent test org.jacoco:jacoco-maven-plugin:report -Dspring-boot.build-image.skip=true -B -V | |
- name: Upload test coverage for unit tests | |
if: matrix.java == 17 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: jacoco | |
path: jbehave-support-core/target/site/jacoco/jacoco.xml | |
system-test: | |
name: System test on Java ${{ matrix.java }} | |
needs: [ build, test ] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java: [ 17, 21, 22 ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Set up Java ${{ matrix.java }} | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: 'zulu' | |
- name: System test with Java ${{ matrix.java }} | |
run: | | |
xvfb-run mvn org.jacoco:jacoco-maven-plugin:prepare-agent-integration verify org.jacoco:jacoco-maven-plugin:report-integration -DskipUnitTests=true -Djbehave.report.level=STORY -B -V | |
- name: Upload reports on Java ${{ matrix.java }} | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: reports-java-${{ matrix.java }} | |
path: jbehave-support-core/target/reports | |
- name: Upload test coverage for integration tests | |
if: matrix.java == 17 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: jacoco-it | |
path: jbehave-support-core/target/site/jacoco-it/jacoco.xml | |
sonar: | |
name: Sonar integration | |
if: github.ref == 'refs/heads/master' && github.repository == 'EmbedITCZ/jbehave-support' | |
needs: [ build, test, system-test ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download result for test execution | |
uses: actions/download-artifact@v4 | |
with: | |
name: jacoco | |
- name: Download test coverage result for integration and system test execution | |
uses: actions/download-artifact@v4 | |
with: | |
name: jacoco-it | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Set up Java 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'zulu' | |
- name: Run Maven | |
run: mvn package -DskipTests org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=EmbedITCZ_jbehave-support -Dsonar.organization=embeditcz -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${{ secrets.SONAR_TOKEN }} -Dsonar.coverage.jacoco.xmlReportPaths=/home/runner/work/jbehave-support/jbehave-support/jacoco/jacoco.xml,/home/runner/work/jbehave-support/jbehave-support/jacoco-it/jacoco.xml -e -X |