Repository navigation
ci: gpu-e2e 改用 setup-chrome(apt 装 Google Chrome 在 runner 上已失效) #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| jobs: | |
| build-and-unit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - name: Type check | |
| run: pnpm exec tsc --noEmit | |
| - name: Build (ESM / CJS / IIFE + dts) | |
| run: pnpm build | |
| - name: Unit tests | |
| run: pnpm test | |
| gpu-e2e: | |
| # End-to-end tests on a real (software) GPU: Chrome + SwiftShader Vulkan + xvfb, | |
| # the exact stack the local `pnpm test:gpu` uses. | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| # Chrome from the official action: the previous `apt install google-chrome-stable` | |
| # path broke on current runners (repo/signature churn). This one is pinned and | |
| # always yields a working binary. | |
| - name: Install Chrome | |
| id: chrome | |
| uses: browser-actions/setup-chrome@v1 | |
| - name: Install xvfb | |
| run: | | |
| if command -v xvfb-run >/dev/null 2>&1; then | |
| echo "xvfb already present" | |
| else | |
| sudo apt-get update -qq | |
| sudo apt-get install -y -qq xvfb | |
| fi | |
| - name: Build browser bundle | |
| run: pnpm build | |
| - name: GPU end-to-end tests (SwiftShader) | |
| env: | |
| MOXWEBGPU_CHROME: ${{ steps.chrome.outputs.chrome-path }} | |
| run: | | |
| CHROME="${{ steps.chrome.outputs.chrome-path }}" | |
| CHROME_DIR="$(dirname "$CHROME")" | |
| # Chrome ships a SwiftShader Vulkan ICD next to the binary; point Vulkan | |
| # at it so WebGPU has a (software) adapter to talk to. | |
| for icd in \ | |
| "$CHROME_DIR/vk_swiftshader_icd.json" \ | |
| "$CHROME_DIR/../vk_swiftshader_icd.json" \ | |
| "$CHROME_DIR/../../vk_swiftshader_icd.json"; do | |
| if [ -f "$icd" ]; then export VK_ICD_FILENAMES="$icd"; break; fi | |
| done | |
| echo "chrome = $CHROME" | |
| echo "VK_ICD_FILENAMES = ${VK_ICD_FILENAMES:-<unset, relying on Chrome fallback>}" | |
| "$CHROME" --version | |
| pnpm test:gpu |