Go #687
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 | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go: ["1.17","1.18", "1.x"] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Go ${{ matrix.go }} | |
uses: actions/[email protected] | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Build | |
run: go build -v ./... | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/[email protected] | |
with: | |
go-version: '1.18' | |
- name: Run Coverage | |
run: go test -v -coverprofile=profile.cov ./... | |
- name: Send coverage | |
uses: shogo82148/actions-goveralls@v1 | |
with: | |
path-to-profile: profile.cov | |
static_analysis: | |
name: Static Analysis | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.18' | |
id: go | |
- name: Install required static analysis tools | |
run: | | |
go get -u honnef.co/go/tools/cmd/staticcheck | |
- name: Check out code | |
uses: actions/[email protected] | |
- name: get dependencies | |
run: | | |
go get -v -t -d ./... | |
- name: Go vet | |
run: go vet ./... | |
- name: Check gofmt | |
run: diff -u <(echo -n) <(gofmt -d -s .) |