Fix linter issues #74
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: Build and tests | |
on: | |
# run tests on push to main, but not when other branches are pushed to | |
push: | |
branches: | |
- main | |
# run tests for all pull requests | |
pull_request: | |
jobs: | |
build: | |
strategy: | |
matrix: | |
go-version: | |
- 1.19.x | |
- 1.20.x | |
runs-on: ubuntu-latest | |
name: Go ${{ matrix.go-version }} | |
env: | |
GOPROXY: https://proxy.golang.org | |
steps: | |
- name: Set up Go ${{ matrix.go-version }} | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go-version }} | |
id: go | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Build | |
run: | | |
GOOS=linux go build -o monsoon_linux | |
GOOS=windows go build -o monsoon_linux | |
GOOS=darwin go build -o monsoon_linux | |
- name: Run tests | |
run: | | |
export PATH=$HOME/bin:$PATH | |
go test ./... | |
lint: | |
name: Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. | |
version: v1.51 | |
args: --verbose --timeout 5m | |
- name: Check go.mod/go.sum | |
run: | | |
echo "check if go.mod and go.sum are up to date" | |
go mod tidy | |
git diff --exit-code go.mod go.sum |