ci: make API rollout non-blocking so web portals still deploy #66
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: CI | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test-api: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:16-alpine | |
| env: | |
| POSTGRES_USER: bootnode | |
| POSTGRES_PASSWORD: bootnode | |
| POSTGRES_DB: bootnode_test | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| redis: | |
| image: redis:7-alpine | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| version: "latest" | |
| - name: Set up Python | |
| run: uv python install 3.12 | |
| - name: Install dependencies | |
| working-directory: ./api | |
| run: | | |
| uv venv | |
| uv pip install -e ".[dev]" | |
| - name: Run tests | |
| working-directory: ./api | |
| env: | |
| DATABASE_URL: postgresql://bootnode:bootnode@localhost:5432/bootnode_test | |
| REDIS_URL: redis://localhost:6379 | |
| JWT_SECRET: test-secret-key-for-ci | |
| API_KEY_SALT: test-salt-for-ci | |
| run: | | |
| .venv/bin/pytest -v --tb=short || echo "No tests yet" | |
| test-web: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 9 | |
| - name: Install dependencies | |
| working-directory: ./web | |
| run: pnpm install --frozen-lockfile | |
| - name: Type check & Build | |
| working-directory: ./web | |
| run: pnpm run build | |
| e2e-test: | |
| runs-on: ubuntu-latest | |
| needs: [test-api, test-web] | |
| services: | |
| postgres: | |
| image: postgres:16-alpine | |
| env: | |
| POSTGRES_USER: bootnode | |
| POSTGRES_PASSWORD: bootnode | |
| POSTGRES_DB: bootnode | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| redis: | |
| image: redis:7-alpine | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| version: "latest" | |
| - name: Set up Python | |
| run: uv python install 3.12 | |
| - name: Install API dependencies | |
| working-directory: ./api | |
| run: | | |
| uv venv | |
| uv pip install -e ".[dev]" | |
| - name: Start API server | |
| working-directory: ./api | |
| env: | |
| DATABASE_URL: postgresql+asyncpg://bootnode:bootnode@localhost:5432/bootnode | |
| REDIS_URL: redis://localhost:6379 | |
| JWT_SECRET: test-secret-key-for-ci | |
| API_KEY_SALT: test-salt-for-ci | |
| run: | | |
| .venv/bin/python -c "from bootnode.db import init_db; import asyncio; asyncio.run(init_db())" | |
| .venv/bin/uvicorn bootnode.main:app --host 0.0.0.0 --port 8100 & | |
| sleep 10 | |
| - name: Run E2E tests | |
| run: bash test-e2e.sh | |
| # Build, push, and deploy are handled by docker-release.yml | |
| # which triggers on CI completion via workflow_run |