341 lines
11 KiB
YAML
341 lines
11 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- main
|
|
merge_group:
|
|
types:
|
|
- checks_requested
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
api:
|
|
name: API contracts
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 20
|
|
steps:
|
|
- name: Check out source
|
|
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
|
|
with:
|
|
node-version-file: frontend/.node-version
|
|
cache: npm
|
|
cache-dependency-path: api/package-lock.json
|
|
- name: Set up Go
|
|
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
|
|
with:
|
|
go-version-file: backend/go.mod
|
|
cache: true
|
|
cache-dependency-path: backend/go.sum
|
|
- name: Set up Python
|
|
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
|
|
with:
|
|
python-version-file: ml/.python-version
|
|
cache: pip
|
|
cache-dependency-path: scripts/requirements-codegen.txt
|
|
- name: Install API tooling
|
|
run: make -C api install
|
|
- name: Check API formatting and compatibility
|
|
run: make -C api fmt-check verify
|
|
- name: Check compatibility with the pull request base
|
|
if: github.event_name == 'pull_request'
|
|
env:
|
|
API_BASE_REF: ${{ github.event.pull_request.base.sha }}
|
|
run: make -C api check-compat
|
|
|
|
backend:
|
|
name: Go backend
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 30
|
|
steps:
|
|
- name: Check out source
|
|
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
|
with:
|
|
persist-credentials: false
|
|
- name: Set up Go
|
|
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
|
|
with:
|
|
go-version-file: backend/go.mod
|
|
cache: true
|
|
cache-dependency-path: backend/go.sum
|
|
- name: Install Go tools
|
|
run: make -C backend deps
|
|
- name: Check backend
|
|
run: make -C backend check
|
|
- name: Run backend race tests
|
|
run: make -C backend test-race
|
|
|
|
integration:
|
|
name: Integration tests (${{ matrix.shard }}/2)
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 30
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
shard: [1, 2]
|
|
steps:
|
|
- name: Check out source
|
|
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
|
with:
|
|
persist-credentials: false
|
|
- name: Set up Go
|
|
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
|
|
with:
|
|
go-version-file: backend/go.mod
|
|
cache: true
|
|
cache-dependency-path: backend/go.sum
|
|
- name: Install Go dependencies
|
|
run: make -C backend deps
|
|
- name: Run PostgreSQL, Redis, and SeaweedFS integration shard
|
|
env:
|
|
TEST_SHARD_INDEX: ${{ matrix.shard }}
|
|
TEST_SHARD_TOTAL: "2"
|
|
GOFLAGS: -race
|
|
run: make -C backend test-int
|
|
|
|
frontend:
|
|
name: Frontend
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 30
|
|
steps:
|
|
- name: Check out source
|
|
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
|
with:
|
|
persist-credentials: false
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
|
|
with:
|
|
node-version-file: frontend/.node-version
|
|
- name: Install declared pnpm
|
|
run: npm install --global "$(node -p "require('./frontend/package.json').packageManager")"
|
|
- name: Cache pnpm store
|
|
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
|
|
with:
|
|
path: ~/.local/share/pnpm/store
|
|
key: ${{ runner.os }}-pnpm-${{ hashFiles('frontend/pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pnpm-
|
|
- name: Install frontend dependencies
|
|
run: make -C frontend install
|
|
- name: Check frontend
|
|
run: make -C frontend check
|
|
|
|
ml:
|
|
name: ML service
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 30
|
|
steps:
|
|
- name: Check out source
|
|
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
|
with:
|
|
persist-credentials: false
|
|
- name: Set up Python
|
|
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
|
|
with:
|
|
python-version-file: ml/.python-version
|
|
- name: Set up uv
|
|
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
|
|
with:
|
|
version: 0.12.22
|
|
enable-cache: true
|
|
cache-dependency-glob: ml/uv.lock
|
|
- name: Install ML dependencies
|
|
run: make -C ml install
|
|
- name: Check ML service and contract
|
|
run: make -C ml verify
|
|
|
|
codegen:
|
|
name: Generation and drift
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 45
|
|
steps:
|
|
- name: Check out source
|
|
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
|
with:
|
|
persist-credentials: false
|
|
- name: Set up Go
|
|
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
|
|
with:
|
|
go-version-file: backend/go.mod
|
|
cache: true
|
|
cache-dependency-path: backend/go.sum
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
|
|
with:
|
|
node-version-file: frontend/.node-version
|
|
cache: npm
|
|
cache-dependency-path: api/package-lock.json
|
|
- name: Install declared pnpm
|
|
run: npm install --global "$(node -p "require('./frontend/package.json').packageManager")"
|
|
- name: Set up Python
|
|
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
|
|
with:
|
|
python-version-file: ml/.python-version
|
|
cache: pip
|
|
cache-dependency-path: scripts/requirements-codegen.txt
|
|
- name: Set up uv
|
|
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
|
|
with:
|
|
version: 0.12.22
|
|
enable-cache: true
|
|
cache-dependency-glob: ml/uv.lock
|
|
- name: Install project dependencies
|
|
run: make install
|
|
- name: Regenerate and check drift
|
|
run: make generate check-generated
|
|
|
|
infrastructure:
|
|
name: Infrastructure configuration
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 25
|
|
steps:
|
|
- name: Check out source
|
|
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
|
with:
|
|
persist-credentials: false
|
|
- name: Check Compose files
|
|
run: make -C deploy check
|
|
- name: Check observability files
|
|
run: make -C observability check
|
|
- name: Build the separate ML image
|
|
run: make -C deploy ml-build
|
|
|
|
security:
|
|
name: Source security checks
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 30
|
|
steps:
|
|
- name: Check out source and history
|
|
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
- name: Set up Go
|
|
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
|
|
with:
|
|
go-version-file: backend/go.mod
|
|
cache: true
|
|
cache-dependency-path: backend/go.sum
|
|
- name: Set up Python
|
|
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
|
|
with:
|
|
python-version-file: ml/.python-version
|
|
- name: Set up uv
|
|
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
|
|
with:
|
|
version: 0.12.22
|
|
enable-cache: false
|
|
- name: Install security tools
|
|
run: make -C security install
|
|
- name: Check scanner rules and source
|
|
run: make -C security test check
|
|
- name: Upload security reports
|
|
if: ${{ !cancelled() }}
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: security-source-reports
|
|
path: security/reports/
|
|
if-no-files-found: warn
|
|
retention-days: 14
|
|
|
|
security-images:
|
|
name: Container security checks
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 45
|
|
steps:
|
|
- name: Check out source
|
|
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
|
with:
|
|
persist-credentials: false
|
|
- name: Set up Python
|
|
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
|
|
with:
|
|
python-version-file: ml/.python-version
|
|
- name: Install Trivy
|
|
run: make -C security install-trivy
|
|
- name: Build and scan service images
|
|
run: make -C security images
|
|
- name: Upload container security reports
|
|
if: ${{ !cancelled() }}
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: security-image-reports
|
|
path: security/reports/
|
|
if-no-files-found: warn
|
|
retention-days: 14
|
|
|
|
smoke:
|
|
name: Isolated technical smoke
|
|
needs:
|
|
- backend
|
|
- integration
|
|
- frontend
|
|
- infrastructure
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 35
|
|
steps:
|
|
- name: Check out source
|
|
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
|
with:
|
|
persist-credentials: false
|
|
- name: Build and check technical health routes
|
|
run: make -C deploy smoke
|
|
|
|
aggregate:
|
|
name: Required CI result
|
|
if: always()
|
|
needs:
|
|
- api
|
|
- backend
|
|
- integration
|
|
- frontend
|
|
- ml
|
|
- codegen
|
|
- infrastructure
|
|
- smoke
|
|
- security
|
|
- security-images
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- name: Require every CI job to pass
|
|
env:
|
|
API_RESULT: ${{ needs.api.result }}
|
|
BACKEND_RESULT: ${{ needs.backend.result }}
|
|
INTEGRATION_RESULT: ${{ needs.integration.result }}
|
|
FRONTEND_RESULT: ${{ needs.frontend.result }}
|
|
ML_RESULT: ${{ needs.ml.result }}
|
|
CODEGEN_RESULT: ${{ needs.codegen.result }}
|
|
INFRASTRUCTURE_RESULT: ${{ needs.infrastructure.result }}
|
|
SMOKE_RESULT: ${{ needs.smoke.result }}
|
|
SECURITY_RESULT: ${{ needs.security.result }}
|
|
SECURITY_IMAGES_RESULT: ${{ needs.security-images.result }}
|
|
run: |
|
|
printf 'api=%s backend=%s frontend=%s ml=%s codegen=%s infrastructure=%s smoke=%s\n' \
|
|
"$API_RESULT" "$BACKEND_RESULT" "$FRONTEND_RESULT" "$ML_RESULT" \
|
|
"$CODEGEN_RESULT" "$INFRASTRUCTURE_RESULT" "$SMOKE_RESULT"
|
|
test "$API_RESULT" = success
|
|
test "$BACKEND_RESULT" = success
|
|
printf 'integration=%s\n' "$INTEGRATION_RESULT"
|
|
test "$INTEGRATION_RESULT" = success
|
|
test "$FRONTEND_RESULT" = success
|
|
test "$ML_RESULT" = success
|
|
test "$CODEGEN_RESULT" = success
|
|
test "$INFRASTRUCTURE_RESULT" = success
|
|
test "$SMOKE_RESULT" = success
|
|
printf 'security=%s security-images=%s\n' "$SECURITY_RESULT" "$SECURITY_IMAGES_RESULT"
|
|
test "$SECURITY_RESULT" = success
|
|
test "$SECURITY_IMAGES_RESULT" = success
|