From 60e7f29b484a4dbeada024fad25e68f3cea9a942 Mon Sep 17 00:00:00 2001 From: Valery Piashchynski Date: Mon, 17 Aug 2026 17:10:58 +0200 Subject: [PATCH] fix: report plugin coverage instead of the tests module The e2e step ran -coverpkg=./... from inside tests/, so it only ever instrumented the tests module and the upload filter then dropped every line. The codecov job also had no checkout and pulled artifacts without a name, so the *.out glob matched nothing. Scope coverpkg to the plugin module, check the repo out before uploading, strip the module prefix with awk like jobs does, and fail the job when the merged summary holds no plugin blocks. --- .github/workflows/linux.yml | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index a7b6e7a..06e2f2c 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -64,12 +64,12 @@ jobs: cd tests mkdir ./coverage-ci - go test -timeout 20m -v -race -cover -tags=debug -failfast -coverpkg=./... -coverprofile=./coverage-ci/headers.out -covermode=atomic ./... + go test -timeout 20m -v -race -cover -tags=debug -coverpkg=github.com/roadrunner-server/headers/v6/... -coverprofile=./coverage-ci/headers.out -covermode=atomic ./... - name: Archive code coverage results uses: actions/upload-artifact@v7 with: - name: coverage + name: coverage-headers path: ./tests/coverage-ci/headers.out codecov: @@ -80,12 +80,32 @@ jobs: timeout-minutes: 60 steps: + - name: Check out code + uses: actions/checkout@v7 - name: Download code coverage results uses: actions/download-artifact@v8 - - run: | + with: + pattern: coverage-* + path: coverage + merge-multiple: true + - name: Prepare coverage report + run: | echo 'mode: atomic' > summary.txt - tail -q -n +2 *.out >> summary.txt - sed -i '2,${/roadrunner/!d}' summary.txt + tail -q -n +2 coverage/*.out >> summary.txt + awk ' + NR == 1 { print; next } + /^github\.com\/roadrunner-server\/headers\/v6\// { + sub(/^github\.com\/roadrunner-server\/headers\/v6\//, "", $0) + print + } + ' summary.txt > summary.filtered.txt + mv summary.filtered.txt summary.txt + # a profile that maps to no plugin source uploads fine and reports 0% + blocks=$(($(wc -l < summary.txt) - 1)) + if [ "$blocks" -lt 10 ]; then + echo "::error::coverage summary holds $blocks blocks, the profile does not map to plugin sources" + exit 1 + fi - name: upload to codecov uses: codecov/codecov-action@v7 # Docs: