github.com/amarpal/go-tools@v0.0.0-20240422043104-40142f59f616/.github/workflows/ci.yml (about) 1 name: "CI" 2 on: ["push", "pull_request"] 3 4 jobs: 5 ci: 6 name: "Run CI" 7 strategy: 8 fail-fast: false 9 matrix: 10 os: ["windows-latest", "ubuntu-latest", "macOS-latest"] 11 go: ["1.22.x"] 12 runs-on: ${{ matrix.os }} 13 steps: 14 - uses: actions/checkout@v1 15 with: 16 fetch-depth: 1 17 - uses: WillAbides/setup-go-faster@v1.12.0 18 with: 19 go-version: ${{ matrix.go }} 20 - run: "go test ./..." 21 - run: "go vet ./..." 22 - uses: dominikh/staticcheck-action@v1.3.0 23 with: 24 version: "2023.1.6" 25 min-go-version: "module" 26 install-go: false 27 cache-key: ${{ matrix.go }} 28 output-format: binary 29 output-file: "./staticcheck.bin" 30 - uses: actions/upload-artifact@v3 31 with: 32 name: "staticcheck-${{ github.sha }}-${{ matrix.go }}-${{ matrix.os }}.bin" 33 path: "./staticcheck.bin" 34 retention-days: 1 35 if-no-files-found: warn 36 output: 37 name: "Output Staticcheck findings" 38 needs: ci 39 runs-on: "ubuntu-latest" 40 steps: 41 - uses: WillAbides/setup-go-faster@v1.12.0 42 with: 43 go-version: "1.22.x" 44 # this downloads all artifacts of the current workflow into the current working directory, creating one directory per artifact 45 - uses: actions/download-artifact@v3 46 - id: glob 47 run: | 48 # We replace newlines with %0A, which GitHub apparently magically turns back into newlines 49 out=$(ls -1 ./staticcheck-*.bin/*.bin) 50 echo "::set-output name=files::${out//$'\n'/%0A}" 51 - uses: dominikh/staticcheck-action@v1.3.0 52 with: 53 version: "2023.1.6" 54 min-go-version: "module" 55 install-go: false 56 merge-files: ${{ steps.glob.outputs.files }}