Skip to content

Commit

Permalink
Use make test-ci for Github test workflow
Browse files Browse the repository at this point in the history
This fixes a bug with the CI tests that was introduced with the upgrade
to Go version 1.22.1 due to changes in how the "coverpkg" argument
works, see: golang/go#65653.

- Modify Makefile test and test-race targets based on
  artefactual-sdps/enduro targets
- Add Makefile test-ci target from artefactual-sdps/enduro
- Update .github/workflows/test.yml to use `make test-ci` to run tests
- Delete hack/coverpkgs.sh
  • Loading branch information
djjuhasz committed Mar 11, 2024
1 parent 6d97114 commit 50291c4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
go-version: ${{ steps.go_version.outputs.go_version }}
- name: Test
run: go test -race -coverprofile=covreport -covermode=atomic -coverpkg=$(./hack/coverpkgs.sh) -v ./...
run: make test-ci
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/.env
/build
/covreport
/dist
/enduro

Expand Down
18 changes: 14 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ endef
IGNORED_PACKAGES := \
github.com/artefactual-labs/enduro/hack/% \
github.com/artefactual-labs/enduro/%/fake \
github.com/artefactual-labs/enduro/ui \
github.com/artefactual-labs/enduro/internal/api/design \
github.com/artefactual-labs/enduro/internal/api/gen/% \
github.com/artefactual-labs/enduro/internal/batch/fake \
Expand Down Expand Up @@ -61,11 +62,20 @@ build:
deps: $(GOMAJOR) # @HELP Lists available module dependency updates.
gomajor list

test: $(GOTESTSUM) # @HELP Tests using gotestsum.
gotestsum $(TEST_PACKAGES)
test: # @HELP Run all tests and output a summary using gotestsum.
test: TFORMAT ?= short
test: GOTEST_FLAGS ?=
test: COMBINED_FLAGS ?= $(GOTEST_FLAGS) $(TEST_PACKAGES)
test: $(GOTESTSUM)
gotestsum --format=$(TFORMAT) -- $(COMBINED_FLAGS)

test-race: $(GOTESTSUM) # @HELP Tests using gotestsum and the race detector.
gotestsum $(TEST_PACKAGES) -- -race
test-race: # @HELP Run all tests with the race detector.
test-race:
$(MAKE) test GOTEST_FLAGS="-race"

test-ci: # @HELP Run all tests in CI with coverage and the race detector.
test-ci:
$(MAKE) test GOTEST_FLAGS="-race -coverprofile=covreport -covermode=atomic"

list-tested-packages: # @HELP Print a list of packages being tested.
list-tested-packages:
Expand Down
26 changes: 0 additions & 26 deletions hack/coverpkgs.sh

This file was deleted.

0 comments on commit 50291c4

Please sign in to comment.