chore: transition to single-account system and migrate legacy data #13
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 - Master Gate and Post-Merge | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| push: | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ci-master-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| changes: | |
| name: Detect changed paths | |
| runs-on: ubuntu-latest | |
| outputs: | |
| docs: ${{ steps.filter.outputs.docs }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Path filter | |
| id: filter | |
| uses: dorny/paths-filter@v3 | |
| with: | |
| filters: | | |
| docs: | |
| - docs/** | |
| - mkdocs.yml | |
| - README.md | |
| - index.html | |
| backend-smoke: | |
| name: Backend smoke checks | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| cache: pip | |
| - name: Install backend dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install -r requirements.txt | |
| - name: Smoke test health and core API | |
| shell: pwsh | |
| run: | | |
| @' | |
| from src.database.database import init_db | |
| from src.api.api_server import create_app | |
| init_db() | |
| app = create_app(None) | |
| client = app.test_client() | |
| health = client.get('/api/health') | |
| assert health.status_code == 200, f"/api/health failed: {health.status_code}" | |
| assert health.get_json().get('status') == 'running', f"Unexpected health payload: {health.get_data(as_text=True)}" | |
| dates = client.get('/api/available-dates') | |
| assert dates.status_code == 200, f"/api/available-dates failed: {dates.status_code}" | |
| print('Backend smoke checks passed.') | |
| '@ | python - | |
| - name: Run backend tests if present | |
| shell: pwsh | |
| run: | | |
| $hasTests = $false | |
| if (Test-Path tests) { | |
| $found = Get-ChildItem tests -Recurse -Include "test_*.py","*_test.py" -ErrorAction SilentlyContinue | Select-Object -First 1 | |
| if ($found) { $hasTests = $true } | |
| } | |
| if (-not $hasTests) { | |
| $foundSrc = Get-ChildItem src -Recurse -Include "test_*.py","*_test.py" -ErrorAction SilentlyContinue | Select-Object -First 1 | |
| if ($foundSrc) { $hasTests = $true } | |
| } | |
| if ($hasTests) { | |
| python -m pip install pytest | |
| python -m pytest -q | |
| } | |
| else { | |
| Write-Host "No backend tests found. Skipping pytest." | |
| } | |
| frontend-ci: | |
| name: Frontend lint and build | |
| runs-on: windows-latest | |
| defaults: | |
| run: | |
| working-directory: frontend | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: npm | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install frontend dependencies | |
| run: npm ci | |
| - name: Run lint | |
| run: npm run lint | |
| - name: Build frontend | |
| run: npm run build | |
| - name: Run frontend tests if script exists | |
| shell: pwsh | |
| run: | | |
| $pkg = Get-Content package.json | ConvertFrom-Json | |
| $hasTestScript = $pkg.scripts.PSObject.Properties.Name -contains "test" | |
| if ($hasTestScript) { | |
| npm test -- --run | |
| } | |
| else { | |
| Write-Host "No frontend test script found. Skipping frontend tests." | |
| } | |
| docs-build: | |
| name: Docs build (docs changes only) | |
| needs: changes | |
| if: needs.changes.outputs.docs == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| cache: pip | |
| - name: Install docs dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install mkdocs mkdocs-material pymdown-extensions | |
| - name: Build docs | |
| run: python -m mkdocs build --strict --site-dir site |