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/checkout@v1 - uses: actions/setup-go@v3 with: go-version: ${{matrix.go}} - name: Get Go cache path id: go-cache run: | echo "::set-output name=goos::$(go env GOOS)" echo "::set-output name=goarch::$(go env GOARCH)" echo "::set-output name=goversion::$(go env GOVERSION)" echo "::set-output name=gocache::$(go env GOCACHE)" echo "::set-output name=gomodcache::$(go env GOMODCACHE)" - name: Checkout uses: actions/checkout@v2 - name: Go build cache uses: actions/cache@v2 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@v2 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 uses: dominikh/staticcheck-action@v1.2.0 with: version: "2022.1.1" install-go: false cache-key: ${{ matrix.go }}