.github/workflows/ci.yml
name: Continuous Integration
on: [push, pull_request]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up go environment
uses: actions/setup-go@v2
with:
go-version: 1.15.7
- name: Environment information
run: |
echo "UNAME: $(uname -a)"
echo "PWD: $(pwd)"
echo "PATH: ${PATH}"
echo "GO: $(go version)"
echo "GO ENV: $(go env)"
- name: Build
run: go build -v
- name: Test
run: go test -run '(Test|Example)' -race -coverprofile=coverage.out -covermode=atomic ./...
- name: Verify dependencies have expected content
run: go mod verify
- name: Code quality (revive)
run: |
go install github.com/mgechev/revive
revive -formatter friendly -exclude vendor/... ./...
- name: Code quality (formatting)
run: (gofmt -s -l -d -e $(find . -type f -name '*.go' -not -path "./vendor/*") | tee /dev/stderr) || exit 1;
- name: Code quality (vet)
run: go vet ./...
- name: Code quality (bounded cyclomatic complexity)
run: |
go install github.com/fzipp/gocyclo/cmd/gocyclo
gocyclo -over 15 $(find . -type f -name '*.go' -not -path "./vendor/*")
- name: Code quality (golint style mistakes)
run: |
go install golang.org/x/lint/golint
golint -set_exit_status $(go list ./...)
- name: Code quality (detect ineffectual assignments)
run: |
go install github.com/gordonklaus/ineffassign
ineffassign .
- name: Code quality (spelling mistakes)
run: |
go install github.com/client9/misspell/cmd/misspell
misspell --error $(find . -type f -not -path "./vendor/*" -not -path "./.git/*")
- name: Code quality (bugs, suggest code simplifications, point out dead code, and more)
run: |
go install honnef.co/go/tools/cmd/staticcheck
staticcheck -checks=all ./...
- name: Code quality (identify unnecessary type conversions)
run: |
go install github.com/mdempsky/unconvert
unconvert -v ./...
- name: Analyze binary size
run: |
go install github.com/jondot/goweight
goweight
- name: Notify Go Report Card
run: curl -XPOST https://goreportcard.com/checks -F 'repo=github.com/bpicode/fritzctl'
- name: Upload code coverage
run: bash <(curl -s https://codecov.io/bash)