-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Report mutation test coverage of proposed changes (#346)
Thanks to a free Arcmutate OSS license, GitHub Actions now runs Pitest against files changed in the context of a PR. While there, update Pitest's configuration to ignore Refaster rule collection classes, as mutations of those classes will not impact the associated unit tests. See: - https://www.arcmutate.com - https://pitest.org
- Loading branch information
1 parent
f46859a
commit 3303283
Showing
5 changed files
with
100 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/[email protected] | ||
with: | ||
fetch-depth: 2 | ||
- name: Set up JDK | ||
uses: actions/[email protected] | ||
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/[email protected] | ||
with: | ||
name: pitest-reports | ||
path: ./target/pit-reports-ci |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/[email protected] | ||
- name: Set up JDK | ||
uses: actions/[email protected] | ||
with: | ||
java-version: 17.0.4 | ||
distribution: temurin | ||
cache: maven | ||
- name: Download Pitest analysis artifact | ||
uses: dawidd6/[email protected] | ||
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 |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Arcmutate license for Error Prone Support, requested by sending an email to | ||
# [email protected]. | ||
expires=07/11/2023 | ||
keyVersion=1 | ||
signature=MhZxMbnO6UovNfllM0JuVWkZyvRT3/G5o/uT0Mm36c7200VpZNVu03gTAGivnl9W5RzvZhfpIHccuQ5ctjQkrqhsFSrl4fyqPqu3y5V2fsHIdFXP/G72EGj6Kay9ndLpaEHalqE0bEwxdnHMzEYq5y3O9vUPv8MhUl57xk+rvBo\= | ||
packages=tech.picnic.errorprone.* | ||
type=OSSS |
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