Skip to content

Switch version

Switch version #24

Workflow file for this run

name: CI
on:
# Run on pushes to main (e.g. merges) and on every PR. Limiting push to main
# avoids double runs on branches that also have an open PR.
push:
branches: [main]
pull_request:
# Cancel superseded runs for the same branch/PR to save resources.
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
lint:
name: Lint (gofmt + vet)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Check formatting
run: |
unformatted="$(gofmt -l .)"
if [ -n "$unformatted" ]; then
echo "The following files are not gofmt-formatted:"
echo "$unformatted"
echo "Run: gofmt -w ."
exit 1
fi
- name: go vet
run: go vet ./...
test:
name: Build & test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Build
run: go build ./...
- name: Test
run: go test -race ./...