mirror of
https://github.com/jackwener/OpenCLI.git
synced 2026-09-14 18:25:42 +08:00
a9571b196f
* 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.
129 lines
3.2 KiB
YAML
129 lines
3.2 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main, dev]
|
|
pull_request:
|
|
branches: [main, dev]
|
|
schedule:
|
|
- cron: '0 8 * * 1' # Weekly Monday 08:00 UTC — smoke tests
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ci-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
# ── Fast gate: typecheck + build ──
|
|
build:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version: '22'
|
|
cache: 'npm'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Type check
|
|
run: npx tsc --noEmit
|
|
|
|
- name: Build
|
|
run: npm run build
|
|
|
|
# ── Unit tests (vitest shard) ──
|
|
unit-test:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
node-version: ['20', '22']
|
|
shard: [1, 2]
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: 'npm'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Run unit tests (Node ${{ matrix.node-version }}, shard ${{ matrix.shard }}/2)
|
|
run: npm test -- --reporter=verbose --shard=${{ matrix.shard }}/2
|
|
|
|
adapter-test:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
needs: build
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version: '22'
|
|
cache: 'npm'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Run focused adapter tests
|
|
run: npm run test:adapter -- --reporter=verbose
|
|
|
|
# ── Smoke tests (scheduled / manual only) ──
|
|
smoke-test:
|
|
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
|
|
needs: build
|
|
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
|
|
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version: '22'
|
|
cache: 'npm'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Setup Chrome
|
|
uses: ./.github/actions/setup-chrome
|
|
id: setup-chrome
|
|
|
|
- name: Build
|
|
run: npm run build
|
|
|
|
- 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
|
|
|