Deprecated forceIsBot for signup form #5593
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: Run Unit Tests | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| branches: | |
| - "main" | |
| concurrency: | |
| # Cancel previous jobs | |
| group: unit_tests-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| backend-unit-tests: | |
| name: "Backend Checks" | |
| runs-on: ubuntu-latest | |
| environment: testing_env | |
| env: | |
| TEST_DATABASE_URL: "postgres://postgres:postgres@localhost:5432/test_metaculus" | |
| services: | |
| db: | |
| image: pgvector/pgvector:pg16 | |
| env: | |
| POSTGRES_HOST_AUTH_METHOD: trust | |
| POSTGRES_DB: test_metaculus | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| redis: | |
| image: "redis:8.2.1-alpine" | |
| env: | |
| ALLOW_EMPTY_PASSWORD: yes | |
| ports: | |
| - 6379:6379 | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12.3" | |
| - name: Install poetry | |
| uses: snok/install-poetry@v1 | |
| with: | |
| virtualenvs-create: true | |
| installer-parallel: true | |
| virtualenvs-in-project: true | |
| - name: Load cached venv | |
| id: cached-poetry-dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: .venv | |
| key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
| - name: Install dependencies | |
| if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
| run: poetry install --no-interaction --no-root | |
| - name: Check Black formatting | |
| if: ${{ !cancelled() }} | |
| run: poetry run black --check . | |
| - name: Run Flake8 Linter | |
| if: ${{ !cancelled() }} | |
| run: poetry run flake8 . --exclude=front_end,.venv | |
| - name: Check migrations | |
| if: ${{ !cancelled() }} | |
| run: poetry run python manage.py makemigrations --dry-run --check | |
| - name: "Run he backend unit tests" | |
| if: ${{ !cancelled() }} | |
| run: poetry run pytest ./tests/unit | |
| frontend-unit-tests: | |
| name: "Frontend Checks" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: front_end/.nvmrc | |
| cache: npm | |
| cache-dependency-path: front_end/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| working-directory: front_end | |
| - name: prettier version | |
| run: npx prettier -v | |
| working-directory: front_end | |
| - name: check formatting | |
| run: npm run format:check | |
| working-directory: front_end | |
| - name: check linters | |
| run: npm run lint | |
| working-directory: front_end | |
| - name: Run unit tests | |
| run: npm test | |
| working-directory: front_end |