Emit JUnit XML from tests + mutation, consume it in CI
Produce machine-readable results and surface them in the Gitea pipeline:
- ctest: run with --output-junit to write ctest-junit.xml. The path must be
absolute ("$(pwd)/...") because --output-junit otherwise resolves relative to
the --test-dir build directory.
- mutation_test.py: new --junit FILE option writes a JUnit report where each
mutant is a test case and a surviving mutant is a <failure> (so gaps show up
as failing tests).
- .gitea/workflows/ci.yaml: both jobs generate their XML and feed it to
mikepenz/action-junit-report with `if: always()`, so results publish even
when a gate fails. Mutation publishing is display-only (fail_on_failure:
false); the --threshold flag remains the gate.
- .gitignore: ignore the generated *-junit.xml artifacts.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -13,13 +13,23 @@ jobs:
|
||||
run: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y cmake gcc moreutils
|
||||
- name: build and test
|
||||
- name: build and install
|
||||
run: |
|
||||
mkdir installdir
|
||||
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=installdir
|
||||
cmake --build build
|
||||
cmake --install build
|
||||
cmake --build build --target test
|
||||
# --output-junit resolves relative to the test dir, so give an absolute
|
||||
# path to land the report in the workspace root for the reporter below.
|
||||
- name: test (JUnit)
|
||||
run: ctest --test-dir build --output-on-failure --output-junit "$(pwd)/ctest-junit.xml"
|
||||
- name: publish test results
|
||||
if: always()
|
||||
uses: mikepenz/action-junit-report@v4
|
||||
with:
|
||||
report_paths: 'ctest-junit.xml'
|
||||
check_name: 'ctest results'
|
||||
fail_on_failure: 'true'
|
||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
||||
|
||||
mutation_test:
|
||||
@@ -38,5 +48,14 @@ jobs:
|
||||
# deeper (slower) coverage including the macro header.
|
||||
- name: mutation testing
|
||||
run: |
|
||||
python3 scripts/mutation_test.py --target src/error.c --threshold 65
|
||||
python3 scripts/mutation_test.py --target src/error.c --junit mutation-junit.xml --threshold 65
|
||||
# Publish even when the threshold gate fails, so survivors are visible.
|
||||
# Display-only (fail_on_failure: false); the --threshold above is the gate.
|
||||
- name: publish mutation results
|
||||
if: always()
|
||||
uses: mikepenz/action-junit-report@v4
|
||||
with:
|
||||
report_paths: 'mutation-junit.xml'
|
||||
check_name: 'mutation results'
|
||||
fail_on_failure: 'false'
|
||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
||||
|
||||
Reference in New Issue
Block a user