Merge pull request #392 from Yubico/parse-crldp-extension #287
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 name is shown in the status badge in the README | |
name: Test coverage | |
on: | |
push: | |
branches: | |
- main | |
- dependabot/gradle/info.solidsoft.gradle.pitest-gradle-pitest-plugin-* | |
- 'release-*' | |
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@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: temurin | |
- name: Run mutation test | |
run: ./gradlew pitestMerge | |
- name: Archive test reports | |
uses: actions/upload-artifact@v4 | |
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: Check out GitHub Pages branch | |
uses: actions/checkout@v4 | |
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: Create coverage badge | |
if: ${{ github.ref == 'refs/heads/main' }} | |
# 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: Push to GitHub Pages | |
if: ${{ github.ref == 'refs/heads/main' }} | |
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 |