-
Notifications
You must be signed in to change notification settings - Fork 145
81 lines (66 loc) · 2.6 KB
/
coverage.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# This name is shown in the status badge in the README
name: Test coverage
on:
push:
branches: [main]
jobs:
test:
name: Measure mutation test coverage
runs-on: ubuntu-latest
permissions:
contents: write # For push to GitHub Pages
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
- name: Run mutation test
run: ./gradlew pitestMerge
- name: Archive test reports
uses: actions/upload-artifact@v3
with:
name: pitest-reports-${{ github.sha }}
path: "*/build/reports/pitest/**"
- name: Create output directory
run: mkdir -p build/gh-pages
- name: Collect HTML reports
run: |
mkdir -p build/gh-pages/mutation-coverage-reports
for sp in webauthn-server-attestation webauthn-server-core yubico-util; do
cp -a "${sp}"/build/reports/pitest build/gh-pages/mutation-coverage-reports/"${sp}"
done
sed "s/{shortcommit}/${GITHUB_SHA:0:8}/g;s/{commit}/${GITHUB_SHA}/g;s#{repo}#${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}#g" .github/workflows/coverage/index.html.template > build/gh-pages/index.html
- name: Create coverage badge
# This creates a file that defines a [Shields.io endpoint badge](https://shields.io/endpoint)
# which we can then include in the project README.
uses: ./.github/actions/pit-results-badge
with:
output-file: build/gh-pages/coverage-badge.json
- name: Check out GitHub Pages branch
uses: actions/checkout@v3
with:
ref: gh-pages
clean: false
- name: Prepare metadata for pit-results-comment action
run: |
git checkout "${GITHUB_SHA}" -- .github/workflows/coverage .github/actions
echo PREV_COMMIT=$(cat prev-commit.txt) >> "${GITHUB_ENV}"
- name: Post mutation test results as commit comment
uses: ./.github/actions/pit-results-comment
with:
prev-commit: ${{ env.PREV_COMMIT }}
prev-mutations-file: prev-mutations.xml
- name: Push to GitHub Pages
run: |
git config user.name github-actions
git config user.email [email protected]
git rm -rf -- .
mv build/gh-pages/* .
cp build/reports/pitest/mutations.xml prev-mutations.xml
echo "${GITHUB_SHA}" > prev-commit.txt
git add coverage-badge.json index.html mutation-coverage-reports prev-mutations.xml prev-commit.txt
git commit --amend --reset-author -m "Generate GitHub Pages content"
git push -f