Skip to content

Commit

Permalink
Merge pull request #389 from pjbgf/enable-race
Browse files Browse the repository at this point in the history
build: enable `-race` for `go test`
  • Loading branch information
Paulo Gomes authored Jun 15, 2022
2 parents 1346cac + 1d3de14 commit adae8fb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ jobs:
go-version: 1.17.x
- name: Run tests
run: make test
env:
# Temporarily disabling -race for arm64 as our GitHub action
# runners don't seem to like it.
#
# We should reenable go test -race for arm64 runners once the
# current issue is resolved.
GO_TEST_ARGS: ""
- name: Verify
run: make verify

Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ BUILD_ARGS ?=
# Architectures to build images for
BUILD_PLATFORMS ?= linux/amd64,linux/arm64,linux/arm/v7

# Allows for defining additional Go test args, e.g. '-tags integration'.
GO_TEST_ARGS ?= -race

# Directory with versioned, downloaded things
CACHE := cache

Expand Down Expand Up @@ -138,10 +141,10 @@ endif
KUBEBUILDER_ASSETS?="$(shell $(ENVTEST) --arch=$(ENVTEST_ARCH) use -i $(ENVTEST_KUBERNETES_VERSION) --bin-dir=$(ENVTEST_ASSETS_DIR) -p path)"
test: $(LIBGIT2) tidy test-api test_deps generate fmt vet manifests api-docs install-envtest ## Run tests
KUBEBUILDER_ASSETS=$(KUBEBUILDER_ASSETS) \
go test $(GO_STATIC_FLAGS) ./... -coverprofile cover.out
go test $(GO_STATIC_FLAGS) $(GO_TEST_ARGS) ./... -coverprofile cover.out

test-api: ## Run api tests
cd api; go test ./... -coverprofile cover.out
cd api; go test $(GO_TEST_ARGS) ./... -coverprofile cover.out

manager: $(LIBGIT2) generate fmt vet ## Build manager binary
go build -o $(BUILD_DIR)/bin/manager ./main.go
Expand Down

0 comments on commit adae8fb

Please sign in to comment.