Skip to content

[2] CI/CD

[2] CI/CD #13

Workflow file for this run

name: Java CI with Maven
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
jobs:
build:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "temurin"
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Add coverage to PR
id: jacoco
uses: madrapps/jacoco-report@v1.6.1
with:
paths: |
${{ github.workspace }}/**/target/site/jacoco/jacoco.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 100
- name: Run PITest
run: |
mvn test-compile org.pitest:pitest-maven:mutationCoverage -DoutputFormats=CSV,HTML
{ echo '| File | Package | Mutation | Function | Line | Status | Test |'; \
echo -n '| ---- | ------- | -------- | -------- | ---- | ------ | ---- |'; \
cat target/pit-reports/mutations.csv | grep "SURVIVED" | awk -F, '{print "| " $1 " | " $2 " | " $3 " | " $4 " | " $5 " | " $6 " | " $7 " |"}';
} > target/pit-reports/mutations.md
- name: Archive PITest report
uses: actions/upload-artifact@v4
with:
name: pitest-report
path: target/pit-reports
- name: Add PITest report to PR
uses: mshick/add-pr-comment@v2
with:
message-path: |
target/pit-reports/mutations.md