Use backend initContainer migrations and remove Spin migration jobs #214
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Backend CI | |
| on: | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - backend/** | |
| - .pre-commit-config.yaml | |
| - .github/workflows/backend-ci.yml | |
| push: | |
| branches: [main] | |
| paths: | |
| - backend/** | |
| - .pre-commit-config.yaml | |
| - .github/workflows/backend-ci.yml | |
| workflow_dispatch: {} | |
| jobs: | |
| backend: | |
| name: Backend checks | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| services: | |
| postgres: | |
| image: postgres:16 | |
| ports: | |
| - 5432:5432 | |
| env: | |
| POSTGRES_USER: simboard | |
| POSTGRES_PASSWORD: simboard | |
| POSTGRES_DB: simboard | |
| options: >- | |
| --health-cmd="pg_isready -U simboard -d simboard" | |
| --health-interval=5s | |
| --health-timeout=5s | |
| --health-retries=5 | |
| env: | |
| # -------------------------------------------------- | |
| # General | |
| # -------------------------------------------------- | |
| ENV: "test" | |
| ENVIRONMENT: "test" | |
| DOMAIN: "localhost" | |
| STACK_NAME: "simboard" | |
| PORT: "8000" | |
| # -------------------------------------------------- | |
| # Frontend (required by backend config) | |
| # -------------------------------------------------- | |
| FRONTEND_ORIGIN: "https://127.0.0.1:5173" | |
| FRONTEND_AUTH_REDIRECT_URL: "https://127.0.0.1:5173/auth/callback" | |
| FRONTEND_ORIGINS: "https://127.0.0.1:5173" | |
| # -------------------------------------------------- | |
| # Database | |
| # -------------------------------------------------- | |
| DATABASE_URL: "postgresql+psycopg://simboard:simboard@localhost:5432/simboard" | |
| TEST_DATABASE_URL: "postgresql+psycopg://simboard:simboard@localhost:5432/simboard_test" | |
| # -------------------------------------------------- | |
| # GitHub OAuth (dummy values for CI) | |
| # -------------------------------------------------- | |
| GITHUB_CLIENT_ID: "dummy" | |
| GITHUB_CLIENT_SECRET: "dummy" | |
| GITHUB_REDIRECT_URL: "http://localhost/api/v1/auth/github/callback" | |
| GITHUB_STATE_SECRET_KEY: "dummy" | |
| # -------------------------------------------------- | |
| # Cookie config | |
| # -------------------------------------------------- | |
| COOKIE_NAME: "simboard_auth" | |
| COOKIE_SECURE: "false" | |
| COOKIE_HTTPONLY: "true" | |
| COOKIE_SAMESITE: "lax" | |
| COOKIE_MAX_AGE: "3600" | |
| steps: | |
| # ------------------------- | |
| # Skip duplicate runs | |
| # ------------------------- | |
| - name: Skip duplicate runs | |
| uses: fkirc/skip-duplicate-actions@v5 | |
| with: | |
| github_token: ${{ github.token }} | |
| skip_after_successful_duplicate: true | |
| cancel_others: true | |
| # ------------------------- | |
| # Checkout | |
| # ------------------------- | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # ------------------------- | |
| # Python | |
| # ------------------------- | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| # ------------------------- | |
| # Install uv | |
| # ------------------------- | |
| - name: Install uv | |
| run: | | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
| # ------------------------- | |
| # Cache uv + dependencies | |
| # ------------------------- | |
| - name: Cache uv cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/uv | |
| key: uv-cache-${{ runner.os }}-${{ hashFiles('backend/uv.lock') }} | |
| restore-keys: | | |
| uv-cache-${{ runner.os }}- | |
| # ------------------------- | |
| # Install backend deps | |
| # ------------------------- | |
| - name: Install backend dependencies | |
| working-directory: backend | |
| run: | | |
| uv venv .venv | |
| uv sync --all-groups | |
| # ------------------------- | |
| # Cache pre-commit | |
| # ------------------------- | |
| - name: Cache pre-commit | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pre-commit | |
| key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }} | |
| # ------------------------- | |
| # Run pre-commit | |
| # ------------------------- | |
| - name: Run pre-commit (backend only) | |
| env: | |
| SKIP: frontend-eslint,frontend-prettier | |
| run: | | |
| uv run --project backend pre-commit run --all-files | |
| # ------------------------- | |
| # Run pytest | |
| # ------------------------- | |
| - name: Run pytest | |
| # NOTE: | |
| # Pytest (and Alembic) must run from the backend directory so relative paths | |
| # like alembic.ini and script_location resolve correctly. `--project` only | |
| # selects the virtualenv; it does not change the working directory. | |
| working-directory: backend | |
| run: | | |
| uv run pytest --strict-markers |