mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-12-05 19:25:00 +03:00
Move server-harness-check and cloud-e2e-rust-server into np-backend.yml and call it from native-playground.yml on backend changes. Add the desktop-leaf-only fast lane to headless-linux-and-perf and guard perf-guardrail so Desktop leaf changes skip full workspace benchmarks.
178 lines
6.5 KiB
YAML
178 lines
6.5 KiB
YAML
name: Native Playground Backend Checks
|
|
|
|
on:
|
|
workflow_call:
|
|
|
|
env:
|
|
CARGO_ENCODED_RUSTFLAGS: ''
|
|
CARGO_INCREMENTAL: '0'
|
|
CARGO_NET_GIT_FETCH_WITH_CLI: 'true'
|
|
CARGO_PROFILE_DEV_DEBUG: '0'
|
|
CARGO_PROFILE_TEST_DEBUG: '0'
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
server-harness-check:
|
|
name: 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: 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
|
|
|
|
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
|