ci(frontend): move desktop checks to the lint job on Rust-only pushes

Run the desktop library and harness checks in the lint job for desktop
Rust-only changes. Keep both desktop test commands and workspace Clippy.
Run the upstream Wasm checks for all other changes.
This commit is contained in:
DarkSky committed 2026-12-04 18:49:51 +09:00
1 parent 1b4ccaee59
commit 0df0a8568c
2 files changed
+107 -1

No files matched your search

+12 -1
View File
@@ -296,6 +296,7 @@ jobs:
echo "Token and font drift check $(( $(date +%s) - t0 ))" >> /tmp/np-lint-timings.tsv
- name: Check WebAssembly target
if: needs.changes.outputs.desktop-rs-only != 'true'
run: |
t0=$(date +%s)
cargo check --locked -p ui-tokens -p ui -p ui-kit -p blocksuite-editor -p playground --target wasm32-unknown-unknown
@@ -307,6 +308,14 @@ jobs:
cargo check --locked -p blocksuite-preview --no-default-features --features pdf,wasm-worker --target wasm32-unknown-unknown
echo "Check WebAssembly target $(( $(date +%s) - t0 ))" >> /tmp/np-lint-timings.tsv
- name: Check Desktop on Linux (default and harness)
if: needs.changes.outputs.desktop-rs-only == 'true'
run: |
t0=$(date +%s)
cargo check --locked -p affine-desktop --lib
cargo check --locked -p affine-desktop --all-targets --features harness
echo "Desktop checks (default + harness) $(( $(date +%s) - t0 ))" >> /tmp/np-lint-timings.tsv
- name: Summarize step timings
if: always()
run: |
@@ -492,7 +501,9 @@ jobs:
t0=$(date +%s)
cargo test --locked -p affine-desktop
cargo test --locked -p affine-desktop --features harness --bin desktop-harness
cargo check --locked -p affine-desktop --all-targets --features harness
if [ "${{ needs.changes.outputs.desktop-rs-only }}" != "true" ]; then
cargo check --locked -p affine-desktop --all-targets --features harness
fi
echo "Desktop tests (default + harness) $(( $(date +%s) - t0 ))" >> /tmp/np-headless-timings.tsv
- name: Run workspace unit tests (default)
@@ -23,6 +23,101 @@ const REPO_ROOT = fileURLToPath(new URL('../..', import.meta.url));
const CLI_PATH = join(REPO_ROOT, 'scripts/ci/classify-web-host-only.mjs');
const SAMPLE_BASE = '65460a7f136d32b15d0d4398f0f4976273c51c9d';
await test('Native Playground CI applies desktop gates under the correct conditions', () => {
const workflow = readFileSync(
join(REPO_ROOT, '.github/workflows/native-playground.yml'),
'utf8'
);
const jobs = new Map();
const jobBlocks = workflow.split('\njobs:\n')[1].split(/(?=^ {2}[\w-]+:\n)/m);
for (const block of jobBlocks) {
const [heading, ...lines] = block.split('\n');
jobs.set(heading.trim().slice(0, -1), lines.join('\n'));
}
const step = (job, name) => {
const body = jobs
.get(job)
.split(/^ {6}- name: /m)
.find(block => block.startsWith(`${name}\n`));
assert.ok(body, `Missing step: ${name}`);
return body
.trimEnd()
.split('\n')
.map(line => line.trim());
};
const lintJob = 'lint-and-wasm';
const clippy = step(lintJob, 'Clippy check');
assert.deepEqual(clippy.slice(3, -1), [
'cargo clippy --locked --workspace --all-targets --features harness -- -D warnings',
]);
const tokenDrift = step(
lintJob,
'Verify generated tokens, icons, and fonts.lock have zero drift'
);
assert.equal(tokenDrift[1], 'run: |');
assert.ok(
tokenDrift.includes(
'node ../ui/tokens/extract-tokens.mjs --check --node-modules /tmp/np-token-deps/node_modules'
)
);
const wasmCheck = step(lintJob, 'Check WebAssembly target');
assert.equal(
wasmCheck[1],
"if: needs.changes.outputs.desktop-rs-only != 'true'"
);
assert.deepEqual(wasmCheck.slice(4, -1), [
'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',
]);
const allTargetsCheck =
'cargo check --locked -p affine-desktop --all-targets --features harness';
const desktopCheck = step(
lintJob,
'Check Desktop on Linux (default and harness)'
);
assert.equal(
desktopCheck[1],
"if: needs.changes.outputs.desktop-rs-only == 'true'"
);
assert.deepEqual(desktopCheck.slice(4, -1), [
'cargo check --locked -p affine-desktop --lib',
allTargetsCheck,
]);
const desktopTest = step(
'headless-linux-and-perf',
'Test Desktop on Linux (default and harness)'
);
assert.equal(
desktopTest[1],
"if: needs.changes.outputs.desktop-leaf-only == 'true'"
);
assert.deepEqual(desktopTest.slice(4, -1), [
'cargo test --locked -p affine-desktop',
'cargo test --locked -p affine-desktop --features harness --bin desktop-harness',
'if [ "${{ needs.changes.outputs.desktop-rs-only }}" != "true" ]; then',
allTargetsCheck,
'fi',
]);
assert.deepEqual(
[...jobs].flatMap(([job, body]) =>
[...body.matchAll(/^ +timeout-minutes: (.+)$/gm)].map(([, value]) => [
job,
value,
])
),
[
['web-wasm-smoke', '20'],
['headless-linux-and-perf', '25'],
['perf-guardrail', '5'],
]
);
});
await test('allowlist remains frozen to the seven pure web-host paths', () => {
assert.deepEqual(
[...WEB_HOST_ONLY_ALLOWLIST],