Skip to content

Commit b4832a8

Browse files
committed
ci: use local bin and native coverage merge in Makefile
- use binary coverage output for unit tests to enable native merge with integration coverage - remove redundant test-coverage target declaration - install test binary to project-local bin/ instead of using sudo to install to /usr/bin/ - replace external gocovmerge with native 'go tool covdata merge' Signed-off-by: Klara Necasova <knecasov@redhat.com>
1 parent 559f03f commit b4832a8

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,21 @@ test:
4343

4444
.PHONY: test-coverage
4545
test-coverage: SHELL := /usr/bin/env bash
46-
test-coverage:
4746
rm -rf "$(COVERDIR)"
48-
mkdir -p "$(GOCOVERDIR)"
49-
go test -coverpkg=./... -coverprofile="$(COVERDIR)/unit.out" -covermode=atomic ./...
47+
mkdir -p "$(COVERDIR)/unit" "$(GOCOVERDIR)"
48+
GOCOVERDIR="$(COVERDIR)/unit" go test -coverpkg=./... -covermode=atomic ./...
5049
export GOCOVERDIR="$(GOCOVERDIR)"; \
5150
set -e; \
52-
$(MAKE) build GOFLAGS="-cover -covermode=atomic" && sudo install -D -m 755 $(PROJECT) /usr/bin/; \
51+
$(MAKE) build GOFLAGS="-cover -covermode=atomic" && \
52+
install -D -m 755 $(PROJECT) $(CURDIR)/bin/$(PROJECT); \
53+
export PATH="$(CURDIR)/bin:$$PATH"; \
5354
source .github/scripts/fdo-utils.sh; \
5455
generate_certs; \
5556
docker compose -f .github.qkg1.toppose/servers.yaml up -d --build; \
5657
trap 'docker compose -f .github.qkg1.toppose/servers.yaml logs; docker compose -f .github.qkg1.toppose/servers.yaml down' EXIT; \
57-
test_onboarding; \
58-
go tool covdata textfmt -i="$(GOCOVERDIR)" -o="$(COVERDIR)/integration.out"
59-
go install github.com/wadey/gocovmerge@latest
60-
gocovmerge "$(COVERDIR)/unit.out" "$(COVERDIR)/integration.out" > "$(COVERDIR)/coverage.out"
58+
test_onboarding
59+
go tool covdata merge -i="$(COVERDIR)/unit,$(GOCOVERDIR)" -o="$(COVERDIR)/merged"
60+
go tool covdata textfmt -i="$(COVERDIR)/merged" -o="$(COVERDIR)/coverage.out"
6161
go tool cover -html="$(COVERDIR)/coverage.out" -o "$(COVERDIR)/coverage.html"
6262

6363
.PHONY: vendor-tarball

0 commit comments

Comments
 (0)