Byte-snake-engine/.github/workflows/test.yml
Rob O'Dwyer 1c3f434841
DEV 1253: Upgrade to Go 1.18.1 (#70)
* fix dependency that breaks on go 1.18.1

* upgrade to go 1.18.1

* upgrade golangci-lint to a version that works with go 1.18
2022-05-02 13:57:07 -07:00

66 lines
1.6 KiB
YAML

name: Test
on: [push, pull_request]
env:
GO_VERSION: 1.18.1
jobs:
format:
name: Format (gofmt)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: actions/setup-go@main
with:
go-version: '${{ env.GO_VERSION }}'
- name: Run gofmt
run: test -z $(gofmt -l .) || (gofmt -d . && exit 1)
lint:
name: Lint (golangci-lint)
runs-on: ubuntu-latest
needs: [format]
steps:
- uses: actions/checkout@main
- uses: actions/setup-go@main
with:
go-version: '${{ env.GO_VERSION }}'
- name: Run golangci-lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.45.2
golangci-lint run -v ./...
test:
name: Test (go test)
runs-on: ubuntu-latest
needs: [lint]
steps:
- uses: actions/checkout@main
- uses: actions/setup-go@main
with:
go-version: '${{ env.GO_VERSION }}'
- name: Run go test
run: go test -race -coverprofile=coverage.txt ./...
- name: Upload coverage to codecov.io
if: github.event_name == 'push'
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
fail_ci_if_error: true
build-cli:
name: Build CLI (go build)
runs-on: ubuntu-latest
needs: [lint]
steps:
- uses: actions/checkout@main
- uses: actions/setup-go@main
with:
go-version: '${{ env.GO_VERSION }}'
- name: Run go build
run: |
go build ./cli/battlesnake
./battlesnake --help