Skip to content

Commit 430de06

Browse files
authored
ci(general): Add coverage upload (#57)
* add coverage upload * add coverage report saving * add coverage report saving take 2 * add coverage report saving take 3 * debug * add coverage report saving take 4 * debug * add coverage report saving take 5 * add coverage report saving take 6 * add coverage report saving take 7 * debug * add coverage report saving take 8 * add coverage report saving take 9 * cleanup * add new dict words
1 parent 1202a62 commit 430de06

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed

.config/dictionaries/project.dic

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ bootstrapper
2424
BROTLI
2525
cantopen
2626
cardano
27+
carryforward
2728
CBOR
2829
cbork
2930
cdylib
@@ -39,6 +40,7 @@ ciphertexts
3940
codegen
4041
codepoints
4142
coti
43+
coverallsapp
4244
cpus
4345
crontabs
4446
crontagged

.github/workflows/generate-allure-report.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ jobs:
5959
if-no-files-found: error
6060
retention-days: 1
6161

62+
- name: Collect and upload test coverage
63+
uses: actions/upload-artifact@v4
64+
if: always()
65+
with:
66+
name: coverage-reports
67+
path: "**/*${{ env.COVERAGE_EXT }}"
68+
if-no-files-found: error
69+
retention-days: 1
70+
6271
generate-allure-report:
6372
name: Generate allure report
6473
runs-on: ubuntu-latest
@@ -106,3 +115,49 @@ jobs:
106115
${{ steps.allure.outputs.test_result_icon }} [Test Report](${{ steps.allure.outputs.report_url }}) | ${\color{lightgreen}Pass: ${{ steps.allure.outputs.test_result_passed }}/${{ steps.allure.outputs.test_result_total }}}$ | ${\color{red}Fail: ${{ steps.allure.outputs.test_result_failed }}/${{ steps.allure.outputs.test_result_total }}}$ |
107116
comment_tag: allure_report
108117
mode: upsert
118+
119+
generate-coverage-report:
120+
name: Generate coverage report
121+
runs-on: ubuntu-latest
122+
needs: [generate-test-reports]
123+
steps:
124+
- uses: actions/checkout@v4
125+
126+
- uses: actions/download-artifact@v4
127+
with:
128+
name: coverage-reports
129+
130+
- name: Collect coverage report
131+
run: |
132+
mkdir -p ${{ env.COVERAGE_REPORT_PATH }}
133+
shopt -s globstar
134+
cp **/*${{ env.COVERAGE_EXT }} ${{ env.COVERAGE_REPORT_PATH }}
135+
ls ${{ env.COVERAGE_REPORT_PATH }}
136+
137+
- name: Normalize coverage report paths
138+
run: |
139+
sed -i -e 's/SF:\/root\/build/SF:rust/g' ${{ env.COVERAGE_REPORT_PATH }}/cat-libs.coverage.info
140+
141+
- name: Coveralls
142+
env:
143+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
144+
uses: coverallsapp/github-action@v2
145+
with:
146+
path-to-lcov: "${{ env.COVERAGE_REPORT_PATH }}/cat-libs.coverage.info"
147+
allow-empty: true
148+
debug: true
149+
flag-name: rust-unit-test
150+
base-path: "/home/runner/work/catalyst-libs/catalyst-libs/"
151+
parallel: true
152+
153+
upload-coverage-report:
154+
name: Upload coverage report
155+
needs: [generate-coverage-report]
156+
if: ${{ always() }}
157+
runs-on: ubuntu-latest
158+
steps:
159+
- name: Coveralls Finished
160+
uses: coverallsapp/github-action@v2
161+
with:
162+
parallel-finished: true
163+
carryforward: "rust-unit-test"

rust/Earthfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ build:
5555
--args2="--libs=cbork-cddl-parser --libs=cbork-abnf-parser" \
5656
--args3="--libs=catalyst-voting" \
5757
--args4="--bins=cbork/cbork" \
58+
--args5="--cov_report=$HOME/build/coverage-report.info" \
5859
--output="release/[^\./]+" \
5960
--junit="cat-libs.junit-report.xml" \
61+
--coverage="cat-libs.coverage.info" \
6062
--docs="true"
6163

6264
SAVE ARTIFACT target/$TARGETARCH/doc doc

0 commit comments

Comments
 (0)