Skip to content

chore: add Playwright configuration for E2E tests #108

chore: add Playwright configuration for E2E tests

chore: add Playwright configuration for E2E tests #108

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
ci:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
include:
- task: biome
name: "Run Biome CI"
command: "bun biome ci ."
- task: type-check
name: "Run TypeScript type check"
command: "bun run type-check"
- task: vitest
name: "Run test runner"
command: "bun run test"
name: Run ${{ matrix.task }}
steps:
- name: Checkout the repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup tools
uses: jdx/mise-action@13abe502c30c1559a5c37dff303831bab82c9402 # v2.2.3
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Fetch docs assets
run: bun run fetch-docs-ja-jp
- name: ${{ matrix.name }}
run: ${{ matrix.command }}
build:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
kind: [official]
tag:
- v0.14.0
- main.2025-09-19.586b049
- v0.13.1
# These are `docs-*` tags in https://github.com/typst-community/dev-builds.
# To create new tests, trigger the workflow in that repo.
base:
- "/"
- "/docs/"
include:
- kind: ja-JP
tag: latest
base: "/docs/"
name: |
Build for ${{ matrix.kind }} ${{ matrix.tag }} (base: ${{ matrix.base }})
steps:
- name: Checkout the repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup tools managed by mise
uses: jdx/mise-action@13abe502c30c1559a5c37dff303831bab82c9402 # v2.2.3
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Fetch docs assets
if: ${{ matrix.kind == 'ja-JP' }}
run: bun run fetch-docs-ja-jp
- name: Fetch docs assets
if: ${{ matrix.kind == 'official' }}
shell: bash
run: |
set -euxo pipefail
bash scripts/fetch-docs-assets.sh --tag "${{ matrix.tag }}" --base "${{ matrix.base }}" --dest public
- name: Run Vite build
run: bun run build
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
# Due to the limit of the artifact naming rule, we upload only one for each group.
if: ${{ matrix.base == '/' || matrix.kind == 'ja-JP' }}
with:
name: dist-${{ matrix.kind }}-${{ matrix.tag }}
path: dist
e2e:
runs-on: ubuntu-24.04
needs: build
strategy:
matrix:
include:
- kind: official
tag: v0.14.0
base: "/docs/"
name: Run Playwright E2E tests for ${{ matrix.tag }}
steps:
- name: Checkout the repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Setup tools managed by mise
uses: jdx/mise-action@13abe502c30c1559a5c37dff303831bab82c9402
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Fetch docs assets
shell: bash
run: |
set -euxo pipefail
bash scripts/fetch-docs-assets.sh --tag "${{ matrix.tag }}" --base "${{ matrix.base }}" --dest public
- name: Install Playwright browsers
run: bun playwright install --with-deps
- name: Run Playwright E2E tests
run: bun run test:e2e
- name: Upload Playwright report
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: playwright-report
path: playwright-report/
retention-days: 30