Skip to content

Commit

Permalink
Merge pull request #3769 from infrahq/dnephin/ci-only-race-on-main
Browse files Browse the repository at this point in the history
ci: only run -race on main and when there is a label
  • Loading branch information
dnephin authored Nov 30, 2022
2 parents 34c287f + 4f38c92 commit 56f41e8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/labels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,6 @@
- name: "action/fuzz"
color: "dddddd"
description: Run fuzzing on this pull request.
- name: "action/race"
color: "dddddd"
description: Enable the Go race detector in subsequent test runs of this pull request.
8 changes: 6 additions & 2 deletions .github/workflows/ci-core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,14 @@ jobs:
go-version: "1.19"
cache: true
- run: go mod download -x
- run: go install gotest.tools/[email protected]
- run: go install gotest.tools/[email protected]

- name: Conditionally enable -race
if: ${{ github.ref_name == 'main' || contains(github.event.pull_request.labels.*.name, 'action/race') }}
run: echo "GO_TEST_RACE=-race" >> $GITHUB_ENV

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

Expand Down

0 comments on commit 56f41e8

Please sign in to comment.