| 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.23.x"] |
| 12 |
godebug: ["gotypesalias=0", "gotypesalias=1"] |
| 13 |
runs-on: ${{ matrix.os }} |
| 14 |
steps: |
| 15 |
- uses: actions/checkout@v1 |
| 16 |
with: |
| 17 |
fetch-depth: 1 |
| 18 |
- uses: WillAbides/[email protected] |
| 19 |
with: |
| 20 |
go-version: ${{ matrix.go }} |
| 21 |
- run: "go test ./..." |
| 22 |
env: |
| 23 |
GODEBUG: ${{ matrix.godebug }} |
| 24 |
- run: "go vet ./..." |
| 25 |
- uses: dominikh/staticcheck-action@v1 |
| 26 |
with: |
| 27 |
version: "2024.1.1" |
| 28 |
min-go-version: "module" |
| 29 |
install-go: false |
| 30 |
cache-key: ${{ matrix.go }} |
| 31 |
output-format: binary |
| 32 |
output-file: "./staticcheck.bin" |
| 33 |
- uses: actions/upload-artifact@v4 |
| 34 |
with: |
| 35 |
name: "staticcheck-${{ github.sha }}-${{ matrix.go }}-${{ matrix.os }}-${{ matrix.godebug }}.bin" |
| 36 |
path: "./staticcheck.bin" |
| 37 |
retention-days: 1 |
| 38 |
if-no-files-found: warn |
| 39 |
output: |
| 40 |
name: "Output Staticcheck findings" |
| 41 |
needs: ci |
| 42 |
runs-on: "ubuntu-latest" |
| 43 |
steps: |
| 44 |
- uses: WillAbides/[email protected] |
| 45 |
with: |
| 46 |
go-version: "stable" |
| 47 |
# this downloads all artifacts of the current workflow into the current working directory, creating one directory per artifact |
| 48 |
- uses: actions/download-artifact@v4 |
| 49 |
- id: glob |
| 50 |
run: | |
| 51 |
# We replace newlines with %0A, which GitHub apparently magically turns back into newlines |
| 52 |
out=$(ls -1 ./staticcheck-*.bin/*.bin) |
| 53 |
echo "::set-output name=files::${out//$'\n'/%0A}" |
| 54 |
- uses: dominikh/staticcheck-action@v1 |
| 55 |
with: |
| 56 |
install-go: false |
| 57 |
merge-files: ${{ steps.glob.outputs.files }} |