Server tests #4
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: Server tests | |
| on: | |
| pull_request: | |
| workflow_call: | |
| inputs: | |
| run_integration: | |
| description: "Also run pytest -m integration" | |
| type: boolean | |
| default: false | |
| workflow_dispatch: | |
| inputs: | |
| run_integration: | |
| description: "Also run pytest -m integration" | |
| type: boolean | |
| default: false | |
| schedule: | |
| # Weekly Monday 06:00 UTC — integration suite (mongomock, no Docker services) | |
| - cron: "0 6 * * 1" | |
| jobs: | |
| unit: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: server | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| cache: pip | |
| cache-dependency-path: server/requirements-dev.txt | |
| - name: Install dependencies | |
| run: pip install -r requirements-dev.txt | |
| - name: Run unit tests with coverage | |
| run: | | |
| coverage run -m pytest -m unit -q | |
| coverage report -m | |
| integration: | |
| # schedule: always run integration weekly. | |
| # workflow_dispatch / workflow_call: only when run_integration is true. | |
| if: > | |
| github.event_name == 'schedule' || | |
| ((github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.run_integration) | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: server | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| cache: pip | |
| cache-dependency-path: server/requirements-dev.txt | |
| - name: Install dependencies | |
| run: pip install -r requirements-dev.txt | |
| - name: Run integration tests | |
| run: pytest -m integration -q |