fix: concurrent tests having race conditions #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
env: | |
# run coverage only with the latest Go version | |
LATEST_GO_VERSION: "1.23" | |
jobs: | |
test: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
# Each major Go release is supported until there are two newer major releases. https://golang.org/doc/devel/release.html#policy | |
# Echo tests with last four major releases (unless there are pressing vulnerabilities) | |
# As we depend on `golang.org/x/` libraries which only support last 2 Go releases we could have situations when | |
# we derive from last four major releases promise. | |
go: ["1.20", "1.21", "1.22", "1.23"] | |
name: ${{ matrix.os }} @ Go ${{ matrix.go }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Set up Go ${{ matrix.go }} | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Run Tests | |
run: go test -race --coverprofile=coverage.coverprofile --covermode=atomic ./... | |
- name: Upload coverage to Codecov | |
if: success() && matrix.go == env.LATEST_GO_VERSION && matrix.os == 'ubuntu-latest' | |
uses: codecov/codecov-action@v3 | |
with: | |
token: | |
fail_ci_if_error: false |