diff --git a/.github/workflows/pitest-analyze-pr.yml b/.github/workflows/pitest-analyze-pr.yml new file mode 100644 index 00000000..8d1bf613 --- /dev/null +++ b/.github/workflows/pitest-analyze-pr.yml @@ -0,0 +1,37 @@ +# Performs mutation testing analysis on the files changed by a pull request and +# uploads the results. The associated PR is subsequently updated by the +# `pitest-update-pr.yml` workflow. See https://blog.pitest.org/oss-pitest-pr/ +# for details. +name: "Mutation testing" +on: + pull_request: +permissions: + contents: read +jobs: + analyze-pr: + runs-on: ubuntu-22.04 + steps: + - name: Check out code + uses: actions/checkout@v3.1.0 + with: + fetch-depth: 2 + - name: Set up JDK + uses: actions/setup-java@v3.6.0 + with: + java-version: 17.0.4 + distribution: temurin + cache: maven + - name: Run Pitest + # By running with features `+GIT(from[HEAD~1]), +gitci`, Pitest only + # analyzes lines changed in the associated pull request, as GitHub + # exposes the changes unique to the PR as a single commit on top of the + # target branch. See https://blog.pitest.org/pitest-pr-setup for + # details. + run: mvn test pitest:mutationCoverage -DargLine.xmx=2048m -Dverification.skip -Dfeatures="+GIT(from[HEAD~1]), +gitci" + - name: Aggregate Pitest reports + run: mvn pitest-git:aggregate -DkilledEmoji=":tada:" -DmutantEmoji=":zombie:" -DtrailingText="Mutation testing report by [Pitest](https://pitest.org/). Review any surviving mutants by inspecting the line comments under [_Files changed_](${{ github.event.number }}/files)." + - name: Upload Pitest reports as artifact + uses: actions/upload-artifact@v3.1.1 + with: + name: pitest-reports + path: ./target/pit-reports-ci diff --git a/.github/workflows/pitest-update-pr.yml b/.github/workflows/pitest-update-pr.yml new file mode 100644 index 00000000..2acaf653 --- /dev/null +++ b/.github/workflows/pitest-update-pr.yml @@ -0,0 +1,35 @@ +# Updates a pull request based on the corresponding mutation testing analysis +# performed by the `pitest-analyze-pr.yml` workflow. See +# https://blog.pitest.org/oss-pitest-pr/ for details. +name: "Mutation testing: post results" +on: + workflow_run: + workflows: ["Mutation testing"] + types: + - completed +permissions: + actions: read + checks: write + contents: read + pull-requests: write +jobs: + update-pr: + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-22.04 + steps: + - name: Check out code + uses: actions/checkout@v3.1.0 + - name: Set up JDK + uses: actions/setup-java@v3.6.0 + with: + java-version: 17.0.4 + distribution: temurin + cache: maven + - name: Download Pitest analysis artifact + uses: dawidd6/action-download-artifact@v2.24.2 + with: + workflow: ${{ github.event.workflow_run.workflow_id }} + name: pitest-reports + path: ./target/pit-reports-ci + - name: Update PR + run: mvn -DrepoToken="${{ secrets.GITHUB_TOKEN }}" pitest-github:updatePR diff --git a/README.md b/README.md index 090ba532..80089959 100644 --- a/README.md +++ b/README.md @@ -166,7 +166,7 @@ Some other commands one may find relevant: - `mvn fmt:format` formats the code using [`google-java-format`][google-java-format]. -- `./run-mutation-tests.sh` runs mutation tests using [PIT][pitest]. The +- `./run-mutation-tests.sh` runs mutation tests using [Pitest][pitest]. The results can be reviewed by opening the respective `target/pit-reports/index.html` files. For more information check the [PIT Maven plugin][pitest-maven]. diff --git a/cdg-pitest-licence.txt b/cdg-pitest-licence.txt new file mode 100644 index 00000000..1c803d4f --- /dev/null +++ b/cdg-pitest-licence.txt @@ -0,0 +1,7 @@ +# Arcmutate license for Error Prone Support, requested by sending an email to +# support@arcmutate.com. +expires=07/11/2023 +keyVersion=1 +signature=MhZxMbnO6UovNfllM0JuVWkZyvRT3/G5o/uT0Mm36c7200VpZNVu03gTAGivnl9W5RzvZhfpIHccuQ5ctjQkrqhsFSrl4fyqPqu3y5V2fsHIdFXP/G72EGj6Kay9ndLpaEHalqE0bEwxdnHMzEYq5y3O9vUPv8MhUl57xk+rvBo\= +packages=tech.picnic.errorprone.* +type=OSSS diff --git a/pom.xml b/pom.xml index 0edb68f1..fae22c20 100644 --- a/pom.xml +++ b/pom.xml @@ -157,6 +157,7 @@ 4.9.0 1.0.1 0.10.5 + 1.0.1 2.22.2 @@ -428,6 +429,16 @@ + + com.groupcdg + pitest-git-maven-plugin + ${version.pitest-git} + + + com.groupcdg + pitest-github-maven-plugin + ${version.pitest-git} + com.spotify.fmt fmt-maven-plugin @@ -1231,8 +1242,12 @@ 1.9.11 + *.AutoValue_* + + *.refaster*.*Rules* + false @@ -1241,6 +1256,11 @@ false + + com.groupcdg + pitest-git-plugin + ${version.pitest-git} + org.pitest pitest-junit5-plugin