build: don't use Corbetura for Go coverage anymore

gocov and gocovxml are unmaintained. There is
https://github.com/boumenot/gocover-cobertura which is linked from
Gitlab, but it is missing some lines during the conversion (code defined
in callbacks called from var, see hellogopher as an example), so it is
not reliable.
This commit is contained in:
Vincent Bernat
2025-08-20 07:13:12 +02:00
parent f8161d9375
commit 5b86e7e4a7
5 changed files with 9 additions and 25 deletions

View File

@@ -62,7 +62,7 @@ jobs:
name: linux-coverage
if-no-files-found: error
path: |
test/go/coverage.xml
test/go/profile.out
test/js/cobertura-coverage.xml
- name: Upload binary
uses: actions/upload-artifact@v4
@@ -121,7 +121,7 @@ jobs:
name: macos-coverage
if-no-files-found: error
path: |
test/go/coverage.xml
test/go/profile.out
test/js/cobertura-coverage.xml
coverage:
@@ -148,7 +148,11 @@ jobs:
uses: codecov/codecov-action@v5
with:
token: bab8d6d9-e90c-4e37-b156-38a9a4c2108e # not ideal, but limited risk
files: ./test/linux/go/coverage.xml,./test/linux/js/cobertura-coverage.xml, ./test/macos/go/coverage.xml,./test/macos/js/cobertura-coverage.xml
files: >-
./test/linux/go/profile.out,
./test/linux/js/cobertura-coverage.xml,
./test/macos/go/profile.out,
./test/macos/js/cobertura-coverage.xml
flags: unittests
fail_ci_if_error: true

View File

@@ -32,14 +32,7 @@ run tests:
- time make test-js
- time make test-coverage
coverage: '/Code coverage: [0-9.]+/'
artifacts:
reports:
junit:
- test/go/tests.xml
- test/js/tests.xml
coverage_report:
coverage_format: cobertura
path: test/go/coverage.xml
# Coverage reports were removed
# To execute manually:
# gitlab-runner exec docker "run tests"

View File

@@ -55,8 +55,6 @@ all_indep: $(GENERATED)
# Tools
ENUMER = go tool enumer
GOCOV = go tool gocov
GOCOVXML = go tool gocov-xml
GOIMPORTS = go tool goimports
GOTESTSUM = go tool gotestsum
MOCKGEN = go tool mockgen
@@ -197,7 +195,6 @@ test-coverage-go: ; $(info $(M) running Go coverage tests…) @ ## Run Go covera
else cp test/go/profile.out.tmp test/go/profile.out ; \
fi
$Q $(GO) tool cover -html=test/go/profile.out -o test/go/coverage.html
$Q $(GOCOV) convert test/go/profile.out | $(GOCOVXML) > test/go/coverage.xml
@printf "Code coverage: "; \
go tool cover -func test/go/profile.out | awk '($$1 == "total:") { print $$NF}'

6
go.mod
View File

@@ -35,6 +35,7 @@ require (
github.com/opencontainers/image-spec v1.1.1
github.com/oschwald/maxminddb-golang/v2 v2.0.0-beta.8
github.com/osrg/gobgp/v3 v3.37.0
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10
github.com/prometheus/client_golang v1.23.0
github.com/rs/zerolog v1.34.0
github.com/scrapli/scrapligo v1.3.3
@@ -66,12 +67,10 @@ require (
require (
cloud.google.com/go/compute/metadata v0.7.0 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
github.com/AlekSi/gocov-xml v1.1.0 // indirect
github.com/AlekSi/pointer v1.2.0 // indirect
github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/andybalholm/brotli v1.2.0 // indirect
github.com/axw/gocov v1.2.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bio-routing/tflow2 v0.0.0-20181230153523-2e308a4a3c3a // indirect
github.com/bitfield/gotestdox v0.2.2 // indirect
@@ -154,7 +153,6 @@ require (
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pierrec/lz4/v4 v4.1.22 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/prometheus/client_model v0.6.2 // indirect
@@ -204,8 +202,6 @@ require (
)
tool (
github.com/AlekSi/gocov-xml
github.com/axw/gocov/gocov
github.com/dmarkham/enumer
github.com/frapposelli/wwhrd
github.com/mgechev/revive

6
go.sum
View File

@@ -2,8 +2,6 @@ cloud.google.com/go/compute/metadata v0.7.0 h1:PBWF+iiAerVNe8UCHxdOt6eHLVc3ydFeO
cloud.google.com/go/compute/metadata v0.7.0/go.mod h1:j5MvL9PprKL39t166CoB1uVHfQMs4tFQZZcKwksXUjo=
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
github.com/AlekSi/gocov-xml v1.1.0 h1:iElWGi7s/MuL8/d8WDtI2fOAsN3ap9x8nK5RrAhaDng=
github.com/AlekSi/gocov-xml v1.1.0/go.mod h1:g1dRVOCHjKkMtlPfW6BokJ/qxoeZ1uPNAK7A/ii3CUo=
github.com/AlekSi/pointer v1.2.0 h1:glcy/gc4h8HnG2Z3ZECSzZ1IX1x2JxRVuDzaJwQE0+w=
github.com/AlekSi/pointer v1.2.0/go.mod h1:gZGfd3dpW4vEc/UlyfKKi1roIqcCgwOIvb0tSNSBle0=
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8=
@@ -21,9 +19,6 @@ github.com/alecthomas/chroma v0.10.0 h1:7XDcGkCQopCNKjZHfYrNLraA+M7e0fMiJ/Mfikbf
github.com/alecthomas/chroma v0.10.0/go.mod h1:jtJATyUxlIORhUOFNA9NZDWGAQ8wpxQQqNSB4rjA/1s=
github.com/andybalholm/brotli v1.2.0 h1:ukwgCxwYrmACq68yiUqwIWnGY0cTPox/M94sVwToPjQ=
github.com/andybalholm/brotli v1.2.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY=
github.com/axw/gocov v1.1.0/go.mod h1:H9G4tivgdN3pYSSVrTFBr6kGDCmAkgbJhtxFzAvgcdw=
github.com/axw/gocov v1.2.1 h1:bqtQDBC2tQWcPzTYIVxK0EDCfNRLwsk4NZ0+GB4hX8Q=
github.com/axw/gocov v1.2.1/go.mod h1:l11/vZBBKfQEE+42jF47myjDrRZHM+hR+XgGjI6FopU=
github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o=
github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
@@ -607,7 +602,6 @@ golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE=
golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=