npm run check (tsc, vitest, cargo test aller Crates); Gitea-Actions-Workflow (Runner noetig)
This commit is contained in:
1 parent
dadcf7b4a0
commit
0bde4c3d93
3 files changed
+50
No files matched your search
@@ -0,0 +1,18 @@
|
||||
# Tests bei jedem Push (lessons-bimcraft [57]). Braucht einen Gitea-Actions-Runner mit
|
||||
# Docker/Node; ohne Runner passiert nichts. Die WASM-Pakete (src/engine/pkg*) sind nicht im
|
||||
# Repo und werden hier gebaut, weil Tests wie truckBrep.wasm.test.ts sie lesen.
|
||||
name: check
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with: { node-version: 22, cache: npm }
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with: { targets: wasm32-unknown-unknown }
|
||||
- run: cargo install wasm-pack --locked
|
||||
- run: npm ci
|
||||
- run: npm run build:truck && npm run build:engine3d && npm run build:engine && npm run build:kernel2d && npm run build:dwgimport
|
||||
- run: npm run check
|
||||
@@ -11,6 +11,7 @@
|
||||
"preview": "vite preview",
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest",
|
||||
"check": "node scripts/check.mjs",
|
||||
"tauri": "tauri",
|
||||
"tauri:dev": "node scripts/tauri-native.mjs dev",
|
||||
"tauri:build": "node scripts/tauri-native.mjs build",
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
// Fester Check vor jedem Abschluss (lessons-bimcraft [22]): TypeScript, Vitest und die
|
||||
// Rust-Tests aller eigenständigen Crates. Bricht beim ersten Fehler ab.
|
||||
// npm run check alles
|
||||
// npm run check -- --fast nur tsc + vitest
|
||||
// `cargo fmt`/`clippy` sind noch nicht Teil des Checks: die Crates sind nie formatiert
|
||||
// worden (ein Reformat wäre ein Riesen-Diff) — eigener Schritt, s. docs/lessons-bimcraft.md.
|
||||
import { spawnSync } from "node:child_process";
|
||||
|
||||
const fast = process.argv.includes("--fast");
|
||||
const crates = ["render2d", "render3d", "kernel2d", "trucksolid", "dwgimport"];
|
||||
const steps = [
|
||||
{ name: "tsc", cmd: "npx", args: ["tsc", "--noEmit", "-p", "."] },
|
||||
{ name: "vitest", cmd: "npx", args: ["vitest", "run"] },
|
||||
...(fast ? [] : crates.map((c) => ({ name: `cargo test ${c}`, cmd: "cargo", args: ["test", "--quiet"], cwd: `src-tauri/${c}` }))),
|
||||
];
|
||||
|
||||
const t0 = Date.now();
|
||||
for (const s of steps) {
|
||||
const t = Date.now();
|
||||
process.stdout.write(`▶ ${s.name} … `);
|
||||
const r = spawnSync(s.cmd, s.args, { cwd: s.cwd, encoding: "utf8" });
|
||||
const secs = ((Date.now() - t) / 1000).toFixed(1);
|
||||
if (r.status !== 0) {
|
||||
console.log(`FEHLER (${secs}s)\n`);
|
||||
console.log((r.stdout ?? "").split("\n").slice(-40).join("\n"));
|
||||
console.log(r.stderr ?? "");
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(`ok (${secs}s)`);
|
||||
}
|
||||
console.log(`\nAlles grün (${((Date.now() - t0) / 1000).toFixed(0)}s).`);
|
||||
Reference in new issue
Block a user