Skip to content

fix: labor hub commentary misalignments vs chart data #7534

fix: labor hub commentary misalignments vs chart data

fix: labor hub commentary misalignments vs chart data #7534

name: Run Integration Tests (Playwright)
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
permissions:
contents: read
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 }}
PUBLIC_APP_URL: http://localhost:3000/
NODE_ENV: "production"
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.playwright
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@v6
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "0.11.x"
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install dependencies
run: uv sync --frozen
- name: Cache Playwright browsers
id: cache-playwright
uses: actions/cache@v5
with:
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
key: playwright-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
playwright-${{ runner.os }}
- name: Install Playwright deps
if: steps.cache-playwright.outputs.cache-hit != 'true'
run: uv 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@v6
with:
node-version-file: front_end/.nvmrc
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v5
with:
path: front_end/node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('front_end/bun.lock', 'front_end/.nvmrc', 'front_end/package.json') }}
- name: Install node_modules
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: cd front_end && bun ci
- name: Build the frontend
run: cd front_end && NODE_OPTIONS=--max-old-space-size=8192 bun run build
- name: Run the integration tests
run: |
uv run ./manage.py migrate
PLAYWRIGHT_BROWSERS_PATH=${PLAYWRIGHT_BROWSERS_PATH} 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/