Skip to content

Commit 68a3cfb

Browse files
authored
ci: codecov coverage uploading fix (#4838)
* Closes #4649
1 parent 7e86d7f commit 68a3cfb

File tree

2 files changed

+128
-18
lines changed

2 files changed

+128
-18
lines changed

.github/codecov.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
codecov:
2+
token: ${{ secrets.CODECOV_TOKEN }}
3+
ci:
4+
- github-actions
5+
max_report_age: 12
6+
require_ci_to_pass: TRUE
7+
8+
coverage:
9+
round: down
10+
range: 60..80
11+
12+
comment:
13+
layout: "condensed_header, condensed_files, condensed_footer"
14+
hide_project_coverage: FALSE

.github/workflows/testing.yml

Lines changed: 114 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ jobs:
106106
storage.googleapis.com:443
107107
www.cisa.gov:443
108108
www.sqlite.org:443
109-
109+
*.codecov.io:443
110+
codecov.io:443
110111
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
111112
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
112113
with:
@@ -268,7 +269,13 @@ jobs:
268269
- name: Run async tests
269270
if: env.sbom != 'true'
270271
run: >
271-
pytest --cov --cov-append -n 8 --cov-report=xml -v --durations=50
272+
pytest
273+
--cov
274+
--cov-report=xml
275+
--cov-append -n 8
276+
--junitxml=junit.xml
277+
-o junit_family=legacy
278+
-v --durations=50
272279
--ignore=test/test_cli.py
273280
--ignore=test/test_cvedb.py
274281
--ignore=test/test_requirements.py
@@ -280,10 +287,20 @@ jobs:
280287
if: env.sbom != 'true'
281288
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2
282289
with:
283-
files: ./coverage.xml
284-
flags: longtests
290+
token: ${{ secrets.CODECOV_TOKEN }}
291+
files: coverage.xml
292+
flags: long_tests
285293
name: codecov-umbrella
286294
fail_ci_if_error: false
295+
- name: Upload test results to Codecov
296+
if: ${{ !cancelled() }}
297+
uses: codecov/test-results-action@v1
298+
with:
299+
token: ${{ secrets.CODECOV_TOKEN }}
300+
flags: long_tests
301+
files: junit.xml
302+
fail_ci_if_error: false
303+
287304

288305
long_tests_languages:
289306
name: Long tests on Python 3.13 (language parsers)
@@ -361,16 +378,32 @@ jobs:
361378
- name: Run language scanner tests
362379
if: env.sbom != 'true'
363380
run: >
364-
pytest --cov --cov-append -n 8 --cov-report=xml -v --durations=50
381+
pytest
382+
--cov
383+
--cov-report=xml
384+
--junitxml=junit.xml
385+
-o junit_family=legacy
386+
--cov-append -n 8
387+
-v --durations=50
365388
test/test_language_scanner.py
366389
- name: Upload code coverage to codecov
367390
if: env.sbom != 'true'
368391
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2
369392
with:
370-
files: ./coverage.xml
371-
flags: longtests
393+
token: ${{ secrets.CODECOV_TOKEN }}
394+
files: coverage.xml
395+
flags: long_tests_languages
372396
name: codecov-umbrella
373397
fail_ci_if_error: false
398+
- name: Upload test results to Codecov
399+
if: ${{ !cancelled() }}
400+
uses: codecov/test-results-action@v1
401+
with:
402+
token: ${{ secrets.CODECOV_TOKEN }}
403+
flags: long_tests_languages
404+
files: junit.xml
405+
fail_ci_if_error: false
406+
374407

375408
long_tests_scanners:
376409
name: Long tests on Python 3.13 (scanners)
@@ -448,16 +481,32 @@ jobs:
448481
- name: Run binary scanner tests
449482
if: env.sbom != 'true'
450483
run: >
451-
pytest --cov --cov-append -n 8 --cov-report=xml -v --durations=50
484+
pytest
485+
--cov
486+
--cov-report=xml
487+
--junitxml=junit.xml
488+
-o junit_family=legacy
489+
--cov-append -n 8
490+
-v --durations=50
452491
test/test_scanner.py
453492
- name: Upload code coverage to codecov
454493
if: env.sbom != 'true'
455494
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2
456495
with:
457-
files: ./coverage.xml
458-
flags: longtests
496+
token: ${{ secrets.CODECOV_TOKEN }}
497+
files: coverage.xml
498+
flags: long_tests_scanners
459499
name: codecov-umbrella
460500
fail_ci_if_error: false
501+
- name: Upload test results to Codecov
502+
if: ${{ !cancelled() }}
503+
uses: codecov/test-results-action@v1
504+
with:
505+
token: ${{ secrets.CODECOV_TOKEN }}
506+
files: junit.xml
507+
flags: long_tests_scanners
508+
fail_ci_if_error: false
509+
461510

462511
long_tests_sync:
463512
name: Long tests on Python 3.13 (synchronous)
@@ -535,17 +584,33 @@ jobs:
535584
- name: Run synchronous tests
536585
if: env.sbom != 'true'
537586
run: >
538-
pytest -v --cov --cov-append --cov-report=xml --durations=50
587+
pytest
588+
-v --cov
589+
--cov-report=xml
590+
--junitxml=junit.xml
591+
-o junit_family=legacy
592+
--cov-append
593+
--durations=50
539594
test/test_cli.py
540595
test/test_cvedb.py
541596
- name: Upload code coverage to codecov
542597
if: env.sbom != 'true'
543598
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2
544599
with:
545-
files: ./coverage.xml
546-
flags: longtests
600+
token: ${{ secrets.CODECOV_TOKEN }}
601+
files: coverage.xml
602+
flags: long_tests_sync
547603
name: codecov-umbrella
548604
fail_ci_if_error: false
605+
- name: Upload test results to Codecov
606+
if: ${{ !cancelled() }}
607+
uses: codecov/test-results-action@v1
608+
with:
609+
token: ${{ secrets.CODECOV_TOKEN }}
610+
flags: long_tests_sync
611+
files: junit.xml
612+
fail_ci_if_error: false
613+
549614

550615

551616
linux-mayfail:
@@ -748,15 +813,28 @@ jobs:
748813
python -m cve_bin_tool.cli test/assets/test-kerberos-5-1.15.1.out
749814
- name: Run async tests
750815
run: >
751-
pytest --cov --cov-append -n 8 -v --durations=50
816+
pytest
817+
--cov
818+
--cov-report=xml
819+
--junitxml=junit.xml
820+
-o junit_family=legacy
821+
--cov-append -n 8
822+
-v --durations=50
752823
--ignore=test/test_cli.py
753824
--ignore=test/test_cvedb.py
754825
--ignore=test/test_requirements.py
755826
--ignore=test/test_html.py
756827
--ignore=test/test_json.py
757828
- name: Run synchronous tests
758829
run: >
759-
pytest -v --cov --cov-append --cov-report=xml --durations=50
830+
pytest
831+
-v --cov
832+
--cov-report=xml
833+
--junitxml=junit.xml
834+
-o junit_family=legacy
835+
--cov-append
836+
--cov-report=xml
837+
--durations=50
760838
test/test_cli.py
761839
test/test_cvedb.py
762840
- name: Cache conda
@@ -783,12 +861,30 @@ jobs:
783861
python -m pip install --upgrade -r dev-requirements.txt
784862
python -m pip install --upgrade .
785863
- name: Test PDF generation on Windows
786-
run: pytest test/test_output_engine.py -k test_output_pdf --cov --cov-append --cov-report=xml --durations=50
864+
run: >
865+
pytest
866+
test/test_output_engine.py
867+
-k test_output_pdf
868+
--cov
869+
--cov-append
870+
--cov-report=xml
871+
--junitxml=junit.xml
872+
-o junit_family=legacy
873+
--durations=50
787874
- name: Upload code coverage to codecov
788875
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2
789876
with:
790-
files: ./coverage.xml
791-
flags: win-longtests
877+
files: coverage.xml
878+
flags: windows_long_tests
792879
name: codecov-umbrella
793880
fail_ci_if_error: false
881+
token: ${{ secrets.CODECOV_TOKEN }}
882+
- name: Upload test results to Codecov
883+
if: ${{ !cancelled() }}
884+
uses: codecov/test-results-action@v1
885+
with:
886+
token: ${{ secrets.CODECOV_TOKEN }}
887+
flags: windows_long_tests
888+
files: junit.xml
889+
fail_ci_if_error: false
794890

0 commit comments

Comments
 (0)