From 3d61ca1c3365ebb017bddd8fb29310a0eef9b97e Mon Sep 17 00:00:00 2001 From: Thibault Charbonnier Date: Thu, 30 Nov 2023 19:33:46 -0800 Subject: [PATCH] chore(ci) add code coverage for Valgrind jobs --- .github/workflows/ci.yml | 1 + .github/workflows/job-unit-tests.yml | 1 + .github/workflows/job-valgrind-tests.yml | 18 +++++++++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2eeb43197..484c17663 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -202,6 +202,7 @@ jobs: hup: ${{ matrix.hup }} debug: ${{ matrix.debug }} path: ${{ matrix.path }} + coverage: true secrets: inherit lint: diff --git a/.github/workflows/job-unit-tests.yml b/.github/workflows/job-unit-tests.yml index 8c5edac28..cb406b357 100644 --- a/.github/workflows/job-unit-tests.yml +++ b/.github/workflows/job-unit-tests.yml @@ -156,6 +156,7 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} files: './lcov.info' + flags: unit - run: rm -f t/servroot/html/nginx.sock if: ${{ failure() && !env.ACT }} - uses: actions/upload-artifact@v2 diff --git a/.github/workflows/job-valgrind-tests.yml b/.github/workflows/job-valgrind-tests.yml index b659da25a..bb430138d 100644 --- a/.github/workflows/job-valgrind-tests.yml +++ b/.github/workflows/job-valgrind-tests.yml @@ -49,6 +49,7 @@ env: CC: ${{ inputs.cc }} NGX: ${{ inputs.ngx }} NGX_BUILD_OPENRESTY: ${{ inputs.openresty }} + NGX_BUILD_GCOV: ${{ inputs.coverage && 1 || 0 }} NGX_BUILD_DEBUG: ${{ inputs.debug == 'debug' && 1 || 0 }} NGX_BUILD_CC_OPT: '-O2' NGX_BUILD_NOPOOL: 1 @@ -67,7 +68,9 @@ jobs: runs-on: ${{ inputs.os }} timeout-minutes: 150 steps: - - run: sudo apt-get update && sudo apt-get install -y valgrind + - name: 'Setup deps - apt-get' + if: ${{ contains(inputs.os, 'ubuntu') }} + run: sudo apt-get update && sudo apt-get install -y valgrind ${CC} libstdc++-${CC#*-}-dev lcov - uses: actions/checkout@v3 - name: 'Setup cache - rustup toolchain' uses: actions/cache@v3 @@ -123,6 +126,19 @@ jobs: cat valgrind.log >&2 exit 1 fi + - name: Run lcov + if: ${{ !env.ACT && inputs.coverage }} + run: | + lcov --gcov-tool gcov-${CC#*-} --capture --directory work/buildroot --output-file lcov.info + lcov --gcov-tool gcov-${CC#*-} --remove lcov.info "*/ngx_wasm_module/src/common/debug/*" --output-file lcov.info + lcov --gcov-tool gcov-${CC#*-} --extract lcov.info "*/ngx_wasm_module/src/*" --output-file lcov.info + - name: Codecov Upload + if: ${{ !env.ACT && inputs.coverage }} + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: './lcov.info' + flags: valgrind - run: rm -f t/servroot/html/nginx.sock if: ${{ failure() && !env.ACT }} - uses: actions/upload-artifact@v2