Files

56 lines
1.3 KiB
YAML

name: CI
on:
push:
branches: ["master"]
pull_request:
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
test:
name: Build, vet & test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: "1.23"
- name: gofmt
run: |
out="$(gofmt -l .)"
if [ -n "$out" ]; then
echo "gofmt would reformat:"
echo "$out"
exit 1
fi
- name: go vet
run: go vet ./...
- name: go build
run: go build ./...
- name: go test
run: go test ./...
- name: staticcheck
uses: dominikh/staticcheck-action@9716614d4101e79b4340dd97b10e54d68234e431 # v1.4.1
with:
version: latest
# Staticcheck itself needs a newer Go than the 1.23 this repo
# targets (go.mod's floor) - let the action install its own,
# separate from the "Set up Go" step above. min-go-version
# defaults to reading go.mod, so diagnostics still target 1.23.
install-go: true