Skip to content

Commit

Permalink
Enhance test coverage: Add Go 1.21 to matrix and enable data race det…
Browse files Browse the repository at this point in the history
…ection (#119)

* Expand test matrix to include Go 1.20

* Enable data race detection flag in test command

* Bump GH workflow Go versions to include 1.21

* enable CGO with race test

* use string for versions value to avoid rounding issue

---------

Co-authored-by: Lucas Medeiros <[email protected]>
  • Loading branch information
alesr and lucasmdrs authored Oct 18, 2023
1 parent 5cea8e2 commit 2270c21
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
go-version: [ 1.18, 1.19 ]
go-version: [ '1.19', '1.20', '1.21' ]

steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 5 additions & 1 deletion Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ tasks:
cmds:
- task: test-deps-up
- task: test-run
- task: test-run
vars:
RACE: true
- task: test-deps-down

test-deps-up:
Expand All @@ -28,7 +31,7 @@ tasks:
test-run:
summary: Runs tests, must have dependencies running in the docker-compose
cmds:
- cmd: go test -timeout 2m -cover -coverprofile=coverage.txt -covermode=atomic ./...
- cmd: go test {{if .RACE}} -race {{end}} -timeout 2m -cover -coverprofile=coverage.txt -covermode=atomic ./...
vars:
PG_PQ_HOST:
sh: docker-compose port pg-pq 5432
Expand Down Expand Up @@ -56,6 +59,7 @@ tasks:
sh: docker-compose port nats 4222

env:
CGO_ENABLED: '{{if .RACE}}1{{else}}0{{end}}'
HEALTH_GO_PG_PQ_DSN: 'postgres://test:test@{{.PG_PQ_HOST}}/test?sslmode=disable'
HEALTH_GO_PG_PGX4_DSN: 'postgres://test:test@{{.PG_PGX4_HOST}}/test?sslmode=disable'
HEALTH_GO_PG_PGX5_DSN: 'postgres://test:test@{{.PG_PGX5_HOST}}/test?sslmode=disable'
Expand Down

0 comments on commit 2270c21

Please sign in to comment.