Skip to content

Commit

Permalink
.cirrus: run -race only on non-PR branch
Browse files Browse the repository at this point in the history
Signed-off-by: flouthoc <[email protected]>
  • Loading branch information
flouthoc committed Feb 4, 2025
1 parent 25dce01 commit b582c5e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ GO_GCFLAGS := $(shell if $(GO) version|grep -q gccgo; then echo "-gccgoflags"; e
NPROCS := $(shell nproc)
export GO_BUILD=$(GO) build
export GO_TEST=$(GO) test -parallel=$(NPROCS)
#RACEFLAGS := $(shell $(GO_TEST) -race ./pkg/dummy > /dev/null 2>&1 && echo -race)
RACEFLAGS :=
# If RACEFLAGS is defined then set appropriate RACEFLAGS automatically for `go test`
ifdef RACEFLAGS
RACEFLAGS := $(shell $(GO_TEST) -race ./pkg/dummy > /dev/null 2>&1 && echo -race)
else
RACEFLAGS :=
endif

COMMIT_NO ?= $(shell git rev-parse HEAD 2> /dev/null || true)
GIT_COMMIT ?= $(if $(shell git status --porcelain --untracked-files=no),${COMMIT_NO}-dirty,${COMMIT_NO})
Expand Down
9 changes: 8 additions & 1 deletion contrib/cirrus/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,14 @@ else
showrun make validate
;;
unit)
showrun make test-unit

if [[ -n "$CIRRUS_PR" ]]; then
showrun make test-unit
else
# If not running on a PR then run unit tests
# with appropriate `-race` flags.
showrun RACEFLAGS=true make test-unit
fi
;;
conformance)
# Typically it's undesirable to install packages at runtime.
Expand Down

0 comments on commit b582c5e

Please sign in to comment.