Skip to content

Commit 9479286

Browse files
committed
Single coverage upload
1 parent 344053c commit 9479286

File tree

3 files changed

+65
-18
lines changed

3 files changed

+65
-18
lines changed

.config/dictionary.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ fqcn
1616
levelname
1717
levelno
1818
netcommon
19+
oidc
1920
purelib
2021
reqs
2122
setenv

.github/workflows/tox.yml

Lines changed: 59 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ jobs:
4040
build:
4141
name: ${{ matrix.name }}
4242
runs-on: ${{ matrix.os || 'ubuntu-22.04' }}
43-
permissions:
44-
id-token: write
4543
needs:
4644
- prepare
4745
defaults:
@@ -88,20 +86,14 @@ jobs:
8886
- name: tox -e ${{ matrix.passed_name }}
8987
run: python3 -m tox -e ${{ matrix.passed_name }}
9088

91-
- name: Upload coverage data
92-
if: ${{ startsWith(matrix.passed_name, 'py') }}
93-
uses: codecov/codecov-action@v4
94-
with:
95-
name: ${{ matrix.passed_name }}
96-
fail_ci_if_error: true
97-
verbose: true # optional (default = false)
98-
use_oidc: true # cspell:ignore oidc
99-
100-
- name: Archive logs
89+
- name: Archive logs and coverage data
10190
uses: actions/upload-artifact@v4
10291
with:
10392
name: logs-${{ matrix.name }}.zip
104-
path: .tox/**/log/
93+
path: |
94+
.tox/**/log/
95+
.tox/**/.coverage*
96+
.tox/**/coverage.xml
10597
10698
- name: Report failure if git reports dirty status
10799
run: |
@@ -112,26 +104,75 @@ jobs:
112104
exit 99
113105
fi
114106
# https://github.com/actions/toolkit/issues/193
115-
check: # This job does nothing and is only used for the branch protection
107+
108+
check:
116109
if: always()
117110
permissions:
118111
pull-requests: write # allow codenotify to comment on pull-request
112+
id-token: write
113+
checks: read
119114

120115
needs:
121116
- build
122-
123117
runs-on: ubuntu-latest
124118

125119
steps:
120+
# checkout needed for codecov action which needs codecov.yml file
121+
- uses: actions/checkout@v4
122+
123+
- name: Set up Python # likely needed for coverage
124+
uses: actions/setup-python@v5
125+
with:
126+
python-version: "3.12"
127+
128+
- run: pip3 install 'coverage>=7.5.1'
129+
130+
- name: Merge logs into a single archive
131+
uses: actions/upload-artifact/merge@v4
132+
with:
133+
name: logs.zip
134+
pattern: logs-*.zip
135+
# artifacts like py312.zip and py312-macos do have overlapping files
136+
separate-directories: true
137+
138+
- name: Download artifacts
139+
uses: actions/download-artifact@v4
140+
with:
141+
name: logs.zip
142+
path: .
143+
144+
- name: Check for expected number of coverage.xml reports
145+
run: |
146+
JOBS_PRODUCING_COVERAGE=5
147+
if [ "$(find . -name coverage.xml | wc -l | bc)" -ne "${JOBS_PRODUCING_COVERAGE}" ]; then
148+
echo "::error::Number of coverage.xml files was not the expected one (${JOBS_PRODUCING_COVERAGE}): $(find . -name coverage.xml |xargs echo)"
149+
exit 1
150+
fi
151+
152+
- name: Upload coverage data
153+
uses: codecov/codecov-action@v4
154+
with:
155+
name: ${{ matrix.passed_name }}
156+
# token: ${{ secrets.CODECOV_TOKEN }}
157+
# verbose: true # optional (default = false)
158+
fail_ci_if_error: true
159+
use_oidc: true # cspell:ignore oidc
160+
161+
- name: Check codecov.io status
162+
if: github.event_name == 'pull_request'
163+
uses: coactions/codecov-status@main
164+
126165
- name: Decide whether the needed jobs succeeded or failed
127166
uses: re-actors/alls-green@release/v1
128167
with:
129168
jobs: ${{ toJSON(needs) }}
130169

131-
- name: Check out src from Git
132-
uses: actions/checkout@v4
170+
- name: Delete Merged Artifacts
171+
uses: actions/upload-artifact/merge@v4
172+
with:
173+
delete-merged: true
133174

134-
- name: Notify repository owners about lint change affecting them
175+
- name: Notify repository owners about changes affecting them
135176
uses: sourcegraph/codenotify@v0.6.4
136177
env:
137178
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

tests/test_root.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import ansible_dev_environment as ade
2+
3+
4+
def test_root():
5+
assert ade

0 commit comments

Comments
 (0)