From 967e0ae1f19624580bf6dc3eeb0a1630122db66a Mon Sep 17 00:00:00 2001 From: Joakim Olsson Date: Wed, 29 Apr 2026 07:17:01 +0200 Subject: [PATCH 1/2] fix(ci): use go-test-coverage binary directly to fix Gitea Actions vladopajic/go-test-coverage@v2 (v2.18.5+) restructured the composite action to pass inputs via env-var mapping. Gitea act_runner does not expand expressions in those blocks, so the literal string '${{ inputs.config }}' reached the binary, breaking the coverage step. Replace the action with a direct go install + binary invocation (matching the Frostmoln pattern) and use --github-action-output to expose total-coverage as a step output, dropping manual 'go tool cover -func' calculations. --- .gitea/workflows/ci.yaml | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 0196255..0602568 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -18,11 +18,10 @@ jobs: run: go test -race -coverprofile=coverage.txt ./... - name: Check coverage - uses: vladopajic/go-test-coverage@v2 - with: - config: ./.testcoverage.yml - - # Download baseline coverage from main branch (for PRs) + id: coverage + run: | + go install github.com/vladopajic/go-test-coverage/v2@latest + go-test-coverage --config ./.testcoverage.yml --github-action-output - name: Download baseline coverage if: gitea.event_name == 'pull_request' uses: actions/download-artifact@v3 @@ -30,14 +29,12 @@ jobs: name: coverage-baseline path: ./baseline continue-on-error: true - - # Compare coverage against baseline (for PRs) - name: Compare coverage if: gitea.event_name == 'pull_request' run: | - CURRENT=$(go tool cover -func=coverage.txt | grep "^total:" | awk '{print $NF}' | tr -d '%') + CURRENT="${{ steps.coverage.outputs.total-coverage }}" if [ -f ./baseline/coverage.txt ]; then - BASE=$(go tool cover -func=./baseline/coverage.txt | grep "^total:" | awk '{print $NF}' | tr -d '%') + BASE=$(cat ./baseline/coverage.txt) echo "Base coverage: ${BASE}%" echo "Current coverage: ${CURRENT}%" if [ "$(echo "$CURRENT < $BASE" | bc -l)" -eq 1 ]; then @@ -49,8 +46,9 @@ jobs: echo "No baseline coverage found, skipping comparison" echo "Current coverage: ${CURRENT}%" fi - - # Upload coverage as baseline (only on main) + - name: Save coverage baseline + if: gitea.ref == 'refs/heads/main' + run: echo "${{ steps.coverage.outputs.total-coverage }}" > coverage.txt - name: Upload coverage baseline if: gitea.ref == 'refs/heads/main' uses: actions/upload-artifact@v3 @@ -58,19 +56,17 @@ jobs: name: coverage-baseline path: coverage.txt retention-days: 90 - - # Post coverage to PR comment - name: Post coverage comment if: gitea.event_name == 'pull_request' env: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} GITEA_URL: ${{ gitea.server_url }} run: | - COVERAGE=$(go tool cover -func=coverage.txt | grep "^total:" | awk '{print $NF}') + COVERAGE="${{ steps.coverage.outputs.total-coverage }}" curl -X POST "${GITEA_URL}/api/v1/repos/${{ gitea.repository }}/issues/${{ gitea.event.pull_request.number }}/comments" \ -H "Authorization: token ${GITEA_TOKEN}" \ -H "Content-Type: application/json" \ - -d "{\"body\": \"## Coverage Report\n\nTotal coverage: **${COVERAGE}**\"}" + -d "{\"body\": \"## Coverage Report\n\nTotal coverage: **${COVERAGE}%**\"}" vulnerabilities: runs-on: ubuntu-latest -- 2.52.0 From 4c34b45b2a2b2bfde1a2d83ff8a24063a4dd1fb4 Mon Sep 17 00:00:00 2001 From: Joakim Olsson Date: Wed, 29 Apr 2026 07:47:22 +0200 Subject: [PATCH 2/2] chore(deps): bump go directive to 1.26.2 Match toolchain version. We are the sole consumers of this module. --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index d6701d8..cf09113 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module gitea.unbound.se/unboundsoftware/pagination -go 1.24.4 +go 1.26.2 require github.com/stretchr/testify v1.11.1 -- 2.52.0