diff --git a/.config/dictionaries/project.dic b/.config/dictionaries/project.dic index 71af2719143..9580278cffa 100644 --- a/.config/dictionaries/project.dic +++ b/.config/dictionaries/project.dic @@ -24,6 +24,7 @@ bootstrapper BROTLI cantopen cardano +carryforward CBOR cbork cdylib @@ -39,6 +40,7 @@ ciphertexts codegen codepoints coti +coverallsapp cpus crontabs crontagged diff --git a/.github/workflows/generate-allure-report.yml b/.github/workflows/generate-allure-report.yml index 3f221453e77..529b2df8a69 100644 --- a/.github/workflows/generate-allure-report.yml +++ b/.github/workflows/generate-allure-report.yml @@ -59,6 +59,15 @@ jobs: if-no-files-found: error retention-days: 1 + - name: Collect and upload test coverage + uses: actions/upload-artifact@v4 + if: always() + with: + name: coverage-reports + path: "**/*${{ env.COVERAGE_EXT }}" + if-no-files-found: error + retention-days: 1 + generate-allure-report: name: Generate allure report runs-on: ubuntu-latest @@ -106,3 +115,49 @@ jobs: ${{ 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 }}}$ | comment_tag: allure_report mode: upsert + + generate-coverage-report: + name: Generate coverage report + runs-on: ubuntu-latest + needs: [generate-test-reports] + steps: + - uses: actions/checkout@v4 + + - uses: actions/download-artifact@v4 + with: + name: coverage-reports + + - name: Collect coverage report + run: | + mkdir -p ${{ env.COVERAGE_REPORT_PATH }} + shopt -s globstar + cp **/*${{ env.COVERAGE_EXT }} ${{ env.COVERAGE_REPORT_PATH }} + ls ${{ env.COVERAGE_REPORT_PATH }} + + - name: Normalize coverage report paths + run: | + sed -i -e 's/SF:\/root\/build/SF:rust/g' ${{ env.COVERAGE_REPORT_PATH }}/cat-libs.coverage.info + + - name: Coveralls + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: coverallsapp/github-action@v2 + with: + path-to-lcov: "${{ env.COVERAGE_REPORT_PATH }}/cat-libs.coverage.info" + allow-empty: true + debug: true + flag-name: rust-unit-test + base-path: "/home/runner/work/catalyst-libs/catalyst-libs/" + parallel: true + + upload-coverage-report: + name: Upload coverage report + needs: [generate-coverage-report] + if: ${{ always() }} + runs-on: ubuntu-latest + steps: + - name: Coveralls Finished + uses: coverallsapp/github-action@v2 + with: + parallel-finished: true + carryforward: "rust-unit-test" diff --git a/rust/Earthfile b/rust/Earthfile index 2ba01a634c6..e7911ea50d0 100644 --- a/rust/Earthfile +++ b/rust/Earthfile @@ -55,8 +55,10 @@ build: --args2="--libs=cbork-cddl-parser --libs=cbork-abnf-parser" \ --args3="--libs=catalyst-voting" \ --args4="--bins=cbork/cbork" \ + --args5="--cov_report=$HOME/build/coverage-report.info" \ --output="release/[^\./]+" \ --junit="cat-libs.junit-report.xml" \ + --coverage="cat-libs.coverage.info" \ --docs="true" SAVE ARTIFACT target/$TARGETARCH/doc doc