| 1 |
name: "CI" |
| 2 |
on: ["push", "pull_request"] |
| 3 |
permissions: {} |
| 4 |
|
| 5 |
jobs: |
| 6 |
ci: |
| 7 |
name: "Run CI" |
| 8 |
strategy: |
| 9 |
fail-fast: false |
| 10 |
matrix: |
| 11 |
os: ["windows-latest", "ubuntu-latest", "macOS-latest"] |
| 12 |
go: ["1.26", "1.27.0-rc.1"] |
| 13 |
godebug: [""] |
| 14 |
runs-on: ${{ matrix.os }} |
| 15 |
steps: |
| 16 |
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 17 |
with: |
| 18 |
fetch-depth: 1 |
| 19 |
persist-credentials: false |
| 20 |
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 |
| 21 |
with: |
| 22 |
go-version: ${{ matrix.go }} |
| 23 |
- run: "go test ./..." |
| 24 |
env: |
| 25 |
GODEBUG: ${{ matrix.godebug }} |
| 26 |
- run: "go vet ./..." |
| 27 |
- uses: dominikh/staticcheck-action@9716614d4101e79b4340dd97b10e54d68234e431 # v1.4.1 |
| 28 |
with: |
| 29 |
version: "master" |
| 30 |
min-go-version: "module" |
| 31 |
install-go: false |
| 32 |
cache-key: ${{ matrix.go }} |
| 33 |
output-format: binary |
| 34 |
output-file: "./staticcheck.bin" |
| 35 |
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 36 |
with: |
| 37 |
name: "staticcheck-${{ github.sha }}-${{ matrix.go }}-${{ matrix.os }}-${{ matrix.godebug }}.bin" |
| 38 |
path: "./staticcheck.bin" |
| 39 |
retention-days: 1 |
| 40 |
if-no-files-found: warn |
| 41 |
output: |
| 42 |
name: "Output Staticcheck findings" |
| 43 |
needs: ci |
| 44 |
runs-on: "ubuntu-latest" |
| 45 |
steps: |
| 46 |
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 |
| 47 |
with: |
| 48 |
go-version: "stable" |
| 49 |
# this downloads all artifacts of the current workflow into the current working directory, creating one directory per artifact |
| 50 |
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
| 51 |
- id: glob |
| 52 |
run: | |
| 53 |
# We replace newlines with %0A, which GitHub apparently magically turns back into newlines |
| 54 |
out=$(ls -1 ./staticcheck-*.bin/*.bin) |
| 55 |
echo "::set-output name=files::${out//$'\n'/%0A}" |
| 56 |
- uses: dominikh/staticcheck-action@9716614d4101e79b4340dd97b10e54d68234e431 # v1.4.1 |
| 57 |
with: |
| 58 |
install-go: false |
| 59 |
version: "master" |
| 60 |
merge-files: ${{ steps.glob.outputs.files }} |