Files
romm/.github/workflows/e2e.yml
Georges-Antoine Assi 6aa1198634 feat(ci): add a vouch and denouncement contribution system (#5835)
* feat(ci): add a vouch and denouncement contribution system

Pull requests from authors who aren't vouched in .github/VOUCHED.td are
closed automatically, and denounced users' issues and pull requests are
closed too. Maintainers manage the list with !vouch, !unvouch and
!denounce comments, which queue changes on a single vouch/updates pull
request, since master is protected.

Adapted from Ghostty's vouch system (ghostty-org/ghostty#10559) with our
own stdlib-only script instead of the mitchellh/vouch actions. Adds a
vouch request issue form, an AI usage policy, and the matching
CONTRIBUTING sections.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ci): keep concurrent vouch commands and close only the vouched request

Addresses Greptile review on #5835:
- Drop the concurrency group, which kept only one waiting run, and retry
  on conflicting commits instead. The pending PR body is rebuilt from the
  branch's commit messages so concurrent runs can't lose a line.
- Only close a vouch request when the vouched user is its author.
- Shorten the module docstring, workflow comments and VOUCHED.td header.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* pr-ready: code-review

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* pr-ready: simplify

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* pr-ready: polish

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* pr-ready: prose

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* pr-ready: simplify code-review fixes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ci): keep the vouch queue when its PR is closed without merging

Only a merged PR resets vouch/updates now. A PR closed to rerun CI keeps
its commits, and the next command reopens it instead of opening a new one.
Deleting the branch drops the queue.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(ci): ask vouch requesters about their development experience

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(ci): tighten the vouch request experience prompt

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(ci): ask vouch requesters what they've built and how they work

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(vouch): vouch for Covin90 and tmgast

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(vouch): vouch for milktoastrat and BrandonKowalski

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 17:12:10 -05:00

173 lines
5.9 KiB
YAML

name: Run E2E Tests
on:
pull_request:
paths:
- "frontend/**"
- "backend/**"
- ".github/workflows/e2e.yml"
- ".github/actions/setup-frontend/**"
- ".github/scripts/seed_e2e_*.py"
- pyproject.toml
- uv.lock
- .python-version
push:
branches:
- "master"
paths:
- "frontend/**"
- "backend/**"
- ".github/workflows/e2e.yml"
- ".github/actions/setup-frontend/**"
- ".github/scripts/seed_e2e_*.py"
- pyproject.toml
- uv.lock
- .python-version
# A new push cancels a PR's superseded run; each master commit keeps its own.
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
e2e:
runs-on: ubuntu-24.04
timeout-minutes: 20
services:
mariadb:
image: mariadb:13.0.2
ports:
- 3306
env:
MYSQL_USER: romm_e2e
MYSQL_PASSWORD: passwd
MYSQL_DATABASE: romm_e2e
MYSQL_ROOT_PASSWORD: passwd
options: --health-cmd="healthcheck.sh --connect --innodb_initialized" --health-interval=5s --health-timeout=2s --health-retries=3 --health-start-period=30s
valkey:
image: valkey/valkey:9.0.8
ports:
- 6379
options: >-
--health-cmd="redis-cli ping" --health-interval=5s --health-timeout=2s --health-retries=3
env:
DEV_PORT: 5000
DB_HOST: 127.0.0.1
DB_NAME: romm_e2e
DB_USER: romm_e2e
DB_PASSWD: passwd
ROMM_DB_DRIVER: mariadb
REDIS_HOST: 127.0.0.1
# Throwaway signing key for an ephemeral runner
ROMM_AUTH_SECRET_KEY: "e2e0000000000000000000000000000000000000000000000000000000000000"
# Fixture-user password, shared by the seeder and the specs
E2E_PASSWORD: e2e-Passw0rd!
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up the backend
uses: ./.github/actions/setup-backend
- name: Set up the frontend
uses: ./.github/actions/setup-frontend
# Builds while the backend is set up; "Wait for the frontend build" checks it.
- name: Start the frontend build
run: |
(
npm run build > "$RUNNER_TEMP/frontend-build.log" 2>&1
echo $? > "$RUNNER_TEMP/frontend-build.tmp"
mv "$RUNNER_TEMP/frontend-build.tmp" "$RUNNER_TEMP/frontend-build.exit"
) &
working-directory: frontend
# Headless runs use only the headless shell, so skip the full Chrome build. The runner
# image already has its system libraries, and --with-deps can hang on a stalled apt mirror.
- name: Install Playwright browser
run: npx playwright install --only-shell chromium
working-directory: frontend
# ROMM_BASE_PATH must be writable (the app creates config/, resources/ and
# assets/ under it), so copy the fixture library out of the repo rather
# than scanning it in place.
- name: Stage the library fixture
env:
MARIADB_PORT: ${{ job.services.mariadb.ports['3306'] }}
VALKEY_PORT: ${{ job.services.valkey.ports['6379'] }}
run: |
mkdir -p "$RUNNER_TEMP/romm/resources" "$RUNNER_TEMP/romm/assets"
cp -R backend/romm_test/library "$RUNNER_TEMP/romm/library"
# The fixture library is laid out platform-folder-first, which its
# config.yml declares.
cp -R backend/romm_test/config "$RUNNER_TEMP/romm/config"
echo "ROMM_BASE_PATH=$RUNNER_TEMP/romm" >> "$GITHUB_ENV"
echo "DB_PORT=$MARIADB_PORT" >> "$GITHUB_ENV"
echo "REDIS_PORT=$VALKEY_PORT" >> "$GITHUB_ENV"
# A migration failure is its own red step rather than a confusing server-start failure.
- name: Apply migrations
run: uv run alembic upgrade head
working-directory: backend
- name: Seed the library
run: uv run python .github/scripts/seed_e2e_library.py
# Seed user and clear the setup wizard
- name: Seed the e2e fixture users
run: uv run python .github/scripts/seed_e2e_users.py
- name: Start the backend
run: |
uv run main.py > "$RUNNER_TEMP/backend.log" 2>&1 &
echo "Waiting for the API to answer..."
for i in $(seq 1 60); do
if curl -sf "http://127.0.0.1:${DEV_PORT}/api/heartbeat" > /dev/null; then
echo "Backend up after ${i}s"
exit 0
fi
sleep 1
done
echo "Backend did not come up; last 100 log lines:"
tail -100 "$RUNNER_TEMP/backend.log"
exit 1
working-directory: backend
- name: Wait for the frontend build
run: |
while [ ! -f "$RUNNER_TEMP/frontend-build.exit" ]; do sleep 2; done
cat "$RUNNER_TEMP/frontend-build.log"
exit "$(cat "$RUNNER_TEMP/frontend-build.exit")"
# Serves that build through playwright.config.ts's webServer.
- name: Run Playwright tests
run: npm run test:e2e
working-directory: frontend
- name: Upload Playwright report
if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: playwright-report
path: |
frontend/e2e/.output/specs/
retention-days: 7
- name: Dump backend log
if: failure()
run: tail -200 "$RUNNER_TEMP/backend.log" || true
# `uv run` holds the uv cache lock for as long as it lives, so leaving the
# backend up makes setup-uv's post-job `uv cache prune` block until the
# runner kills cleanup after 5 minutes, failing an otherwise green job.
- name: Stop the backend
if: always()
run: pkill -f "main.py" || true