38 lines
1.3 KiB
YAML
38 lines
1.3 KiB
YAML
name: Foundry Go checks
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
check:
|
|
runs-on: ces-control
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
cache: false
|
|
- name: Check formatting, test and build
|
|
run: |
|
|
set -eu
|
|
test -z "$(gofmt -l cmd internal)"
|
|
go test -mod=readonly ./...
|
|
go build -mod=readonly -o bin/foundry ./cmd/foundry
|
|
- name: Verify schema migration in an isolated database
|
|
run: bash deploy/check-schema.sh
|
|
- name: Smoke test HTTP routes
|
|
env:
|
|
PUBLIC_ORIGIN: https://api.example.com
|
|
DATABASE_URL: postgres://foundry:fixture@127.0.0.1:5432/foundry
|
|
GOOGLE_CLIENT_ID: fixture
|
|
GOOGLE_CLIENT_SECRET: fixture
|
|
FOUNDRY_PROJECTS: '{"notes":"http://localhost:3000/auth/callback"}'
|
|
PORT: '18080'
|
|
run: |
|
|
set -eu
|
|
./bin/foundry &
|
|
server_pid=$!
|
|
trap 'kill "$server_pid" 2>/dev/null || true' EXIT
|
|
curl --silent --show-error --fail --retry 5 --retry-connrefused http://127.0.0.1:18080/healthz
|
|
status=$(curl --silent --show-error -o /dev/null -w '%{http_code}' http://127.0.0.1:18080/projects/notes/auth/me)
|
|
test "$status" = 401
|