ci: Added CI to run tests and build packages #8
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: Go Pipeline | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
stable: false | |
go-version: "1.21.3" | |
- name: Get dependencies | |
run: go mod tidy | |
- name: Run golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.54 | |
- name: Format | |
run: | | |
if [[ $(gofmt -d . | wc -c) -ne 0 ]]; then | |
gofmt -d . | |
exit 1 | |
fi | |
- name: Vet API | |
run: | | |
go vet ./... | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
stable: false | |
go-version: 1.21.3 | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
- name: Get dependencies | |
run: go mod tidy | |
- name: Test | |
run: go test -v ./... | |
- name: Race Condition | |
run: go test -race ./... | |