@roomi-fields/grillhouse 0.38.1 → 0.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +16 -0
- package/charte.md +13 -0
- package/dist/temporal/circuit/client.d.ts +4 -3
- package/dist/temporal/circuit/client.js +4 -3
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/commande.js +6 -4
- package/dist/temporal/circuit/commande.js.map +1 -1
- package/dist/temporal/tickets/deroule.js +16 -4
- package/dist/temporal/tickets/deroule.js.map +1 -1
- package/docs/ARCHITECTURE.md +21 -26
- package/docs/INTERFACE.md +15 -34
- package/package.json +1 -1
- package/scripts/activites.mjs +48 -290
- package/scripts/circuit.mjs +6 -22
- package/scripts/composition-des-langages.mjs +1 -16
- package/scripts/conformite.mjs +0 -31
- package/scripts/dernier-vert.mjs +4 -86
- package/scripts/etat-du-depot.mjs +92 -0
- package/scripts/grillhouse-maj.mjs +9 -6
- package/scripts/jointure.d.ts +0 -29
- package/scripts/langages/cargo/commandes.mjs +8 -15
- package/scripts/langages/cargo/composants.mjs +1 -100
- package/scripts/langages/cargo/exemples.mjs +0 -73
- package/scripts/langages/cargo/index.mjs +0 -6
- package/scripts/langages/python/commandes.mjs +2 -11
- package/scripts/langages/python/composants.mjs +2 -13
- package/scripts/langages/python/exemples.mjs +0 -19
- package/scripts/langages/python/index.mjs +2 -14
- package/scripts/langages/typescript/exemples.mjs +0 -16
- package/scripts/langages/typescript/index.mjs +6 -11
- package/scripts/langages/typescript/regle-des-tests.mjs +0 -15
- package/scripts/langages/typescript/verifier.mjs +30 -0
- package/scripts/nuit.sh +7 -1
- package/scripts/recommencer.mjs +5 -3
- package/scripts/registre-des-resultats.mjs +119 -0
- package/scripts/services-du-noyau.mjs +6 -0
- package/scripts/sources.mjs +5 -3
- package/skills/explorateur/SKILL.md +6 -1
- package/scripts/langages/cargo/tests-de-head.mjs +0 -178
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// The state of a git repository and the place of the per-branch files the frame keeps beside it:
|
|
2
|
+
// the layer the last green (scripts/dernier-vert.mjs) and the registry of results
|
|
3
|
+
// (scripts/registre-des-resultats.mjs) share. Each keeps `{ … }` per branch under
|
|
4
|
+
// `<git common dir>/grillhouse/<sous>/<branche>.json`, and each measures what counts against the
|
|
5
|
+
// repository's state as it stands, so the place of the file (`fichierSous`) and the repository's
|
|
6
|
+
// identity (`etatDuDepot`) live here, once, for both.
|
|
7
|
+
import { spawnSync } from 'node:child_process';
|
|
8
|
+
import { copyFileSync, existsSync, mkdtempSync, realpathSync, rmSync } from 'node:fs';
|
|
9
|
+
import os from 'node:os';
|
|
10
|
+
import path from 'node:path';
|
|
11
|
+
|
|
12
|
+
export const SHA = /^[0-9a-f]{40,64}$/;
|
|
13
|
+
|
|
14
|
+
export const git = (racine, args, env = process.env) =>
|
|
15
|
+
spawnSync('git', ['-C', racine, ...args], {
|
|
16
|
+
encoding: 'utf8',
|
|
17
|
+
env,
|
|
18
|
+
maxBuffer: 256 * 1024 * 1024,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const sortie = (racine, args, env) => {
|
|
22
|
+
const r = git(racine, args, env);
|
|
23
|
+
return r.status === 0 ? r.stdout.trim() : null;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// The file `<git common dir>/grillhouse/<sous>/<branche>.json` of the repository at <racine>, null
|
|
27
|
+
// out of git. The last green (`dernier-vert`) and the registry of results (`resultats`,
|
|
28
|
+
// scripts/registre-des-resultats.mjs) both live under it, one file per branch.
|
|
29
|
+
export function fichierSous(racine, sous, branche) {
|
|
30
|
+
const commun = sortie(racine, ['rev-parse', '--path-format=absolute', '--git-common-dir']);
|
|
31
|
+
return commun ? path.join(commun, 'grillhouse', sous, `${branche}.json`) : null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Main, the branch of the main tree of the repository at <racine> (HEAD of git's common
|
|
35
|
+
// directory); null when that tree is detached.
|
|
36
|
+
function brancheDeMain(racine) {
|
|
37
|
+
const commun = sortie(racine, ['rev-parse', '--path-format=absolute', '--git-common-dir']);
|
|
38
|
+
return commun
|
|
39
|
+
? sortie(racine, [`--git-dir=${commun}`, 'symbolic-ref', '--short', '-q', 'HEAD'])
|
|
40
|
+
: null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Whether a submodule of the repository at <racine> differs from the commit its parent records.
|
|
44
|
+
function sousModuleModifie(racine) {
|
|
45
|
+
const r = git(racine, ['status', '--porcelain=v2', '-z', '--ignore-submodules=none']);
|
|
46
|
+
if (r.status !== 0) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
// An entry of a changed path: `1 <XY> <sub> …` (or `2` for a rename), <sub> `S<c><m><u>` for a
|
|
50
|
+
// submodule whose commit, tracked files or untracked files changed, `N...` for any other path.
|
|
51
|
+
return r.stdout.split('\0').some(e => /^[12] \S+ S/.test(e));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// The state of the repository at <racine> as it stands: `{ racine, commit, arbre, branche, main }`,
|
|
55
|
+
// its top (its real path), HEAD, the tree of its working tree, the branch of HEAD (null when
|
|
56
|
+
// detached) and main (brancheDeMain); `{ raison }` when no last green can count.
|
|
57
|
+
export function etatDuDepot(racine) {
|
|
58
|
+
const haut = sortie(racine, ['rev-parse', '--show-toplevel']);
|
|
59
|
+
if (!haut) {
|
|
60
|
+
return { raison: 'hors de git' };
|
|
61
|
+
}
|
|
62
|
+
const top = realpathSync(haut);
|
|
63
|
+
const commit = sortie(top, ['rev-parse', '--verify', '-q', 'HEAD^{commit}']);
|
|
64
|
+
if (!commit) {
|
|
65
|
+
return { raison: 'aucun commit' };
|
|
66
|
+
}
|
|
67
|
+
if (sousModuleModifie(top)) {
|
|
68
|
+
return { raison: 'un sous-module diffère de son commit' };
|
|
69
|
+
}
|
|
70
|
+
const dir = mkdtempSync(path.join(os.tmpdir(), 'grillhouse-vert-'));
|
|
71
|
+
try {
|
|
72
|
+
const index = path.join(dir, 'index');
|
|
73
|
+
const reel = sortie(top, ['rev-parse', '--path-format=absolute', '--git-path', 'index']);
|
|
74
|
+
const env = { ...process.env, GIT_INDEX_FILE: index };
|
|
75
|
+
if (reel && existsSync(reel)) {
|
|
76
|
+
copyFileSync(reel, index);
|
|
77
|
+
} else if (git(top, ['read-tree', 'HEAD'], env).status !== 0) {
|
|
78
|
+
return { raison: 'git échoue' };
|
|
79
|
+
}
|
|
80
|
+
if (git(top, ['add', '-A'], env).status !== 0) {
|
|
81
|
+
return { raison: 'git échoue' };
|
|
82
|
+
}
|
|
83
|
+
const arbre = sortie(top, ['write-tree'], env);
|
|
84
|
+
if (!arbre) {
|
|
85
|
+
return { raison: 'git échoue' };
|
|
86
|
+
}
|
|
87
|
+
const branche = sortie(top, ['symbolic-ref', '--short', '-q', 'HEAD']);
|
|
88
|
+
return { racine: top, commit, arbre, branche, main: brancheDeMain(top) };
|
|
89
|
+
} finally {
|
|
90
|
+
rmSync(dir, { recursive: true, force: true });
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -92,8 +92,9 @@
|
|
|
92
92
|
// names each tool added and `npm install`, which installs them. A project without
|
|
93
93
|
// `packageManager` receives the template's.
|
|
94
94
|
// - What the frame writes in a project (IGNORES_DU_CADRE: the copies of the tickets,
|
|
95
|
-
// `.claude/worktrees
|
|
96
|
-
//
|
|
95
|
+
// `.claude/worktrees`, and Turborepo's `.turbo`, the tool every language plays its tasks by) and
|
|
96
|
+
// what the tools of the declared language write there (`ignorer` of its module: typescript's
|
|
97
|
+
// `.vitest-reports`, cargo's `target`): a `.gitignore` that does not ignore one
|
|
97
98
|
// receives its line, `<nom>/`. The template's `.gitignore` lists none of them: the update is
|
|
98
99
|
// their one source, for a project `init` creates as for an existing one.
|
|
99
100
|
// - The binaries of the declared language (`binaires` of its module: cargo's nextest and
|
|
@@ -199,11 +200,13 @@ const lireJson = (f, defaut) => {
|
|
|
199
200
|
};
|
|
200
201
|
|
|
201
202
|
/**
|
|
202
|
-
* The directories the frame itself writes in a project, which its `.gitignore` ignores: the
|
|
203
|
-
*
|
|
204
|
-
*
|
|
203
|
+
* The directories the frame itself writes in a project, which its `.gitignore` ignores: the copies
|
|
204
|
+
* of the tickets, and the runs and cache of Turborepo (`.turbo`), the tool every language of the
|
|
205
|
+
* frame plays its tasks by (grillhouse-x2w), written whatever the project's language. The template's
|
|
206
|
+
* `.gitignore` lists none of them, nor what the tools of its language write: the update lays both,
|
|
207
|
+
* in a new project as in an existing one.
|
|
205
208
|
*/
|
|
206
|
-
export const IGNORES_DU_CADRE = ['.claude/worktrees'];
|
|
209
|
+
export const IGNORES_DU_CADRE = ['.claude/worktrees', '.turbo'];
|
|
207
210
|
|
|
208
211
|
// Adds to the `.gitignore` of the project at <projet> each directory the frame writes
|
|
209
212
|
// (IGNORES_DU_CADRE) and each its language's tools write (`ignorer` of its module), as `<nom>/`,
|
package/scripts/jointure.d.ts
CHANGED
|
@@ -255,12 +255,6 @@ export interface Composition {
|
|
|
255
255
|
* plays (a night test, a time budget bench, a time witness), by the module's own definitions;
|
|
256
256
|
* false for any other file. */
|
|
257
257
|
horsDuJour(chemin: string, racine: string): boolean;
|
|
258
|
-
/** Optional, for a tool that reads a test file beside it (typescript): the sibling of HEAD's
|
|
259
|
-
* version of the test file `chemin` (from `racine`), from the root: a file beside it, a test
|
|
260
|
-
* the tool plays in the same run as it, its tests named in the run's report as the file's, of
|
|
261
|
-
* its class (day, night, bench), which the proof of the red writes, plays and removes; null for
|
|
262
|
-
* a file that has none. */
|
|
263
|
-
soeurDAvant?(chemin: string, racine: string): string | null;
|
|
264
258
|
/** Optional, for the module that drives the task runner (typescript), which the core serves to
|
|
265
259
|
* the others: the names of the summaries of a run present in `racine` before a run. */
|
|
266
260
|
resumesDuLancement?(racine: string): Set<string>;
|
|
@@ -275,29 +269,6 @@ export interface Composition {
|
|
|
275
269
|
/** Optional, typescript's alone: the tasks of the summaries under the results directory
|
|
276
270
|
* `dossier`, in their order, each with its cache status; `code` null for a task that did not run. */
|
|
277
271
|
lireLesResumes?(dossier: string): TacheDuResume[];
|
|
278
|
-
/** Whether HEAD's version of the test file `chemin` (from `racine`) plays in a tree of its own,
|
|
279
|
-
* the copy's with that file alone replaced, under the file's own name, which the proof of the
|
|
280
|
-
* red builds, plays and removes (cargo, python); false for a file the tool cannot play so
|
|
281
|
-
* (cargo: a target `tests/<dossier>/main.rs`, a unit test of `src/`: `testsDeHead`), plays
|
|
282
|
-
* beside it (typescript: `soeurDAvant`) or does not play. */
|
|
283
|
-
arbreDAvant(chemin: string, racine: string): boolean;
|
|
284
|
-
/** The environment a tree of HEAD's version of `chemin` plays under (cargo: the target
|
|
285
|
-
* directory of the copy's compilations; python: the copy's folder of uv environments, which the
|
|
286
|
-
* tree reuses, `GRILLHOUSE_VENV_DE_LA_COPIE`); empty for none. */
|
|
287
|
-
envDArbre(chemin: string, racine: string): Record<string, string>;
|
|
288
|
-
/** The names of the tests of HEAD's version of the test file `chemin` (from `racine`), as the
|
|
289
|
-
* verdict names them, read without playing them, for a file whose tree the proof does not play
|
|
290
|
-
* (cargo: a unit test of `src/`, a target `tests/<dossier>/main.rs`, its out-of-line modules read
|
|
291
|
-
* too), or whose tree breaks the build of its package while the lot alone builds (cargo: a
|
|
292
|
-
* target `tests/<nom>.rs` whose HEAD's version no longer compiles against the lot's
|
|
293
|
-
* `tests/common`, grillhouse-3e2.2); the proof of the red holds each for a green HEAD already
|
|
294
|
-
* holds. `lire` gives HEAD's text of a file from the root, null for none. Null for any other
|
|
295
|
-
* file, or one HEAD does not hold. */
|
|
296
|
-
testsDeHead(
|
|
297
|
-
chemin: string,
|
|
298
|
-
racine: string,
|
|
299
|
-
lire: (fichier: string) => string | null
|
|
300
|
-
): string[] | null;
|
|
301
272
|
manifestes: Manifestes;
|
|
302
273
|
fichiersEngendres(racine: string): FichierEngendre[];
|
|
303
274
|
gardes(racine: string): string[][];
|
|
@@ -158,7 +158,6 @@ import {
|
|
|
158
158
|
} from '../../services-du-noyau.mjs';
|
|
159
159
|
import {
|
|
160
160
|
BANC,
|
|
161
|
-
COPIE_DE_L_ARBRE,
|
|
162
161
|
composantDans,
|
|
163
162
|
crates,
|
|
164
163
|
DE_NUIT,
|
|
@@ -806,26 +805,21 @@ function sousLaBase(genre, env, jouer) {
|
|
|
806
805
|
|
|
807
806
|
/**
|
|
808
807
|
* The line that refuses the workspace at <racine> whose Cargo.lock git does not track, the
|
|
809
|
-
* gesture named; null when git tracks it, and null for a tree with no git at all.
|
|
810
|
-
* git tree that reads the lock: the copy git tracks the file in (COPIE_DE_L_ARBRE), else <racine>.
|
|
808
|
+
* gesture named; null when git tracks it, and null for a tree with no git at all.
|
|
811
809
|
* @param {string} racine
|
|
812
|
-
* @param {string} [copie]
|
|
813
810
|
* @returns {string | null}
|
|
814
811
|
*/
|
|
815
|
-
export function verrouNonVersionne(racine
|
|
812
|
+
export function verrouNonVersionne(racine) {
|
|
816
813
|
if (!existsSync(path.join(racine, VERROU))) {
|
|
817
814
|
return `⛔ ${VERROU} absent : cargo generate-lockfile, puis git add ${VERROU}`;
|
|
818
815
|
}
|
|
819
|
-
// A tree
|
|
820
|
-
//
|
|
821
|
-
|
|
822
|
-
// else <racine>; with no git tree at hand, the lock is HEAD's and nothing is unversioned.
|
|
823
|
-
const depot = [copie, racine].find(d => existsSync(path.join(d, '.git')));
|
|
824
|
-
if (!depot) {
|
|
816
|
+
// A tree with no `.git` carries HEAD's Cargo.lock, versioned by construction: nothing is
|
|
817
|
+
// unversioned. The check runs git only in <racine> when it is a real git tree (grillhouse-uja).
|
|
818
|
+
if (!existsSync(path.join(racine, '.git'))) {
|
|
825
819
|
return null;
|
|
826
820
|
}
|
|
827
821
|
const r = spawnSync('git', ['ls-files', '--error-unmatch', '--', VERROU], {
|
|
828
|
-
cwd:
|
|
822
|
+
cwd: racine,
|
|
829
823
|
stdio: 'ignore',
|
|
830
824
|
});
|
|
831
825
|
return r.status === 0 ? null : `⛔ ${VERROU} non versionné : git add ${VERROU}`;
|
|
@@ -858,9 +852,8 @@ export function lancer(nom, args, { racine = process.cwd(), env = process.env }
|
|
|
858
852
|
}
|
|
859
853
|
}
|
|
860
854
|
const refus =
|
|
861
|
-
(VERROUILLEES.includes(nom)
|
|
862
|
-
|
|
863
|
-
: null) ?? (COMPILENT.includes(nom) ? sccacheAbsent(racine, env) : null);
|
|
855
|
+
(VERROUILLEES.includes(nom) ? verrouNonVersionne(racine) : null) ??
|
|
856
|
+
(COMPILENT.includes(nom) ? sccacheAbsent(racine, env) : null);
|
|
864
857
|
if (refus) {
|
|
865
858
|
process.stderr.write(`${refus}\n`);
|
|
866
859
|
return 2;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// The components of a workspace of cargo, as cargo itself describes them (`cargo metadata
|
|
2
2
|
// --format-version 1 --no-deps --offline`): the crates the module cargo answers the join with
|
|
3
3
|
// (scripts/jointure.d.ts, `composants`, `composantDe`, `matieres`, `joueDesTests`, `lecteurs`,
|
|
4
|
-
// `estUnTest
|
|
4
|
+
// `estUnTest`).
|
|
5
5
|
//
|
|
6
6
|
// - A component is a member of the workspace (`workspace_members`): its folder, the manifest's;
|
|
7
7
|
// its name and its package, the crate's name. A directory without a Cargo.toml at its root holds
|
|
@@ -29,13 +29,6 @@
|
|
|
29
29
|
// `tests.rs` under `src/`, and any file of a folder `tests/` under `src/`, is a unit test file,
|
|
30
30
|
// played with its crate when it is Rust; a file of a crate of the shared test material is
|
|
31
31
|
// material; any other file of a crate (the code of `src/`) is none of them.
|
|
32
|
-
// - HEAD's version of a test file plays in a tree of its own (`arbreDAvant`), never beside the
|
|
33
|
-
// file: a target `tests/<nom>.rs`, a target cargo finds by itself, its tree the copy's with that
|
|
34
|
-
// file replaced, built in the cargo target directory of the copy (`envDArbre`); none for
|
|
35
|
-
// `tests/<dossier>/main.rs` nor a unit test of `src/`, whose names of tests HEAD's version holds
|
|
36
|
-
// are read without playing them (`testsDeHead`, ./tests-de-head.mjs), the proof holding each for
|
|
37
|
-
// a green HEAD holds; those of a target `tests/<nom>.rs` too, when its tree no longer compiles
|
|
38
|
-
// (grillhouse-3e2.2).
|
|
39
32
|
// - What the testwriter writes of the manifests (`manifestes`): the tables that declare what the
|
|
40
33
|
// tests of a crate depend on, `[dev-dependencies]` and `[target.<cible>.dev-dependencies]` of
|
|
41
34
|
// its Cargo.toml (cargo's book, « Development dependencies »), as the author of a test of Bazel
|
|
@@ -55,7 +48,6 @@ import path from 'node:path';
|
|
|
55
48
|
import { isDeepStrictEqual } from 'node:util';
|
|
56
49
|
import { luUneFois } from '../../services-du-noyau.mjs';
|
|
57
50
|
import { cibleDeCompilation } from './sccache.mjs';
|
|
58
|
-
import { nomsDeHead } from './tests-de-head.mjs';
|
|
59
51
|
|
|
60
52
|
// The loader of the optional peers this module reads when it needs them (smol-toml), under the
|
|
61
53
|
// name by which knip reads a dependency.
|
|
@@ -270,97 +262,6 @@ export function estUnTest(chemin, racine) {
|
|
|
270
262
|
export const DE_NUIT = '_nuit';
|
|
271
263
|
export const BANC = '_budget';
|
|
272
264
|
|
|
273
|
-
/**
|
|
274
|
-
* Whether HEAD's version of the test file <chemin> (from the root <racine>) plays in a tree of its
|
|
275
|
-
* own, in the same proof as the lot's: a test target `tests/<nom>.rs`, a target cargo finds by
|
|
276
|
-
* itself (`autotests`), its `mod` of the same folder read as the file's; false for any other
|
|
277
|
-
* file: a target `tests/<dossier>/main.rs` holds its modules beside it, and a unit test of
|
|
278
|
-
* `src/` is compiled in its crate's module (`testsDeHead` reads their names).
|
|
279
|
-
* @param {string} chemin
|
|
280
|
-
* @param {string} racine
|
|
281
|
-
*/
|
|
282
|
-
export function arbreDAvant(chemin, racine) {
|
|
283
|
-
const abs = path.resolve(racine, chemin);
|
|
284
|
-
const c = composantDans(
|
|
285
|
-
crates(racine).map(x => x.composant),
|
|
286
|
-
racine,
|
|
287
|
-
abs
|
|
288
|
-
);
|
|
289
|
-
const parts = c ? path.relative(c.dossier, abs).split(path.sep) : [];
|
|
290
|
-
return parts.length === 2 && parts[0] === 'tests' && parts[1].endsWith('.rs');
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
/** The variable that names, to the launcher, the copy whose git tracks the `Cargo.lock` of a tree. */
|
|
294
|
-
export const COPIE_DE_L_ARBRE = 'GRILLHOUSE_COPIE_DE_L_ARBRE';
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* The environment a tree of HEAD's version plays under: the target directory of the copy's
|
|
298
|
-
* compilations, so that the tree builds there, whatever its place (`cibleDeCompilation`
|
|
299
|
-
* (./sccache.mjs) for a copy in the temporary directory, its `target/` otherwise; the caller's
|
|
300
|
-
* own `CARGO_TARGET_DIR` stays), and the copy itself (`COPIE_DE_L_ARBRE`), where git tracks the
|
|
301
|
-
* `Cargo.lock` the tree, which has no `.git`, carries.
|
|
302
|
-
* @param {string} _chemin
|
|
303
|
-
* @param {string} racine
|
|
304
|
-
* @returns {NodeJS.ProcessEnv}
|
|
305
|
-
*/
|
|
306
|
-
export function envDArbre(_chemin, racine) {
|
|
307
|
-
const cible = cibleDeCompilation(racine, process.env, { creer: false });
|
|
308
|
-
return {
|
|
309
|
-
...(process.env.CARGO_TARGET_DIR || cible.CARGO_TARGET_DIR
|
|
310
|
-
? cible
|
|
311
|
-
: { CARGO_TARGET_DIR: path.join(racine, 'target') }),
|
|
312
|
-
[COPIE_DE_L_ARBRE]: racine,
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* The names of the tests of HEAD's version of the test file <chemin> (from the root <racine>),
|
|
318
|
-
* read without playing them, for a file whose tree the proof does not play: a unit test file of
|
|
319
|
-
* `src/` (`tests.rs`, a file of a folder `tests/` under `src/`, out of `src/bin/`) and each file
|
|
320
|
-
* of a target `tests/<dossier>/main.rs`, its root and its modules (`tests/it/foo.rs`, the names
|
|
321
|
-
* `foo::…`), each its own tests as the verdict gives them (./tests-de-head.mjs,
|
|
322
|
-
* ./verdict.mjs), and a target `tests/<nom>.rs`, whose tree the
|
|
323
|
-
* proof plays unless it no longer compiles (grillhouse-3e2.2): its names as nextest gives them,
|
|
324
|
-
* without the target, its out-of-line modules read (`mod common;`, `common::<fn>`). <lire> gives
|
|
325
|
-
* HEAD's text of a file from the root. Null for any other file, or one HEAD does not hold.
|
|
326
|
-
* @param {string} chemin
|
|
327
|
-
* @param {string} racine
|
|
328
|
-
* @param {(f: string) => string | null} lire
|
|
329
|
-
*/
|
|
330
|
-
export function testsDeHead(chemin, racine, lire) {
|
|
331
|
-
const abs = path.resolve(racine, chemin);
|
|
332
|
-
const c = composantDans(
|
|
333
|
-
crates(racine).map(x => x.composant),
|
|
334
|
-
racine,
|
|
335
|
-
abs
|
|
336
|
-
);
|
|
337
|
-
if (!c || !chemin.endsWith('.rs')) {
|
|
338
|
-
return null;
|
|
339
|
-
}
|
|
340
|
-
const parts = path.relative(c.dossier, abs).split(path.sep);
|
|
341
|
-
// A file of a target `tests/<dossier>/main.rs`, out of the helpers of `tests/common/`.
|
|
342
|
-
if (parts.length >= 3 && parts[0] === 'tests' && parts[1] !== 'common') {
|
|
343
|
-
const module = parts.slice(2);
|
|
344
|
-
module[module.length - 1] = module[module.length - 1].replace(/\.rs$/, '');
|
|
345
|
-
if (module.at(-1) === 'mod' || (module.length === 1 && module[0] === 'main')) {
|
|
346
|
-
module.pop();
|
|
347
|
-
}
|
|
348
|
-
return nomsDeHead(chemin, module, lire);
|
|
349
|
-
}
|
|
350
|
-
if (arbreDAvant(chemin, racine)) {
|
|
351
|
-
return nomsDeHead(chemin, null, lire);
|
|
352
|
-
}
|
|
353
|
-
if (!unitaire(parts) || parts[1] === 'bin') {
|
|
354
|
-
return null;
|
|
355
|
-
}
|
|
356
|
-
const module = parts.slice(1);
|
|
357
|
-
module[module.length - 1] = module[module.length - 1].replace(/\.rs$/, '');
|
|
358
|
-
if (module.at(-1) === 'mod') {
|
|
359
|
-
module.pop();
|
|
360
|
-
}
|
|
361
|
-
return nomsDeHead(chemin, module, lire);
|
|
362
|
-
}
|
|
363
|
-
|
|
364
265
|
// The tables of a manifest that declare what its tests depend on.
|
|
365
266
|
const DES_TESTS = 'dev-dependencies';
|
|
366
267
|
|
|
@@ -201,37 +201,6 @@ function resultats(dans, taches, rapports, cibles) {
|
|
|
201
201
|
return dossier;
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
// HEAD's text of a unit test file of `src/`: two tests, one in an inline module, and braces and
|
|
205
|
-
// a false test in a comment, a raw string and a character, which are not counted.
|
|
206
|
-
const UNITAIRE = [
|
|
207
|
-
'use super::*;',
|
|
208
|
-
'// fn faux() { #[test]',
|
|
209
|
-
'#[test]',
|
|
210
|
-
'fn ancien() {',
|
|
211
|
-
' let _ = r#"{ #[test] fn dans_la_chaine() {} "#;',
|
|
212
|
-
" let _ = '{';",
|
|
213
|
-
'}',
|
|
214
|
-
'/* } #[test] fn commentee() {} */',
|
|
215
|
-
'mod groupe {',
|
|
216
|
-
' #[test]',
|
|
217
|
-
' #[ignore]',
|
|
218
|
-
' fn interne() {}',
|
|
219
|
-
'}',
|
|
220
|
-
'',
|
|
221
|
-
].join('\n');
|
|
222
|
-
// HEAD's text of a target `tests/<dossier>/main.rs`: a test, one under `#[tokio::test]` in an
|
|
223
|
-
// inline module, and an out-of-line module `aide`.
|
|
224
|
-
const PRINCIPAL = [
|
|
225
|
-
'mod aide;',
|
|
226
|
-
'#[test]',
|
|
227
|
-
'fn principal() {}',
|
|
228
|
-
'mod m {',
|
|
229
|
-
' #[tokio::test]',
|
|
230
|
-
' async fn dedans() {}',
|
|
231
|
-
'}',
|
|
232
|
-
'',
|
|
233
|
-
].join('\n');
|
|
234
|
-
|
|
235
204
|
export default {
|
|
236
205
|
// The trials under <dans>.
|
|
237
206
|
preparer(dans) {
|
|
@@ -365,48 +334,6 @@ export default {
|
|
|
365
334
|
'crates/matiere/src/lib.rs : matiere',
|
|
366
335
|
],
|
|
367
336
|
},
|
|
368
|
-
versionDeHead: {
|
|
369
|
-
valide: [
|
|
370
|
-
'crates/core/src/lib.rs',
|
|
371
|
-
'crates/core/src/tests.rs',
|
|
372
|
-
'crates/core/tests/common/mod.rs',
|
|
373
|
-
'crates/core/tests/scenario/main.rs',
|
|
374
|
-
'Cargo.toml',
|
|
375
|
-
],
|
|
376
|
-
// A target, a night test and a bench play in a tree, under their own name.
|
|
377
|
-
invalide: [
|
|
378
|
-
'crates/core/tests/t.rs',
|
|
379
|
-
'crates/core/tests/t_nuit.rs',
|
|
380
|
-
'crates/core/tests/t_budget.rs',
|
|
381
|
-
// A unit test of `src/` and a target `tests/<dossier>/main.rs` have no tree: the
|
|
382
|
-
// names of HEAD's tests are read, as nextest reports them (its module path), the
|
|
383
|
-
// braces of a comment, a string or a character not counted; each file of the target
|
|
384
|
-
// its own, as the verdict gives them: main.rs its tests, a module of it its own.
|
|
385
|
-
{
|
|
386
|
-
chemin: 'crates/core/src/rendu/tests.rs',
|
|
387
|
-
textes: { 'crates/core/src/rendu/tests.rs': UNITAIRE },
|
|
388
|
-
},
|
|
389
|
-
{
|
|
390
|
-
chemin: 'crates/core/tests/scenario/main.rs',
|
|
391
|
-
textes: {
|
|
392
|
-
'crates/core/tests/scenario/main.rs': PRINCIPAL,
|
|
393
|
-
'crates/core/tests/scenario/aide.rs': '#[test]\nfn aidant() {}\n',
|
|
394
|
-
},
|
|
395
|
-
},
|
|
396
|
-
{
|
|
397
|
-
chemin: 'crates/core/tests/scenario/aide.rs',
|
|
398
|
-
textes: { 'crates/core/tests/scenario/aide.rs': '#[test]\nfn aidant() {}\n' },
|
|
399
|
-
},
|
|
400
|
-
],
|
|
401
|
-
attendu: [
|
|
402
|
-
'crates/core/tests/t.rs → un arbre',
|
|
403
|
-
'crates/core/tests/t_nuit.rs → un arbre',
|
|
404
|
-
'crates/core/tests/t_budget.rs → un arbre',
|
|
405
|
-
'crates/core/src/rendu/tests.rs : rendu::tests::ancien, rendu::tests::groupe::interne',
|
|
406
|
-
'crates/core/tests/scenario/main.rs : principal, m::dedans',
|
|
407
|
-
'crates/core/tests/scenario/aide.rs : aide::aidant',
|
|
408
|
-
],
|
|
409
|
-
},
|
|
410
337
|
fichiersEngendres: {
|
|
411
338
|
valide: aJour,
|
|
412
339
|
invalide: enRetard,
|
|
@@ -45,9 +45,6 @@ import {
|
|
|
45
45
|
composantDans,
|
|
46
46
|
composants,
|
|
47
47
|
estUnTest,
|
|
48
|
-
arbreDAvant,
|
|
49
|
-
envDArbre,
|
|
50
|
-
testsDeHead,
|
|
51
48
|
joueDesTests,
|
|
52
49
|
lecteurs,
|
|
53
50
|
liensDuManifeste,
|
|
@@ -144,9 +141,6 @@ export default {
|
|
|
144
141
|
echecDeCompilation,
|
|
145
142
|
estUnTest,
|
|
146
143
|
horsDuJour: fichierHorsDuJour,
|
|
147
|
-
arbreDAvant,
|
|
148
|
-
envDArbre,
|
|
149
|
-
testsDeHead,
|
|
150
144
|
manifestes,
|
|
151
145
|
fichiersEngendres: () => [
|
|
152
146
|
{
|
|
@@ -68,9 +68,7 @@
|
|
|
68
68
|
// its end, a failed test included, never `mkdtemp` by hand.
|
|
69
69
|
// - Python writes its bytecode under one tree at the root, `__pycache__` (PYTHONPYCACHEPREFIX),
|
|
70
70
|
// which the envelope makes proper to the session (`sorties.propres` of ./index.mjs); uv the
|
|
71
|
-
// environment of each package under `.venv/<dossier>` at the root (UV_PROJECT_ENVIRONMENT
|
|
72
|
-
// tree of HEAD's version of the proof of the red, which `uv run --locked` reconciles with its own
|
|
73
|
-
// manifest and lock, reuses the copy's, under the folder `GRILLHOUSE_VENV_DE_LA_COPIE` names), and
|
|
71
|
+
// environment of each package under `.venv/<dossier>` at the root (UV_PROJECT_ENVIRONMENT), and
|
|
74
72
|
// pytest its cache under `.pytest_cache/<dossier>` (`cache_dir`), where the envelope opens them
|
|
75
73
|
// in writing, rather than in the package's folder, which a session whose plan does not write the
|
|
76
74
|
// package could not write; uv its cache under ~/.cache/grillhouse/uv (UV_CACHE_DIR), the frame's
|
|
@@ -135,8 +133,6 @@ export const DE_NUIT = '*_nuit_test.py';
|
|
|
135
133
|
export const PYCACHE = '__pycache__';
|
|
136
134
|
/** The environments of uv and the caches of pytest, one per package, at the root. */
|
|
137
135
|
export const VENV = '.venv';
|
|
138
|
-
/** The variable by which a tree of HEAD's version receives the copy's folder of environments. */
|
|
139
|
-
export const VENV_DE_LA_COPIE = 'GRILLHOUSE_VENV_DE_LA_COPIE';
|
|
140
136
|
export const CACHE_DE_PYTEST = '.pytest_cache';
|
|
141
137
|
|
|
142
138
|
/** The guards of the module: each its name and its script beside this one. */
|
|
@@ -208,12 +204,7 @@ function passe(racine, env) {
|
|
|
208
204
|
// <vert>, the codes that count green beside 0.
|
|
209
205
|
jouer({ t, args, cwd, programme }, vert = []) {
|
|
210
206
|
// The environment of uv of the package, at the root (`sorties` of ./index.mjs).
|
|
211
|
-
|
|
212
|
-
// and reuses its environment of the package.
|
|
213
|
-
const venv = path.join(
|
|
214
|
-
environnement[VENV_DE_LA_COPIE] || path.join(racine, VENV),
|
|
215
|
-
path.relative(racine, cwd)
|
|
216
|
-
);
|
|
207
|
+
const venv = path.join(racine, VENV, path.relative(racine, cwd));
|
|
217
208
|
const r = spawnSync(programme, args, {
|
|
218
209
|
cwd,
|
|
219
210
|
env: { ...environnement, UV_PROJECT_ENVIRONMENT: venv },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// The components of a project of Python, as uv finds a project (PEP 621, `pyproject.toml`): the
|
|
2
2
|
// packages the module python answers the join with (scripts/jointure.d.ts, `composants`,
|
|
3
|
-
// `composantDe`, `matieres`, `joueDesTests`, `lecteurs`, `estUnTest`, `
|
|
3
|
+
// `composantDe`, `matieres`, `joueDesTests`, `lecteurs`, `estUnTest`, `manifestes`,
|
|
4
4
|
// `entreesDeLIndex`).
|
|
5
5
|
//
|
|
6
6
|
// - A component is a folder that holds a pyproject.toml, found under the root, the folders whose
|
|
@@ -19,9 +19,7 @@
|
|
|
19
19
|
// any file under a folder `tests/` of a component, his helpers and his data. Of the manifests
|
|
20
20
|
// (`manifestes`): the group `test` of the table `[dependency-groups]` of a pyproject.toml (PEP
|
|
21
21
|
// 735), what the tests depend on, and the uv.lock of a component, which uv brings in line with
|
|
22
|
-
// it; a change of any other part of a pyproject.toml is named by it.
|
|
23
|
-
// file (`arbreDAvant`) plays in a tree of its own, under the file's name, which the proof of the
|
|
24
|
-
// red builds. The pyproject.toml is read
|
|
22
|
+
// it; a change of any other part of a pyproject.toml is named by it. The pyproject.toml is read
|
|
25
23
|
// with smol-toml, a tool of this module (`outils`), an optional peer of the package loaded when a
|
|
26
24
|
// manifest is judged.
|
|
27
25
|
// - The readers of a package: none read by the module (a dependency between two packages of
|
|
@@ -146,15 +144,6 @@ export function estUnTest(chemin, racine) {
|
|
|
146
144
|
return null;
|
|
147
145
|
}
|
|
148
146
|
|
|
149
|
-
/**
|
|
150
|
-
* Whether HEAD's version of the test file <chemin> (from <racine>) plays in a tree of its own,
|
|
151
|
-
* under the file's own name, so that its tests are named in its report as the file's, of its
|
|
152
|
-
* kind (day, night); false for a file pytest does not play.
|
|
153
|
-
*/
|
|
154
|
-
export function arbreDAvant(chemin, racine) {
|
|
155
|
-
return Boolean(estUnTest(chemin, racine)?.joue);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
147
|
// The parts of the parsed manifests <a> and <b> that differ, out of the group of the tests: each
|
|
159
148
|
// `[<table>]`, a group of `[dependency-groups]` as `[dependency-groups].<groupe>`, a key out of
|
|
160
149
|
// every table bare.
|
|
@@ -217,25 +217,6 @@ export default {
|
|
|
217
217
|
'site/tests/donnees.json : test',
|
|
218
218
|
],
|
|
219
219
|
},
|
|
220
|
-
versionDeHead: {
|
|
221
|
-
valide: [
|
|
222
|
-
'site/pages/generer.py',
|
|
223
|
-
'site/conftest.py',
|
|
224
|
-
'site/tests/donnees.json',
|
|
225
|
-
'README.md',
|
|
226
|
-
],
|
|
227
|
-
// A test file plays in a tree, under its own name, a night test as a night test.
|
|
228
|
-
invalide: [
|
|
229
|
-
'site/pages/test_pages.py',
|
|
230
|
-
'site/pages/pages_test.py',
|
|
231
|
-
'site/pages/site_nuit_test.py',
|
|
232
|
-
],
|
|
233
|
-
attendu: [
|
|
234
|
-
'site/pages/test_pages.py → un arbre',
|
|
235
|
-
'site/pages/pages_test.py → un arbre',
|
|
236
|
-
'site/pages/site_nuit_test.py → un arbre',
|
|
237
|
-
],
|
|
238
|
-
},
|
|
239
220
|
fichiersEngendres: {
|
|
240
221
|
valide: aJour,
|
|
241
222
|
invalide: enRetard,
|
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
// version (`binaires`, ./binaires.json). What uv, pytest and Python write in a project: `.venv`,
|
|
11
11
|
// `.pytest_cache`, `__pycache__` (`ignorer`).
|
|
12
12
|
// - Where they write, which the envelope opens to a session (`sorties`): in writing, `.venv` and
|
|
13
|
-
// `.pytest_cache` at the root
|
|
14
|
-
// environment of the copy, `GRILLHOUSE_VENV_DE_LA_COPIE`, `envDArbre`), where the commands make uv and pytest write for each package
|
|
13
|
+
// `.pytest_cache` at the root, where the commands make uv and pytest write for each package
|
|
15
14
|
// (./commandes.mjs), and uv's cache, `~/.cache/grillhouse/uv` (UV_CACHE_DIR, ./commandes.mjs: the
|
|
16
15
|
// frame's caches of compilation, never in the temporary directory); proper to the session, the
|
|
17
16
|
// tree of the bytecode at the root, `__pycache__` (PYTHONPYCACHEPREFIX, ./commandes.mjs); read,
|
|
@@ -35,14 +34,13 @@ import { readFileSync } from 'node:fs';
|
|
|
35
34
|
import path from 'node:path';
|
|
36
35
|
import { fileURLToPath } from 'node:url';
|
|
37
36
|
import { avecLeFichierDuPoste, empreintesDesTaches } from '../../services-du-noyau.mjs';
|
|
38
|
-
import { commandes, GARDES, PYCACHE
|
|
37
|
+
import { commandes, GARDES, PYCACHE } from './commandes.mjs';
|
|
39
38
|
import {
|
|
40
39
|
composantDans,
|
|
41
40
|
composants,
|
|
42
41
|
entreesDeLIndex,
|
|
43
42
|
estDeNuit,
|
|
44
43
|
estUnTest,
|
|
45
|
-
arbreDAvant,
|
|
46
44
|
joueDesTests,
|
|
47
45
|
lecteurs,
|
|
48
46
|
liensDuManifeste,
|
|
@@ -113,16 +111,6 @@ export default {
|
|
|
113
111
|
estUnTest,
|
|
114
112
|
// A night test, `*_nuit_test.py` (`estDeNuit`).
|
|
115
113
|
horsDuJour: chemin => estDeNuit(path.basename(chemin)),
|
|
116
|
-
arbreDAvant,
|
|
117
|
-
// Its tree reuses the uv environment of the copy: the folder of the environments, `<copie>/.venv`,
|
|
118
|
-
// under `GRILLHOUSE_VENV_DE_LA_COPIE`, the same for every file of a package (uv reconciles it with
|
|
119
|
-
// the manifest and lock of the tree, `uv run --locked`); a file out of every package gets none.
|
|
120
|
-
envDArbre: (chemin, racine) =>
|
|
121
|
-
composantDans(composants(racine), racine, chemin)
|
|
122
|
-
? { [VENV_DE_LA_COPIE]: path.join(racine, VENV) }
|
|
123
|
-
: {},
|
|
124
|
-
// Its tool plays HEAD's version of each test file in a tree (`arbreDAvant`): no name to read.
|
|
125
|
-
testsDeHead: () => null,
|
|
126
114
|
manifestes,
|
|
127
115
|
fichiersEngendres: () => [
|
|
128
116
|
{
|
|
@@ -227,22 +227,6 @@ export default {
|
|
|
227
227
|
'packages/m/src/index.ts : matiere',
|
|
228
228
|
],
|
|
229
229
|
},
|
|
230
|
-
versionDeHead: {
|
|
231
|
-
valide: ['packages/a/src/index.ts', 'packages/a/tests/aide.ts', 'README.md'],
|
|
232
|
-
// A night test and a bench keep their mark, so that their sibling plays as they do.
|
|
233
|
-
invalide: [
|
|
234
|
-
'packages/a/src/index.test.ts',
|
|
235
|
-
'packages/a/src/index.spec.mjs',
|
|
236
|
-
'packages/a/tests/tout.nuit.test.ts',
|
|
237
|
-
'packages/a/tests/vitesse.budget.test.ts',
|
|
238
|
-
],
|
|
239
|
-
attendu: [
|
|
240
|
-
'packages/a/src/index.test.ts → packages/a/src/index.circuit-avant.test.ts',
|
|
241
|
-
'packages/a/src/index.spec.mjs → packages/a/src/index.circuit-avant.spec.mjs',
|
|
242
|
-
'packages/a/tests/tout.nuit.test.ts → packages/a/tests/tout.circuit-avant.nuit.test.ts',
|
|
243
|
-
'packages/a/tests/vitesse.budget.test.ts → packages/a/tests/vitesse.circuit-avant.budget.test.ts',
|
|
244
|
-
],
|
|
245
|
-
},
|
|
246
230
|
fichiersEngendres: {
|
|
247
231
|
valide: aJour,
|
|
248
232
|
invalide: enRetard,
|