Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ test --test_timeout=120,600,1800,3600
# GF_RBE_CHROMIUM_EXECUTABLE). No hardcoded value: an absent var lets
# the run-*-bazel.mjs candidate scan handle system chromium paths.
test --test_env=GF_RBE_CHROMIUM_EXECUTABLE
test --test_env=PLAYWRIGHT_TRACE_MODE
# Undeclared test outputs (Playwright traces/screenshots) are zipped into a single
# test.outputs/outputs.zip; Bazel 8's unzipped tree-artifact default refused the
# directory (spec names carry non-ASCII) on run 33203042020.
test --zip_undeclared_test_outputs

build:local --disk_cache=~/.cache/bazel-jesssullivan-github-io

Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ jobs:
GF_BAZEL_HOST_JVM_MAX_HEAP_MB: '2560'
GF_REAPI_TOKEN_EXCHANGE_REQUEST: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && 'cache-write' || 'cache-read' }}
GF_REAPI_TOKEN_EXCHANGE_TTL: 45m
# Keep Playwright traces for failed specs; the config routes them into
# Bazel's undeclared outputs so the evidence step below can upload them.
PLAYWRIGHT_TRACE_MODE: retain-on-failure
# The GF consumer registry records this repo as shared-cache-backed.
# Clear any executor endpoint inherited from the generic ARC pod.
BAZEL_REMOTE_EXECUTOR: ''
Expand Down Expand Up @@ -155,6 +158,30 @@ jobs:
npm run remote:e2e:public
bash scripts/bazel-cache-backed.sh shutdown

- name: Collect e2e evidence
if: always()
run: |
set -euo pipefail
mkdir -p artifacts/playwright-e2e
if [[ -d bazel-testlogs/playwright_chromium_e2e ]]; then
cp -RL bazel-testlogs/playwright_chromium_e2e/. artifacts/playwright-e2e/
if [[ -f artifacts/playwright-e2e/test.outputs/outputs.zip ]]; then
(cd artifacts/playwright-e2e && unzip -oq test.outputs/outputs.zip -d undeclared-outputs) || true
fi
find artifacts/playwright-e2e -type f | head -50
else
echo "no bazel-testlogs/playwright_chromium_e2e directory (e2e did not run)" | tee artifacts/playwright-e2e/NO-RUN.txt
fi

- name: Upload e2e evidence
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: playwright-e2e-${{ github.run_id }}-${{ github.run_attempt }}
path: artifacts/playwright-e2e
if-no-files-found: warn
retention-days: 7

build-and-test:
runs-on: ubuntu-latest
timeout-minutes: 45
Expand Down
8 changes: 8 additions & 0 deletions playwright.bazel.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { join } from 'node:path';
import { defineConfig, devices } from '@playwright/test';

type TraceMode = 'off' | 'on' | 'retain-on-failure' | 'on-first-retry';
Expand All @@ -6,6 +7,12 @@ const chromiumExecutable =
process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH || process.env.GF_RBE_CHROMIUM_EXECUTABLE || process.env.CHROME_BIN;
const traceMode = parseTraceMode(process.env.PLAYWRIGHT_TRACE_MODE);
const e2ePort = parsePort(process.env.PLAYWRIGHT_E2E_PORT);
// Under `bazel test` the sandbox is discarded; anything worth keeping (traces,
// screenshots, error contexts) must land in TEST_UNDECLARED_OUTPUTS_DIR so Bazel
// zips it into bazel-testlogs/<target>/test.outputs/outputs.zip.
const outputDir = process.env.TEST_UNDECLARED_OUTPUTS_DIR
? join(process.env.TEST_UNDECLARED_OUTPUTS_DIR, 'playwright')
: 'test-results';

if (!chromiumExecutable) {
throw new Error(
Expand All @@ -15,6 +22,7 @@ if (!chromiumExecutable) {

export default defineConfig({
testDir: 'e2e',
outputDir,
timeout: 30_000,
fullyParallel: true,
forbidOnly: true,
Expand Down
Loading