Skip to content

Rewrites instantiation #631

Rewrites instantiation

Rewrites instantiation #631

Workflow file for this run

# Part one of two stage process to update PRs with pitest data when accepting PRs from untrusted forks.
#
# The jobs will run the mutation analysis, but the token supplied by gtihub does not have write access.
# The results are therefore stored as an artifact which will be used to update the PR in the second stage.
#
# Projects where PRs come from the same repo can use a simpler single stage process.
#
name: PITest
# read-only repo token
# no access to secrets
on:
pull_request:
jobs:
pitest-store-feedback:
name: Gather PITest feedback
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v4
with:
# important to set a fetch depth of 2. By default the checkout action make no history available
fetch-depth: 2
- name: Cache Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-mvn-pitest-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-mvn-pitest
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: run pitest
# pitest has been bound to a profile called pitest for normal running
# we add config to analyse only changes made within a PR and treat surviving mutants as check errors
# failWhenNoMutations is unset in the pom, as otherwise PRs that do not affect java code would fail
run: mvn -e -B -Dpitest -Dfeatures="+GIT(from[HEAD~1]), +gitci" test
- name: aggregate files
run: mvn -e -B -DtrailingText="Mutation testing report generated by PITest - https://pitest.org - if there are surviving mutants, please check the line comments under 'Files changed', or the full report under the 'CI / pitest' check below this comment." pitest-git:aggregate
- name: upload results
uses: actions/upload-artifact@v4
with:
name: pitest
path: target/pit-reports-ci/