name: ci on: - push - pull_request jobs: go: name: Go ${{matrix.go}} - ${{matrix.os}} runs-on: ${{matrix.os}} strategy: matrix: os: ["windows-latest", "ubuntu-latest", "macOS-latest"] go: ["1.19.x"] fail-fast: false steps: - uses: actions/setup-go@v3 with: go-version: ${{matrix.go}} - name: Get Go cache path id: go-cache shell: bash run: | echo "goos=$(go env GOOS)" >> $GITHUB_OUTPUT echo "goarch=$(go env GOARCH)" >> $GITHUB_OUTPUT echo "goversion=$(go env GOVERSION)" >> $GITHUB_OUTPUT echo "gocache=$(go env GOCACHE)" >> $GITHUB_OUTPUT echo "gomodcache=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT - name: Checkout uses: actions/checkout@v3 - name: Go build cache uses: actions/cache@v3 with: path: ${{steps.go-cache.outputs.gocache}} key: ${{steps.go-cache.outputs.goversion}}-${{steps.go-cache.outputs.goos}}-${{steps.go-cache.outputs.goarch}}-go-build-${{hashFiles('**/go.sum')}} - name: Go mod cache uses: actions/cache@v3 with: path: ${{steps.go-cache.outputs.gomodcache}} key: ${{steps.go-cache.outputs.goversion}}-${{steps.go-cache.outputs.goos}}-${{steps.go-cache.outputs.goarch}}-go-mod-${{hashFiles('**/go.sum')}} - name: Go test run: go test -v ./... - name: Go vet run: go vet ./... - name: Go staticcheck run: go run honnef.co/go/tools/cmd/staticcheck@2022.1.3 ./...