Skip to content

Commit

Permalink
Enable junit.xml reporting (#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea authored Aug 15, 2024
1 parent eb8659c commit 96579d5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ jobs:
ansible_collections/ansible/eda/.tox/**/log/
ansible_collections/ansible/eda/.tox/**/coverage.xml
ansible_collections/ansible/eda/tests/output/reports/coverage.xml
ansible_collections/ansible/eda/tests/output/junit/*.xml
- name: Report failure if git reports dirty status
run: |
Expand All @@ -148,6 +149,7 @@ jobs:
# https://github.com/actions/toolkit/issues/193
check:
if: always()
environment: check
permissions:
id-token: write
checks: read
Expand Down Expand Up @@ -185,6 +187,16 @@ jobs:
- name: Check for expected number of coverage reports
run: .github/check-coverage.sh

# Single uploads inside check job for codecov to allow use to retry
# it when it fails without running tests again. Fails often enough!
- name: Upload junit xml reports
uses: codecov/test-results-action@v1
with:
name: ${{ matrix.name }}
files: "*/tests/output/junit/*.xml"
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Upload coverage data
uses: codecov/codecov-action@v4
with:
Expand Down
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Recommended usage of this file is detailed in https://github.com/ansible/eda-partner-testing/blob/main/README.md.
# The linter paths can be changed, but may result in false passes.
# {posargs} in this case would be the path to collection root relative from the .github/workflows dir (`../..`)
# cspell: ignore TOXPYTHON setenv passenv REQPASS PYTHONPYCACHEPREFIX PYTHONIOENCODING PYTHONBREAKPOINT notest envdir envname toxworkdir
# cspell: ignore TOXPYTHON setenv passenv REQPASS PYTHONPYCACHEPREFIX PYTHONIOENCODING PYTHONBREAKPOINT notest envdir envname toxworkdir junitxml

[tox]
envlist = lint, darglint, unit, sanity, integration, coverage
Expand Down Expand Up @@ -76,7 +76,7 @@ commands =
# risky: not safe for development it affects user setup
ansible-galaxy collection install .
# use same coverage location as ansible-test:
coverage run --data-file=tests/output/coverage/integration.coverage -m pytest tests/integration -vvv -s {posargs}
coverage run --data-file=tests/output/coverage/integration.coverage -m pytest tests/integration -vvv -s --junitxml=tests/output/junit/integration.xml {posargs}

[testenv:unit,py{39,310,311,312,313}-unit]
description =
Expand All @@ -96,7 +96,7 @@ description =
py{39,310,311,312,313}: with {basepython}
commands =
ansible --version
ansible-test sanity -v --requirements --coverage --truncate 0 {posargs}
ansible-test sanity -v --requirements --coverage --truncate 0 --junit {posargs}

[testenv:coverage]
description = Produce final coverage report for GHA
Expand Down

0 comments on commit 96579d5

Please sign in to comment.