Use provider-local SQL and Go migrations, injected slog logging, and PostgreSQL session locking. Exercise timestamp migration flows and failures with SQLite and PostgreSQL, including concurrent startup, and require PostgreSQL integration coverage in CI. Refs #7
58 lines
2.4 KiB
YAML
58 lines
2.4 KiB
YAML
name: ci
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths-ignore:
|
|
# Keep embedded Markdown templates in CI; paths-ignore cannot undo a match.
|
|
- "*.md"
|
|
- "docs/**"
|
|
pull_request:
|
|
paths-ignore:
|
|
- "*.md"
|
|
- "docs/**"
|
|
|
|
jobs:
|
|
check:
|
|
runs-on: ubuntu-latest
|
|
services:
|
|
postgres:
|
|
image: postgres:18
|
|
env:
|
|
POSTGRES_PASSWORD: migrate-test
|
|
POSTGRES_DB: migrate_test
|
|
options: >-
|
|
--health-cmd "pg_isready -U postgres -d migrate_test"
|
|
--health-interval 5s
|
|
--health-timeout 5s
|
|
--health-retries 10
|
|
steps:
|
|
- uses: actions/checkout@v7.0.1
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: actions/setup-go@v7.0.0
|
|
with:
|
|
go-version-file: go.mod
|
|
- name: gofmt
|
|
run: test -z "$(gofmt -l .)"
|
|
- run: go vet ./...
|
|
- run: go test -race ./...
|
|
env:
|
|
CI: "true"
|
|
MIGRATE_POSTGRES_DSN: postgres://postgres:migrate-test@postgres:5432/migrate_test?sslmode=disable
|
|
- name: Require issue URLs in TODO comments
|
|
run: |
|
|
find . -type d \( -name .git -o -name node_modules -o -name vendor -o -name generated -o -name gen -o -name target -o -name dist -o -name build -o -name .svelte-kit -o -name .next \) -prune -o -type f \( -name '*.go' -o -name '*.ts' -o -name '*.tsx' -o -name '*.js' -o -name '*.svelte' -o -name '*.rs' -o -name '*.sql' -o -name '*.sh' -o -name '*.proto' -o -name '*.graphql' -o -name '*.yml' -o -name '*.yaml' -o -name '*.toml' \) -exec awk 'match($0, "((^|[^:])[/][/]|[/][*]|(^|[[:space:]])(#|--)|^[[:space:]]*([*]|<!--))") { comment=substr($0, RSTART + RLENGTH); todo=index(comment, "TO" "DO"); if (todo && substr(comment, todo + 4) !~ "https?:[/][/]") { print FILENAME ":" FNR ":" $0; bad=1 } } END { exit bad }' {} + # shortcut: line-based scan can flag comment-like strings and misses multiline issue links, use a parser when these need accurate coverage
|
|
- name: Go lint
|
|
run: go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.15.0 run ./...
|
|
- uses: goreleaser/goreleaser-action@v7.3.0
|
|
with:
|
|
distribution: goreleaser
|
|
version: v2.19.0
|
|
args: check
|
|
- uses: goreleaser/goreleaser-action@v7.3.0
|
|
with:
|
|
distribution: goreleaser
|
|
version: v2.19.0
|
|
args: release --snapshot --clean
|