mirror of
https://github.com/jjbrunton/Sauci.git
synced 2026-10-31 18:19:43 +00:00
84 lines
2.2 KiB
YAML
84 lines
2.2 KiB
YAML
name: Verify
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches: [staging, main]
|
|
|
|
concurrency:
|
|
group: verify-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
branch-policy:
|
|
if: github.event_name == 'pull_request'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Enforce promotion flow
|
|
env:
|
|
BASE_BRANCH: ${{ github.base_ref }}
|
|
HEAD_BRANCH: ${{ github.head_ref }}
|
|
run: |
|
|
if [ "$BASE_BRANCH" = "master" ]; then
|
|
echo "master is frozen; target staging or main" >&2
|
|
exit 1
|
|
fi
|
|
if [ "$BASE_BRANCH" = "main" ] && [ "$HEAD_BRANCH" != "staging" ]; then
|
|
echo "Only staging may be promoted to main" >&2
|
|
exit 1
|
|
fi
|
|
if [ "$BASE_BRANCH" != "staging" ] && [ "$BASE_BRANCH" != "main" ]; then
|
|
echo "Feature pull requests target staging; promotions target main" >&2
|
|
exit 1
|
|
fi
|
|
|
|
static:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: .nvmrc
|
|
cache: npm
|
|
- run: npm ci
|
|
- run: npm run learn:check
|
|
- run: npm run verify:fast
|
|
- run: npm run build
|
|
|
|
backend-integration:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
services:
|
|
postgres:
|
|
image: postgres:17-alpine
|
|
env:
|
|
POSTGRES_DB: sauci_test
|
|
POSTGRES_USER: sauci
|
|
POSTGRES_PASSWORD: sauci_ci_only
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd "pg_isready -U sauci -d sauci_test"
|
|
--health-interval 5s
|
|
--health-timeout 3s
|
|
--health-retries 20
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: .nvmrc
|
|
cache: npm
|
|
- run: npm ci
|
|
- name: Run standalone backend integration tests
|
|
env:
|
|
DATABASE_URL: postgresql://sauci:sauci_ci_only@127.0.0.1:5432/sauci_test
|
|
run: npm run test:api:integration
|
|
|
|
container-contract:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Verify production Compose contract
|
|
run: infra/backend/verify-production.sh
|