Files
AFFiNE/.github/workflows/native-playground.yml
T
DarkSky 8e0b345036 feat(editor): extract ui-tokens, ui-kit, and blocksuite-editor crates
Add the zero-dependency ui-tokens crate to export generated theme tokens,
icon definitions, and bundled font bytes without cross-tree include_bytes!
paths.

Add the domain-neutral ui-kit crate with logical geometry helpers, SafeArea,
VirtualList, SwipeDialog, and SwipeMenu state machines backed by scheduler
time and four-rate replay invariance tests.

Extract blocksuite-editor from playground with the WorkspaceDocDirectory
host port, exact substring UTF-16 highlight matching, and LTR/RTL logical
start/end block flow layout. Slim playground to the demo and harness host.
Update workspace manifests, static invariant guards, CI workflows, and
AGENTS.md files.
2026-11-27 06:55:47 +09:00

661 lines
27 KiB
YAML

name: Native Playground CI
on:
push:
branches:
- 'darksky/native-playground'
- 'darksky/np/**'
concurrency:
group: native-playground-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_ENCODED_RUSTFLAGS: ''
CARGO_INCREMENTAL: '0'
CARGO_PROFILE_DEV_DEBUG: '0'
CARGO_PROFILE_TEST_DEBUG: '0'
CARGO_TERM_COLOR: always
jobs:
changes:
name: Changed Paths
runs-on: ubuntu-24.04
outputs:
web: ${{ steps.filter.outputs.web }}
web-build: ${{ steps.filter.outputs.web-build }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# Full history so the merge base and the previous push are present.
fetch-depth: 0
- name: Resolve the base commit
id: base
env:
BEFORE: ${{ github.event.before }}
# Topic branches compare with their merge base on the integration
# branch; the integration branch compares with the commit before this
# push, or its parent when that commit is unknown (new branch, force
# push). Always a commit SHA, never a branch name.
run: |
set -euo pipefail
if [ "$GITHUB_REF_NAME" = darksky/native-playground ]; then
if [ -n "${BEFORE//0/}" ] && git cat-file -e "${BEFORE}^{commit}" 2>/dev/null; then
sha=$BEFORE
else
sha=$(git rev-parse HEAD~1)
fi
else
sha=$(git merge-base origin/darksky/native-playground HEAD)
fi
echo "sha=$sha" >> "$GITHUB_OUTPUT"
- name: Detect changed paths
id: filter
uses: dorny/paths-filter@v3
with:
base: ${{ steps.base.outputs.sha }}
# JavaScript under scripts/oracle and tools/parity-harness also runs
# the web lane: its lint and format checks cover those files.
filters: |
web:
- '**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs,css}'
- '**/package.json'
- '**/tsconfig*.json'
- 'yarn.lock'
- '.yarnrc.yml'
- '.yarn/**'
- '.oxlintrc.json'
- '.oxfmtrc.json'
- '.prettierignore'
- '.github/actions/setup-node/**'
- '.github/workflows/np-web-fast.yml'
web-build:
- 'packages/frontend/admin/**'
- 'packages/frontend/apps/**'
- 'packages/frontend/component/**'
- 'packages/frontend/core/**'
- 'packages/frontend/electron-api/**'
- 'packages/frontend/i18n/**'
- 'packages/frontend/mobile-native/**'
- 'packages/frontend/native/**'
- 'packages/frontend/routes/**'
- 'packages/frontend/templates/**'
- 'packages/frontend/track/**'
- 'packages/common/auth/**'
- 'packages/common/debug/**'
- 'packages/common/env/**'
- 'packages/common/error/**'
- 'packages/common/graphql/**'
- 'packages/common/infra/**'
- 'packages/common/native/**'
- 'packages/common/nbstore/**'
- 'packages/common/reader/**'
- 'packages/common/realtime/**'
- 'packages/common/s3-compat/**'
- 'packages/common/theme/**'
- 'blocksuite/affine/**'
- 'blocksuite/framework/**'
- 'blocksuite/playground/**'
- 'blocksuite/integration-test/**'
- 'blocksuite/docs/**'
- 'blocksuite/docs-site/**'
- 'blocksuite/tsconfig.json'
- 'tools/cli/**'
- '**/package.json'
- '**/tsconfig*.json'
- 'yarn.lock'
- '.yarnrc.yml'
- '.yarn/**'
- '.github/actions/setup-node/**'
- '.github/workflows/np-web-build.yml'
web-fast:
name: Web Fast Checks
needs: changes
if: needs.changes.outputs.web == 'true'
uses: ./.github/workflows/np-web-fast.yml
web-build:
name: Web Build
needs: changes
if: needs.changes.outputs.web-build == 'true'
uses: ./.github/workflows/np-web-build.yml
server-harness-check:
name: L0 Tier A, Server Contracts & Test Harness
runs-on: ubuntu-24.04
env:
# One installed toolchain for packages/backend/ and tools/parity-harness alike.
RUSTUP_TOOLCHAIN: '1.98.1'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: ./.github/actions/setup-node
with:
electron-install: false
playwright-install: false
full-cache: true
- name: L0 Tier A static gates
run: node scripts/ci/check-l0-tier-a.mjs
- name: Frozen v0.27.5 server contracts
run: |
node scripts/oracle/extract-v0275-contracts.mjs --check
node scripts/oracle/test-extractor.mjs
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.98.1
with:
components: rustfmt, clippy
- name: Cache Cargo artifacts
uses: Swatinem/rust-cache@v2
with:
workspaces: |
packages/backend -> target
tools/frame-audit -> target
tools/parity-harness -> target
key: server-harness
- name: Pull pinned test images
run: |
docker pull -q docker.io/pgvector/pgvector:pg16@sha256:484e838076e04939d27d3e176e91c86eea96236126023be8d3059761122e579f &
docker pull -q docker.io/library/redis:7-alpine@sha256:7f7d30b7fdd09467bac58198a1f166dd69789d348d4fe859cccb20e0cf287fbe &
wait
- name: Format, clippy and test packages/backend/ (real PostgreSQL and Redis) and the parity harness
working-directory: packages/backend
run: |
mkdir -p ../../.artifacts/server-harness
status=passed
timings=()
step() {
local name=$1; shift
local start=$(date +%s%3N)
echo "::group::$name"
"$@" || status=failed
echo "::endgroup::"
timings+=(--timing "$name=$(( $(date +%s%3N) - start ))")
}
step fmt cargo fmt --all -- --check
step clippy cargo clippy --locked --workspace --all-targets -- -D warnings
step test cargo test --locked --workspace
audit=(--manifest-path ../../tools/frame-audit/Cargo.toml)
step audit-fmt cargo fmt "${audit[@]}" --all -- --check
step audit-clippy cargo clippy --locked "${audit[@]}" --workspace --all-targets -- -D warnings
step audit-test cargo test --locked "${audit[@]}" --workspace
parity=(--manifest-path ../../tools/parity-harness/Cargo.toml)
step parity-fmt cargo fmt "${parity[@]}" --all -- --check
step parity-clippy cargo clippy --locked "${parity[@]}" --workspace --all-targets -- -D warnings
step parity-test cargo test --locked "${parity[@]}" --workspace
step csf-frame-audit node ../../scripts/ci/check-csf-frame-audit.mjs
cargo run --locked --quiet -p test-db-harness --bin affine-test-env -- \
run-json --out ../../.artifacts/server-harness/run.json --lane server-harness --status "$status" \
--sha "${{ github.sha }}" --run-id "${{ github.run_id }}-${{ github.run_attempt }}" \
--select frame-audit --select csf-frame-audit --select test-db-harness --select parity-harness \
--select server-types --select server-db --select server-spi --select server-domain \
--select server-mail --select server-blob --select server-sync \
--select server-http --select server-worker --select affine-server "${timings[@]}"
cat ../../.artifacts/server-harness/run.json
test -s ../../.artifacts/server-harness/run.json
test -s ../../.artifacts/csf-frame-audit/frames.json
test "$status" = passed
- name: Upload run report
if: always()
uses: actions/upload-artifact@v4
with:
name: server-harness-run
path: |
.artifacts/server-harness/run.json
.artifacts/csf-frame-audit/frames.json
if-no-files-found: ignore
lint-and-wasm:
name: Lint, Invariants & Wasm Check
runs-on: ubuntu-24.04
defaults:
run:
working-directory: packages/frontend
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Linux fontconfig headers
run: |
sudo apt-get update
sudo apt-get install -y libfontconfig1-dev libfreetype-dev
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.98.1
with:
components: rustfmt, clippy
targets: wasm32-unknown-unknown
- name: Cache Cargo artifacts
uses: Swatinem/rust-cache@v2
with:
workspaces: packages/frontend -> target
key: lint-wasm
- name: Format check
run: cargo fmt --all -- --check
- name: Clippy check
run: cargo clippy --locked --workspace --all-targets --features harness -- -D warnings
- name: Static invariants and link-flag check
run: ./scripts/check-invariants.sh
- name: Perf guardrail self-tests and generated token/icon unit tests
run: |
node --test perf/compare-n3.test.mjs
rustc --edition 2024 --test -D warnings ../ui/tokens/tokens.rs -o /tmp/tokens_test && /tmp/tokens_test
rustc --edition 2024 --test -D warnings ../ui/tokens/icons.rs -o /tmp/icons_test && /tmp/icons_test
rm -f /tmp/tokens_test /tmp/icons_test
- name: Verify generated tokens, icons, and fonts.lock have zero drift
run: |
THEME_VER=$(awk '/^"@toeverything\/theme@/{f=1} f && /version:/{print $2; exit}' ../../yarn.lock)
ICONS_VER=$(awk '/^"@blocksuite\/icons@/{f=1} f && /version:/{print $2; exit}' ../../yarn.lock)
rm -rf /tmp/np-token-deps
mkdir -p /tmp/np-token-deps/node_modules/@toeverything/theme /tmp/np-token-deps/node_modules/@blocksuite/icons
curl -fsSL "https://registry.npmjs.org/@toeverything/theme/-/theme-${THEME_VER}.tgz" \
| tar -xz --strip-components=1 -C /tmp/np-token-deps/node_modules/@toeverything/theme
curl -fsSL "https://registry.npmjs.org/@blocksuite/icons/-/icons-${ICONS_VER}.tgz" \
| tar -xz --strip-components=1 -C /tmp/np-token-deps/node_modules/@blocksuite/icons
node ../ui/tokens/extract-tokens.mjs --check --node-modules /tmp/np-token-deps/node_modules
rm -rf /tmp/np-token-deps
- name: Check WebAssembly target
run: |
cargo check --locked -p ui-tokens -p ui -p ui-kit -p blocksuite-editor -p playground --target wasm32-unknown-unknown
cargo check --locked -p blocksuite-playground-doc --no-default-features --target wasm32-unknown-unknown
cargo check --locked -p affine-store --no-default-features --target wasm32-unknown-unknown
cargo check --locked -p blocksuite-preview --no-default-features --features mermaid,wasm-worker --target wasm32-unknown-unknown
cargo check --locked -p blocksuite-preview --no-default-features --features math,wasm-worker --target wasm32-unknown-unknown
cargo check --locked -p blocksuite-preview --no-default-features --features typst,wasm-worker --target wasm32-unknown-unknown
cargo check --locked -p blocksuite-preview --no-default-features --features pdf,wasm-worker --target wasm32-unknown-unknown
headless-linux-and-perf:
name: Headless Linux, Web Smoke & Perf
runs-on: ubuntu-24.04
defaults:
run:
working-directory: packages/frontend
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Mesa Lavapipe Vulkan driver and headers
run: |
sudo apt-get update
sudo apt-get install -y mesa-vulkan-drivers libvulkan1 libfontconfig1-dev libfreetype-dev lld
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.98.1
with:
targets: wasm32-unknown-unknown
- name: Install wasm-bindgen CLI
run: |
WBG_VERSION=$(awk '/^name = "wasm-bindgen"$/{getline; gsub(/"/, "", $3); print $3; exit}' Cargo.lock)
URL="https://github.com/wasm-bindgen/wasm-bindgen/releases/download/${WBG_VERSION}/wasm-bindgen-${WBG_VERSION}-x86_64-unknown-linux-musl.tar.gz"
if curl -fsSL "$URL" -o /tmp/wbg.tar.gz; then
tar -xzf /tmp/wbg.tar.gz -C /tmp
sudo install -m 0755 "/tmp/wasm-bindgen-${WBG_VERSION}-x86_64-unknown-linux-musl/wasm-bindgen" /usr/local/bin/wasm-bindgen
else
cargo install --locked wasm-bindgen-cli --version "$WBG_VERSION"
fi
wasm-bindgen --version
- name: Cache Cargo artifacts
uses: Swatinem/rust-cache@v2
with:
workspaces: packages/frontend -> target
key: headless-linux
- name: Run workspace unit tests (default and harness)
run: |
cargo test --locked --workspace
cargo test --locked --workspace --features harness
- name: Build WebAssembly bundle and run headless Chromium smoke test
run: |
mkdir -p artifacts ../../blocksuite/crates/playground/web/pkg
cargo build --locked -p playground --target wasm32-unknown-unknown --release
wasm-bindgen --target web --out-dir ../../blocksuite/crates/playground/web/pkg target/wasm32-unknown-unknown/release/playground.wasm
WASM_RAW=$(wc -c < ../../blocksuite/crates/playground/web/pkg/playground_bg.wasm | tr -d ' ')
WASM_GZIP=$(gzip -9 -c ../../blocksuite/crates/playground/web/pkg/playground_bg.wasm | wc -c | tr -d ' ')
echo "WASM_RAW=$WASM_RAW" >> "$GITHUB_ENV"
echo "WASM_GZIP=$WASM_GZIP" >> "$GITHUB_ENV"
node scripts/web-smoke.mjs \
--out artifacts/wasm-chromium.png \
--out-edgeless artifacts/wasm-chromium-edgeless.png
test -s artifacts/wasm-chromium.png
test -s artifacts/wasm-chromium-edgeless.png
- name: Deterministic headless render, audit, 4-fps check, and 30-frame bench
run: |
mkdir -p artifacts
cargo run --locked --bin bs-harness --features harness -- render \
--out artifacts/linux-run1.png \
--snapshot artifacts/linux-run1.json \
--width 1280 \
--height 800
cargo run --locked --bin bs-harness --features harness -- render \
--out artifacts/linux-run2.png \
--snapshot artifacts/linux-run2.json \
--width 1280 \
--height 800
test -s artifacts/linux-run1.png
test -s artifacts/linux-run1.json
sha1=$(sha256sum artifacts/linux-run1.png | awk '{print $1}')
sha2=$(sha256sum artifacts/linux-run2.png | awk '{print $1}')
echo "Run 1 SHA256: $sha1"
echo "Run 2 SHA256: $sha2"
test "$sha1" = "$sha2"
cargo run --locked --bin bs-harness --features harness -- audit --snapshot artifacts/linux-run1.json
cargo run --locked --bin bs-harness --features harness -- audit-states
cargo run --locked --bin bs-harness --features harness -- fps-check
cargo run --locked --bin bs-harness --features harness -- bench \
--json artifacts/perf-metrics.json \
--commit "${{ github.sha }}" \
--web-wasm-raw "$WASM_RAW" \
--web-wasm-gzip "$WASM_GZIP"
test -s artifacts/perf-metrics.json
- name: Compare against rolling N-3 baseline
env:
GH_TOKEN: ${{ github.token }}
NP_ALLOW_PERF_BOOTSTRAP: ${{ vars.NP_ALLOW_PERF_BOOTSTRAP }}
run: |
test -f perf/compare-n3.mjs
STRICT_PERF_FLAG="--require-n3"
if [ "${NP_ALLOW_PERF_BOOTSTRAP:-0}" = "1" ]; then
STRICT_PERF_FLAG=""
fi
node perf/compare-n3.mjs \
--fetch-github \
--repo "${{ github.repository }}" \
--branch darksky/native-playground \
--workflow native-playground.yml \
--run-id "${{ github.run_id }}" \
--current artifacts/perf-metrics.json \
--json-out artifacts/perf-verdict.json \
$STRICT_PERF_FLAG \
--fail-on-regression >> "$GITHUB_STEP_SUMMARY"
test -s artifacts/perf-verdict.json
node -e '
const fs = require("node:fs");
const v = JSON.parse(fs.readFileSync("artifacts/perf-verdict.json", "utf8"));
const allowBootstrap = process.env.NP_ALLOW_PERF_BOOTSTRAP === "1";
const shaRe = /^[0-9a-f]{40}$/;
if (
(!allowBootstrap && (v.baseline_depth !== "N-3" || !shaRe.test(v.baseline_commit || ""))) ||
(allowBootstrap && v.baseline_depth !== "bootstrap" && !shaRe.test(v.baseline_commit || "")) ||
!Array.isArray(v.metrics) ||
v.metrics.length === 0
) {
throw new Error(`Invalid perf-verdict.json: baseline_depth=${v.baseline_depth}, baseline_commit=${v.baseline_commit}, metrics=${v.metrics?.length}`);
}
const dropped = v.metrics.filter(m => m.status === "DROPPED");
if (dropped.length > 0) {
throw new Error(`Unacknowledged dropped baseline metrics: ${dropped.map(m => m.key).join(", ")}`);
}
const unacceptedBootstrap = v.metrics.filter(m => m.status === "BOOTSTRAP");
if (!allowBootstrap && unacceptedBootstrap.length > 0) {
throw new Error(`Unacknowledged BOOTSTRAP metrics against N-3 baseline: ${unacceptedBootstrap.map(m => m.key).join(", ")}`);
}
const compared = v.metrics.filter(m => m.baseline != null && m.current != null);
if (!allowBootstrap && compared.length === 0) {
throw new Error("No metrics were compared against prior N-3 baseline history");
}
console.log(`perf-verdict.json verified: ${v.baseline_depth} (${(v.baseline_commit || "none").slice(0, 10)}), ${v.metrics.length} metrics, ${unacceptedBootstrap.length} unacknowledged bootstrap, 0 dropped`);
'
- name: Upload perf metrics artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: perf-metrics
path: |
packages/frontend/artifacts/perf-metrics.json
packages/frontend/artifacts/perf-verdict.json
if-no-files-found: ignore
- name: Upload Linux headless and Web smoke artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: headless-linux-artifacts
path: |
packages/frontend/artifacts/linux-run1.png
packages/frontend/artifacts/linux-run1.json
packages/frontend/artifacts/wasm-chromium.png
packages/frontend/artifacts/wasm-chromium-edgeless.png
if-no-files-found: ignore
macos-headless:
name: macOS Metal + CoreText Headless
runs-on: macos-15
defaults:
run:
working-directory: packages/frontend
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.98.1
- name: Cache Cargo artifacts
uses: Swatinem/rust-cache@v2
with:
workspaces: packages/frontend -> target
key: macos-headless
- name: Check workspace all targets
run: cargo check --locked --workspace --all-targets --features harness
- name: Check iOS device and simulator targets
run: |
rustup target add aarch64-apple-ios aarch64-apple-ios-sim
CARGO_ENCODED_RUSTFLAGS="" cargo check --locked -p ui-tokens -p ui -p ui-kit --target aarch64-apple-ios
CARGO_ENCODED_RUSTFLAGS="" cargo check --locked -p ui-tokens -p ui -p ui-kit --target aarch64-apple-ios-sim
- name: Run UI, doc, editor, and playground tests (default and harness)
run: |
cargo test --locked -p ui-tokens -p ui -p ui-kit -p blocksuite-playground-doc -p blocksuite-editor -p playground
cargo test --locked -p ui-tokens -p ui -p ui-kit -p blocksuite-playground-doc -p blocksuite-editor -p playground --features harness
- name: Deterministic Metal headless render and audit
run: |
mkdir -p artifacts
cargo run --locked --bin bs-harness --features harness -- render \
--out artifacts/macos-run1.png \
--snapshot artifacts/macos-run1.json \
--width 1280 \
--height 800
cargo run --locked --bin bs-harness --features harness -- render \
--out artifacts/macos-run2.png \
--snapshot artifacts/macos-run2.json \
--width 1280 \
--height 800
test -s artifacts/macos-run1.png
test -s artifacts/macos-run1.json
sha1=$(shasum -a 256 artifacts/macos-run1.png | awk '{print $1}')
sha2=$(shasum -a 256 artifacts/macos-run2.png | awk '{print $1}')
echo "Run 1 SHA256: $sha1"
echo "Run 2 SHA256: $sha2"
test "$sha1" = "$sha2"
cargo run --locked --bin bs-harness --features harness -- audit --snapshot artifacts/macos-run1.json
- name: Upload macOS headless artifacts
uses: actions/upload-artifact@v4
with:
name: headless-macos-artifacts
path: |
packages/frontend/artifacts/macos-run1.png
packages/frontend/artifacts/macos-run1.json
if-no-files-found: error
js-room-coop:
name: JS Room Coop & Rust-JS E2E
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Enable Corepack and cache Yarn
run: corepack enable
- name: Cache Yarn
uses: actions/cache@v4
with:
path: |
.yarn/cache
node_modules
key: ${{ runner.os }}-yarn-np-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-np-
- name: Install JS dependencies
run: yarn install --immutable
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.98.1
- name: Cache Cargo artifacts
uses: Swatinem/rust-cache@v2
with:
workspaces: packages/frontend -> target
key: js-room-coop
- name: Build bs-relay and bs_doc_driver
working-directory: packages/frontend
run: cargo build --locked -p blocksuite-playground-doc --bin bs-relay --example bs_doc_driver
- name: Verify JS-authored surface snapshots without writeback
working-directory: packages/frontend
run: cargo test --locked -p blocksuite-playground-doc --example bs_doc_driver js_authored_surface
- name: Lint, format, and typecheck JS room sync
run: |
yarn oxlint --deny-warnings \
blocksuite/framework/sync/src/doc/source.ts \
blocksuite/framework/sync/src/doc/peer.ts \
blocksuite/framework/sync/src/__tests__/peer.unit.spec.ts \
blocksuite/playground/apps/_common/sync/blob/mock-server.ts \
blocksuite/playground/apps/_common/sync/room/index.ts \
blocksuite/playground/apps/_common/sync/room/__tests__/room-sync.spec.ts \
blocksuite/playground/apps/starter/utils/collection.ts \
blocksuite/playground/vite.config.ts \
blocksuite/playground/vitest.config.ts
yarn oxfmt --check \
blocksuite/framework/sync/src/doc/source.ts \
blocksuite/framework/sync/src/doc/peer.ts \
blocksuite/framework/sync/src/__tests__/peer.unit.spec.ts \
blocksuite/playground/apps/_common/sync/blob/mock-server.ts \
blocksuite/playground/apps/_common/sync/room/index.ts \
blocksuite/playground/apps/_common/sync/room/__tests__/room-sync.spec.ts \
blocksuite/playground/apps/starter/utils/collection.ts \
blocksuite/playground/vite.config.ts \
blocksuite/playground/vitest.config.ts
./node_modules/.bin/tsc -b \
blocksuite/framework/sync/tsconfig.json \
blocksuite/playground/tsconfig.json
- name: Verify surface geometry oracle and live Rust-JS room sync
env:
BS_RELAY_BIN: ${{ github.workspace }}/packages/frontend/target/debug/bs-relay
BS_DOC_DRIVER_BIN: ${{ github.workspace }}/packages/frontend/target/debug/examples/bs_doc_driver
run: |
(cd blocksuite/framework/sync && ../../../node_modules/.bin/vitest run)
(cd blocksuite/playground && ../../node_modules/.bin/vitest run)
cloud-e2e-rust-server:
name: Cloud E2E (Rust affine-server)
runs-on: ubuntu-24.04
timeout-minutes: 25
env:
RUSTUP_TOOLCHAIN: '1.98.1'
CARGO_ENCODED_RUSTFLAGS: ''
DATABASE_URL: postgresql://affine:affine@127.0.0.1:5432/affine
REDIS_URL: redis://127.0.0.1:6379/0
AFFINE_E2E_RUST_SERVER: '1'
AFFINE_SERVER_EXTERNAL_URL: http://localhost:8080
services:
postgres:
image: docker.io/pgvector/pgvector:pg16@sha256:484e838076e04939d27d3e176e91c86eea96236126023be8d3059761122e579f
env:
POSTGRES_USER: affine
POSTGRES_PASSWORD: affine
POSTGRES_DB: affine
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 5s
--health-timeout 5s
--health-retries 10
redis:
image: docker.io/library/redis:7-alpine@sha256:7f7d30b7fdd09467bac58198a1f166dd69789d348d4fe859cccb20e0cf287fbe
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 5s
--health-retries 10
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js and Playwright
uses: ./.github/actions/setup-node
with:
electron-install: false
playwright-install: true
full-cache: true
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.98.1
- name: Cache Cargo artifacts
uses: Swatinem/rust-cache@v2
with:
workspaces: packages/backend -> target
key: server-harness
- name: Build affine-server binary
working-directory: packages/backend
run: cargo build --locked -p affine-server --bin affine-server
- name: Generate Prisma client for test helpers
run: yarn affine @affine/server prisma generate
- name: Run deterministic affine-cloud Playwright E2E against Rust affine-server
run: |
yarn --cwd tests/affine-cloud playwright test \
e2e/login.spec.ts \
e2e/workspace.spec.ts \
e2e/storage.spec.ts \
e2e/collaboration.spec.ts \
e2e/share-page-1.spec.ts \
e2e/share-page-2.spec.ts \
e2e/page-history.spec.ts \
e2e/comments.spec.ts \
e2e/open-in-app.spec.ts