From 6c198796689620f13cc67a3e101f0f0098432833 Mon Sep 17 00:00:00 2001 From: Philip Laine Date: Mon, 1 Jun 2026 11:49:02 +0200 Subject: [PATCH] Add codecov to Go unit tests --- .github/workflows/go.yaml | 8 +++++++- .gitignore | 4 ++-- Makefile | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml index a888ca2..422f880 100644 --- a/.github/workflows/go.yaml +++ b/.github/workflows/go.yaml @@ -30,4 +30,10 @@ jobs: go mod tidy git diff --exit-code - name: Run unit tests - run: make -B test-unit + run: make test-unit + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 #v6.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + flags: unit + diff --git a/.gitignore b/.gitignore index ada68ff..aff540b 100644 --- a/.gitignore +++ b/.gitignore @@ -10,8 +10,8 @@ Dockerfile.cross # Test binary, built with `go test -c` *.test -# Output of the go coverage tool, specifically when used with LiteIDE -*.out +# Output of the go coverage tool. +coverage.txt # Go workspace file go.work diff --git a/Makefile b/Makefile index 46c3b1e..0af6528 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ lint: .PHONY: test test-unit: - @go test ./... -race + @go test ./... -race -coverprofile=coverage.txt .PHONY: build build: bin/linux-$(shell go env GOARCH)/netbird-kubeapi-proxy