Skip to content

Commit

Permalink
GHA workflows for unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
manicminer committed May 9, 2024
1 parent 834d13d commit e82c700
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 47 deletions.
46 changes: 0 additions & 46 deletions .github/workflows/go-retryablehttp.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/pr-gofmt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Go format check
on:
pull_request:
types: ['opened', 'synchronize']

jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5

- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: ./.go-version

- name: Run go format
run: |-
files=$(gofmt -s -l .)
if [ -n "$files" ]; then
echo >&2 "The following file(s) are not gofmt compliant:"
echo >&2 "$files"
exit 1
fi
17 changes: 17 additions & 0 deletions .github/workflows/pr-unit-tests-1.19.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Unit tests (Go 1.19)
on:
pull_request:
types: ['opened', 'synchronize']

jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5

- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: 1.19

- name: Run unit tests
run: make test
17 changes: 17 additions & 0 deletions .github/workflows/pr-unit-tests-1.20.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Unit tests (Go 1.20+)
on:
pull_request:
types: ['opened', 'synchronize']

jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5

- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: 1.22

- name: Run unit tests
run: make test
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ default: test

test:
go vet ./...
go test -race ./...
go test -v -race ./...

updatedeps:
go get -f -t -u ./...
Expand Down

0 comments on commit e82c700

Please sign in to comment.