Skip to content

Commit 4116478

Browse files
committed
ci: Add WebGPU chart E2E tests to GitHub Actions
Add a new job to the E2E workflow to test the webgpu-chart example with Playwright in CI environment. Changes: - Add webgpu-chart job to .github/workflows/e2e.yml - Build WASM binary for chart example - Install Playwright with Chromium - Run chart E2E tests with WebGPU enabled - Upload test artifacts (screenshots, videos, snapshots) The job follows the same pattern as webgpu-cube: - Uses Chrome with SwiftShader for software rendering - Enables WebGPU with --enable-unsafe-webgpu flag - Runs in headless mode for CI compatibility - Captures test results for debugging This ensures the chart example is tested on every push and PR.
1 parent 2ee685a commit 4116478

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

.github/workflows/e2e.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,59 @@ jobs:
177177
examples/webgpu-cube/test-results/
178178
examples/webgpu-cube/tests/**/*-snapshots/
179179
retention-days: 7
180+
181+
webgpu-chart:
182+
name: WebGPU Chart E2E Tests
183+
runs-on: ubuntu-latest
184+
steps:
185+
- uses: actions/checkout@v4
186+
187+
- name: Set up Go
188+
uses: actions/setup-go@v5
189+
with:
190+
go-version: '1.25'
191+
192+
- name: Set up Node.js
193+
uses: actions/setup-node@v4
194+
with:
195+
node-version: '20'
196+
197+
- name: Build WebGPU chart example
198+
run: |
199+
cd examples/webgpu-chart
200+
201+
# Copy wasm_exec.js from Go installation
202+
GOROOT="$(go env GOROOT)"
203+
if [ -f "$GOROOT/lib/wasm/wasm_exec.js" ]; then
204+
cp "$GOROOT/lib/wasm/wasm_exec.js" .
205+
elif [ -f "$GOROOT/misc/wasm/wasm_exec.js" ]; then
206+
cp "$GOROOT/misc/wasm/wasm_exec.js" .
207+
else
208+
echo "wasm_exec.js not found in GOROOT, downloading from GitHub"
209+
curl -o wasm_exec.js https://raw.githubusercontent.com/golang/go/go1.25.0/lib/wasm/wasm_exec.js
210+
fi
211+
212+
# Build WASM
213+
GOOS=js GOARCH=wasm go build -o main.wasm .
214+
echo "Files after build:"
215+
ls -lah *.{html,js,wasm} 2>/dev/null || ls -lah
216+
217+
- name: Install Playwright
218+
working-directory: examples/webgpu-chart
219+
run: |
220+
npm install
221+
npx playwright install --with-deps chromium
222+
223+
- name: Run WebGPU chart tests
224+
working-directory: examples/webgpu-chart
225+
run: npx playwright test
226+
227+
- name: Upload test results, videos, and screenshots
228+
if: always()
229+
uses: actions/upload-artifact@v4
230+
with:
231+
name: webgpu-chart-test-artifacts
232+
path: |
233+
examples/webgpu-chart/test-results/
234+
examples/webgpu-chart/tests/**/*-snapshots/
235+
retention-days: 7

0 commit comments

Comments
 (0)