Fix CI: pytest run needs python -m for app on path, tests/ needs __in… #2
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
| # Runs the test suites that the README's badges report on. | |
| # | |
| # Both jobs are deliberately hermetic: no secrets, no .env file, no network | |
| # services. The backend suite pins its own database (SQLite), auth secrets and | |
| # Stripe mock keys in tests/conftest.py, so a clean checkout is all it needs. | |
| name: Tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| backend: | |
| name: Backend (pytest) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| cache: pip | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| # pytest.ini already enables --cov=app and enforces --cov-fail-under=60, | |
| # so a coverage regression fails this job. | |
| - name: Run pytest with coverage | |
| run: python -m pytest | |
| frontend: | |
| name: Frontend (jest) | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: frontend | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: npm | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run jest | |
| run: npm run test:ci |