-
Notifications
You must be signed in to change notification settings - Fork 76
49 lines (45 loc) · 1.98 KB
/
pitest.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# 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/