ci: add cross-platform E2E and smoke test support (Linux/macOS/Windows) (#411)

* ci: add cross-platform support for E2E and smoke tests

Make headed browser tests (E2E and smoke) runnable on Linux, macOS,
and Windows:

- setup-chrome action: only install xvfb on Linux (macOS/Windows
  have native GUI sessions and don't need a virtual display)
- e2e-headed.yml: add OS matrix, use xvfb-run wrapper only on Linux
- ci.yml smoke-test: add OS matrix, use xvfb-run wrapper only on Linux

The browser-actions/setup-chrome action already supports all three
platforms natively.

* ci: exclude Windows from E2E/smoke matrix (Chrome install hangs)

browser-actions/setup-chrome hangs indefinitely during Chrome MSI
installation on Windows runners (observed 10+ min with no progress).
This is a known limitation of Windows CI runners.

Keep Linux + macOS for headed browser tests. Windows is still covered
by build, unit-test, and adapter-test jobs.
This commit is contained in:
AlexYue
2026-03-25 14:35:24 +08:00
committed by GitHub
parent 594ad50949
commit a9571b196f
3 changed files with 38 additions and 10 deletions
+5 -4
View File
@@ -1,5 +1,5 @@
name: Setup Chrome + xvfb
description: Install real Chrome and xvfb virtual display for headed browser testing
name: Setup Chrome
description: Install real Chrome for browser testing (with xvfb on Linux)
outputs:
chrome-path:
@@ -19,8 +19,9 @@ runs:
shell: bash
run: |
echo "Chrome path: ${{ steps.setup-chrome.outputs.chrome-path }}"
${{ steps.setup-chrome.outputs.chrome-path }} --version
"${{ steps.setup-chrome.outputs.chrome-path }}" --version
- name: Install xvfb for headed mode
- name: Install xvfb (Linux only)
if: runner.os == 'Linux'
shell: bash
run: sudo apt-get install -y xvfb
+17 -3
View File
@@ -86,7 +86,13 @@ jobs:
smoke-test:
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
needs: build
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# NOTE: Windows excluded — browser-actions/setup-chrome hangs during
# Chrome MSI installation on Windows runners (known issue).
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v6
@@ -98,17 +104,25 @@ jobs:
- name: Install dependencies
run: npm ci
- name: Setup Chrome + xvfb
- name: Setup Chrome
uses: ./.github/actions/setup-chrome
id: setup-chrome
- name: Build
run: npm run build
- name: Run smoke tests
- name: Run smoke tests (Linux, via xvfb)
if: runner.os == 'Linux'
run: |
xvfb-run --auto-servernum --server-args="-screen 0 1280x720x24" \
npx vitest run tests/smoke/ --reporter=verbose
env:
OPENCLI_BROWSER_EXECUTABLE_PATH: ${{ steps.setup-chrome.outputs.chrome-path }}
- name: Run smoke tests (macOS / Windows)
if: runner.os != 'Linux'
run: npx vitest run tests/smoke/ --reporter=verbose
env:
OPENCLI_BROWSER_EXECUTABLE_PATH: ${{ steps.setup-chrome.outputs.chrome-path }}
timeout-minutes: 15
+16 -3
View File
@@ -33,7 +33,13 @@ concurrency:
jobs:
e2e-headed:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# NOTE: Windows excluded — browser-actions/setup-chrome hangs during
# Chrome MSI installation on Windows runners (known issue).
os: [ubuntu-latest, macos-latest]
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
@@ -46,16 +52,23 @@ jobs:
- name: Install dependencies
run: npm ci
- name: Setup Chrome + xvfb
- name: Setup Chrome
uses: ./.github/actions/setup-chrome
id: setup-chrome
- name: Build
run: npm run build
- name: Run E2E tests (headed Chrome + xvfb)
- name: Run E2E tests (Linux, via xvfb)
if: runner.os == 'Linux'
run: |
xvfb-run --auto-servernum --server-args="-screen 0 1280x720x24" \
npx vitest run tests/e2e/ --reporter=verbose
env:
OPENCLI_BROWSER_EXECUTABLE_PATH: ${{ steps.setup-chrome.outputs.chrome-path }}
- name: Run E2E tests (macOS / Windows)
if: runner.os != 'Linux'
run: npx vitest run tests/e2e/ --reporter=verbose
env:
OPENCLI_BROWSER_EXECUTABLE_PATH: ${{ steps.setup-chrome.outputs.chrome-path }}