Skip to content

Commit 56f41e8

Browse files
authored
Merge pull request #3769 from infrahq/dnephin/ci-only-race-on-main
ci: only run -race on main and when there is a label
2 parents 34c287f + 4f38c92 commit 56f41e8

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.github/labels.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,6 @@
9090
- name: "action/fuzz"
9191
color: "dddddd"
9292
description: Run fuzzing on this pull request.
93+
- name: "action/race"
94+
color: "dddddd"
95+
description: Enable the Go race detector in subsequent test runs of this pull request.

.github/workflows/ci-core.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,14 @@ jobs:
6262
go-version: "1.19"
6363
cache: true
6464
- run: go mod download -x
65-
- run: go install gotest.tools/[email protected]
65+
- run: go install gotest.tools/[email protected]
66+
67+
- name: Conditionally enable -race
68+
if: ${{ github.ref_name == 'main' || contains(github.event.pull_request.labels.*.name, 'action/race') }}
69+
run: echo "GO_TEST_RACE=-race" >> $GITHUB_ENV
6670

6771
- name: go test
68-
run: ~/go/bin/gotestsum -ftestname -- -race ./...
72+
run: ~/go/bin/gotestsum -ftestname -- ${GO_TEST_RACE:-} ./...
6973
env:
7074
POSTGRESQL_CONNECTION: "host=localhost port=5432 user=postgres dbname=postgres password=password123"
7175

0 commit comments

Comments
 (0)