Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.

remove dependabot (#6209) #6678

remove dependabot (#6209)

remove dependabot (#6209) #6678

Workflow file for this run

name: Playwright E2E Tests
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
push:
branches:
- main
env:
LOG_LEVEL: ERROR
STATIC_DIR: ""
DATABASE_HOSTNAME: localhost
DATABASE_CREDENTIALS: dispatch:dispatch
DISPATCH_ENCRYPTION_KEY: NJHDWDJ3PbHT8h
DISPATCH_JWT_SECRET: foo
jobs:
# Job to determine if e2e tests should run
should-run-e2e:
runs-on: ubuntu-latest
outputs:
run-tests: ${{ steps.check.outputs.run-tests }}
steps:
- name: Check out Git repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if e2e tests should run
id: check
run: |
# Skip if draft PR
if [[ "${{ github.event.pull_request.draft }}" == "true" ]]; then
echo "Skipping e2e tests: Draft PR"
echo "run-tests=false" >> $GITHUB_OUTPUT
exit 0
fi
# Skip if only docs changed
if git diff --name-only origin/${{ github.base_ref }}..HEAD | grep -v -E '^(docs/|.*\.md$|.*\.mdx$|LICENSE|.*\.txt$)' | wc -l | grep -q '^0$'; then
echo "Skipping e2e tests: Documentation-only changes"
echo "run-tests=false" >> $GITHUB_OUTPUT
exit 0
fi
# Skip if only backend tests changed
if git diff --name-only origin/${{ github.base_ref }}..HEAD | grep -v -E '^(tests/(?!static/e2e)|.*test.*\.py$)' | wc -l | grep -q '^0$'; then
echo "Skipping e2e tests: Test-only changes"
echo "run-tests=false" >> $GITHUB_OUTPUT
exit 0
fi
# Skip if only backend-only changes (no frontend impact)
if git diff --name-only origin/${{ github.base_ref }}..HEAD | grep -v -E '^(src/dispatch/(?!static)|tests/(?!static)|\.github/workflows/(?!playwright)|requirements.*\.txt|setup\.py|pyproject\.toml|\.python-version|Dockerfile|docker/)' | wc -l | grep -q '^0$'; then
echo "Skipping e2e tests: Backend-only changes"
echo "run-tests=false" >> $GITHUB_OUTPUT
exit 0
fi
# Skip if labeled with skip-e2e
if echo '${{ toJson(github.event.pull_request.labels.*.name) }}' | grep -q 'skip-e2e'; then
echo "Skipping e2e tests: skip-e2e label found"
echo "run-tests=false" >> $GITHUB_OUTPUT
exit 0
fi
echo "Running e2e tests: Frontend or critical changes detected"
echo "run-tests=true" >> $GITHUB_OUTPUT
end-to-end:
needs: should-run-e2e
if: needs.should-run-e2e.outputs.run-tests == 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
services:
postgres:
image: postgres
env:
POSTGRES_USER: dispatch
POSTGRES_PASSWORD: dispatch
POSTGRES_DB: dispatch
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11.11
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
export DISPATCH_LIGHT_BUILD=1
uv venv
source .venv/bin/activate
uv pip install psycopg[binary]
uv pip install -e ".[dev]"
- name: Install npm dependencies
run: |
npm ci -D --prefix src/dispatch/static/dispatch
npm ci
- name: Install playwright browsers
run: npx playwright install --with-deps chromium
- name: Setup sample database
run: |
source .venv/bin/activate
dispatch database restore --dump-file data/dispatch-sample-data.dump --skip-check && dispatch database upgrade
- name: Run tests
run: |
source .venv/bin/activate
npx playwright test --project=chromium --shard=${{ matrix.shard }}/4
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report-shard-${{ matrix.shard }}
path: playwright-report/
retention-days: 30
# Summary job for required checks
e2e-tests-complete:
runs-on: ubuntu-latest
needs: [should-run-e2e, end-to-end]
if: always()
steps:
- name: Check e2e test results
run: |
if [[ "${{ needs.should-run-e2e.outputs.run-tests }}" == "false" ]]; then
echo "✅ E2E tests skipped (not needed for this change)"
exit 0
elif [[ "${{ needs.end-to-end.result }}" == "success" ]]; then
echo "✅ E2E tests passed"
exit 0
else
echo "❌ E2E tests failed"
exit 1
fi