CI: format, cross-platform vet, staticcheck, tests, race, examples
This commit is contained in:
1 file changed
+59
@@ -0,0 +1,59 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ci-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: ${{ matrix.name }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- { name: macOS, os: macos-latest, skip: "" }
|
||||
# Snapshot goldens exist only for darwin; see docs/compat.md.
|
||||
- { name: Linux, os: ubuntu-latest, skip: "-skip Snapshot" }
|
||||
- { name: Windows, os: windows-latest, skip: "-skip Snapshot" }
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
- name: Format
|
||||
if: runner.os == 'Linux'
|
||||
run: test -z "$(gofmt -l .)" || { gofmt -l .; exit 1; }
|
||||
- name: Build and vet every platform
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
for os in darwin linux windows; do
|
||||
GOOS=$os go build ./...
|
||||
GOOS=$os go vet ./...
|
||||
done
|
||||
- name: Staticcheck
|
||||
if: runner.os == 'Linux'
|
||||
run: go run honnef.co/go/tools/cmd/staticcheck@v0.8.1 ./...
|
||||
- name: Test
|
||||
run: go test ${{ matrix.skip }} ./...
|
||||
- name: Race
|
||||
if: runner.os != 'Windows'
|
||||
run: go test -race ${{ matrix.skip }} ./...
|
||||
- name: Examples compile
|
||||
run: go build ./examples/...
|
||||
- name: Upload snapshot diffs
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v5
|
||||
with:
|
||||
name: snapshot-diffs-${{ matrix.name }}
|
||||
path: testdata/snapshots/**/*.got.png
|
||||
if-no-files-found: ignore
|
||||
Reference in new issue
Block a user