no not-spam marker #2150
Workflow file for this run
This file contains 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 Integration Tests (Playright) | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
branches: | |
- 'main' | |
concurrency: | |
# Cancel previous job | |
group: integration_tests-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
integration-tests: | |
runs-on: ubuntu-latest | |
environment: testing_env | |
env: | |
DATABASE_URL: "postgres://postgres:postgres@localhost:5432/test_metaculus" | |
AWS_STORAGE_BUCKET_NAME: ${{ vars.AWS_STORAGE_BUCKET_NAME }} | |
AWS_S3_REGION_NAME: ${{ vars.AWS_S3_REGION_NAME }} | |
FRONTEND_BASE_URL: ${{ vars.FRONTEND_BASE_URL }} | |
NEXT_PUBLIC_APP_URL: ${{ vars.NEXT_PUBLIC_APP_URL }} | |
NODE_ENV: "production" | |
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: "bitnami/redis:7.2.5" | |
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 | |
virtualenvs-in-project: true | |
installer-parallel: 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: Install Playwright deps | |
# if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: PLAYWRIGHT_BROWSERS_PATH=.venv poetry run python -m playwright install chromium --with-deps | |
- name: Restore the min DB for testing | |
run: | | |
wget https://github.com/Metaculus/metaculus/releases/download/v0.0.1-alpha/test_metaculus.sql.zip | |
unzip test_metaculus.sql.zip | |
psql $DATABASE_URL -c "CREATE EXTENSION vector;" | |
pg_restore --dbname=$DATABASE_URL \ | |
--clean \ | |
--no-privileges \ | |
--no-owner \ | |
--if-exists \ | |
--schema=public \ | |
test_metaculus.sql | |
- name: "Install Node" | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "npm" | |
cache-dependency-path: front_end/package-lock.json | |
- name: "Install node_modules and build the frontend" | |
run: cd front_end && npm ci && npm run build | |
- name: Run the integration tests | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
TURNSTILE_SECRET_KEY: ${{ secrets.TURNSTILE_SECRET_KEY }} | |
NEXT_PUBLIC_TURNSTILE_SITE_KEY: ${{ secrets.NEXT_PUBLIC_TURNSTILE_SITE_KEY }} | |
SECRET_KEY: ${{ secrets.SECRET_KEY }} | |
run: | | |
poetry run ./manage.py migrate | |
PLAYWRIGHT_BROWSERS_PATH=.venv scripts/tests/run_integration_tests.sh | |
- name: Create trace.zip | |
if: ${{ !cancelled() }} | |
run: | | |
mkdir -p trace && cd trace && unzip ../trace.zip && rm ../trace.zip | |
# Uncomment this to stop the job at this spot, and get a remote shell into the VM | |
# - name: Get tty-share | |
# if: always() | |
# run: | | |
# curl -L https://github.com/elisescu/tty-share/releases/download/v2.4.0/tty-share_linux-amd64 -o tty-share | |
# chmod u+x ./tty-share | |
# export TERM=xterm-256color | |
# ./tty-share -A --public --headless --headless-cols 255 --headless-rows 50 --no-wait --listen :8001 | |
- name: "Upload trace.zip" | |
uses: actions/upload-artifact@v4 | |
if: ${{ !cancelled() }} | |
with: | |
if-no-files-found: error | |
retention-days: 90 | |
name: playwright-trace | |
path: trace/ |