crabbox/.github/workflows/ci.yml
2026-05-04 22:49:23 +01:00

143 lines
2.8 KiB
YAML

name: CI
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
permissions:
contents: read
env:
GOFLAGS: -mod=readonly -trimpath
GOTOOLCHAIN: local
jobs:
go:
name: Go
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Check out
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: false
- name: Check formatting
shell: bash
run: |
mapfile -t files < <(git ls-files '*.go')
if [ "${#files[@]}" -gt 0 ]; then
diff="$(gofmt -l "${files[@]}")"
if [ -n "$diff" ]; then
echo "$diff"
exit 1
fi
fi
- name: Vet
run: go vet ./...
- name: Test
run: go test -race ./...
- name: Coverage
run: scripts/check-go-coverage.sh 85.0
- name: Build
run: go build -trimpath -o /tmp/crabbox ./cmd/crabbox
worker:
name: Worker
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Check out
uses: actions/checkout@v6
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
cache-dependency-path: worker/package-lock.json
- name: Install
run: npm ci
working-directory: worker
- name: Format
run: npm run format:check
working-directory: worker
- name: Lint
run: npm run lint
working-directory: worker
- name: Typecheck
run: npm run check
working-directory: worker
- name: Test
run: npm test
working-directory: worker
- name: Build
run: npm run build
working-directory: worker
docs:
name: Docs
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Check out
uses: actions/checkout@v6
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: 24
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: false
- name: Check docs
run: npm run docs:check
release-check:
name: Release Check
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Check out
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: false
- name: Snapshot release build
uses: goreleaser/goreleaser-action@v7
with:
distribution: goreleaser
version: "~> v2"
args: release --snapshot --clean --skip=publish