046857177e
These three jobs run on the host runner, which shares a single workspace. Run concurrently, they race on workspace teardown: ui-test's production build leaves a root-owned ui/frontend/build that a sibling job's (non-root) cleanup cannot remove, which then spuriously fails that job — observed repeatedly on go-unit when it overlapped a ui-test build. Put all three in one global concurrency group (galaxy-host-runner, cancel-in-progress: false) so they run one at a time and never collide. CI becomes more serial but the false failures stop. This also subsumes ui-test's former ui-test-singleton group, which guarded the Playwright :5173 port; the shared group preserves that guarantee.
137 lines
4.7 KiB
YAML
137 lines
4.7 KiB
YAML
name: Tests · UI
|
|
|
|
# UI-side unit and end-to-end tests (Vitest + Playwright). The Go side
|
|
# of the workspace is tested in `go-unit.yaml`. Both workflows can run
|
|
# in parallel for a push that touches Go and UI together.
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- 'ui/**'
|
|
- '.gitea/workflows/ui-test.yaml'
|
|
- '!**/*.md'
|
|
pull_request:
|
|
paths:
|
|
- 'ui/**'
|
|
- '.gitea/workflows/ui-test.yaml'
|
|
- '!**/*.md'
|
|
|
|
# Playwright launches its own `pnpm dev` on :5173, and in host-mode
|
|
# the runner shares the host's port namespace with every other job,
|
|
# so two parallel ui-test runs collide on EADDRINUSE. Serialise via the
|
|
# shared `galaxy-host-runner` concurrency group (also used by go-unit and
|
|
# integration) with queueing — new runs wait their turn instead of
|
|
# cancelling the in-progress one. The shared group additionally avoids the
|
|
# host-workspace teardown race those jobs hit (see go-unit.yaml). New runs
|
|
# wait their turn; cancel-in-progress is explicitly false because Gitea has
|
|
# shown spurious self-cancel behaviour under cancel-in-progress: true even
|
|
# when no other run shares the group.
|
|
concurrency:
|
|
group: galaxy-host-runner
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Set up pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 11.0.7
|
|
# Install pnpm into a per-job directory so concurrent jobs on
|
|
# the shared host runner do not race on the default
|
|
# `~/setup-pnpm` (the self-installer otherwise fails with
|
|
# `ENOTEMPTY` while cleaning a sibling job's install).
|
|
dest: ${{ runner.temp }}/setup-pnpm
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
cache-dependency-path: ui/pnpm-lock.yaml
|
|
|
|
- name: Install npm dependencies
|
|
working-directory: ui
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.work
|
|
cache: true
|
|
|
|
- name: Build core.wasm
|
|
uses: ./.gitea/actions/build-wasm
|
|
|
|
- name: Install Playwright browsers
|
|
# `--with-deps` would shell out to `sudo apt-get install` for
|
|
# the system .so libraries, which the host-mode runner cannot
|
|
# run non-interactively. The host has the deps installed once,
|
|
# globally; we only need to fetch the browser binaries here.
|
|
# If a future run fails with missing libraries, install them
|
|
# on the host via `pnpm exec playwright install-deps` (one
|
|
# shot, requires sudo).
|
|
working-directory: ui/frontend
|
|
run: pnpm exec playwright install
|
|
|
|
- name: Run Vitest
|
|
working-directory: ui/frontend
|
|
run: pnpm test
|
|
|
|
- name: Clear stale Vite from :5173
|
|
# Defence in depth in case a previous job's webServer survived
|
|
# the concurrency-cancel — `pkill` does not fail when there is
|
|
# nothing to kill, and `fuser -k` cleans up anything else
|
|
# holding the port.
|
|
run: |
|
|
pkill -f 'vite dev' || true
|
|
fuser -k 5173/tcp 2>/dev/null || true
|
|
|
|
- name: Run Playwright
|
|
working-directory: ui/frontend
|
|
run: pnpm exec playwright test
|
|
|
|
- name: Run PWA tests
|
|
# Builds + previews the production bundle (the service worker only
|
|
# precaches a real build) and checks manifest / SW / offline.
|
|
working-directory: ui/frontend
|
|
run: pnpm test:pwa
|
|
|
|
- name: Upload Playwright report on failure
|
|
if: failure()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: playwright-report
|
|
path: ui/frontend/playwright-report/
|
|
retention-days: 14
|
|
|
|
- name: Upload Playwright traces on failure
|
|
if: failure()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: playwright-traces
|
|
path: ui/frontend/test-results/
|
|
retention-days: 14
|
|
|
|
- name: Remove root-owned build artifacts
|
|
if: always()
|
|
# In host-mode the job runs as root, so vite (test:pwa),
|
|
# svelte-kit and Playwright write these outputs root-owned into
|
|
# the shared host workspace. The act_runner (non-root) then
|
|
# cannot remove them at teardown ("unlinkat ... permission
|
|
# denied"), which spuriously fails this or a sibling job that
|
|
# inherits the dirty workspace (observed on go-unit). Clean them
|
|
# here while the step still has root, after the uploads above.
|
|
run: |
|
|
rm -rf ui/frontend/build ui/frontend/.svelte-kit \
|
|
ui/frontend/test-results ui/frontend/playwright-report
|