@roomi-fields/grillhouse 0.51.0 → 0.53.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 +68 -0
- package/agents/direct.md +1 -1
- package/cadre/templates/projet/vitest.config.cjs +45 -0
- package/charte/plan.md +47 -0
- package/charte/preuve.md +39 -0
- package/charte/superviseur.md +60 -0
- package/charte/tests.md +38 -0
- package/charte.md +23 -178
- package/dist/temporal/circuit/appel.d.ts +2 -0
- package/dist/temporal/circuit/appel.js +24 -2
- package/dist/temporal/circuit/appel.js.map +1 -1
- package/dist/temporal/circuit/client.d.ts +15 -7
- package/dist/temporal/circuit/client.js +42 -11
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/commande.js +17 -6
- package/dist/temporal/circuit/commande.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +9 -0
- package/dist/temporal/circuit/contrat.js +6 -0
- package/dist/temporal/circuit/contrat.js.map +1 -1
- package/dist/temporal/circuit/deroule.js +25 -4
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/client.d.ts +35 -1
- package/dist/temporal/client.js +144 -1
- package/dist/temporal/client.js.map +1 -1
- package/dist/temporal/commande.js +31 -13
- package/dist/temporal/commande.js.map +1 -1
- package/dist/temporal/etat.d.ts +3 -1
- package/dist/temporal/etat.js +31 -17
- package/dist/temporal/etat.js.map +1 -1
- package/dist/temporal/file/activites.js +1 -1
- package/dist/temporal/file/activites.js.map +1 -1
- package/dist/temporal/file/contrat.d.ts +4 -5
- package/dist/temporal/file/contrat.js +2 -2
- package/dist/temporal/file/contrat.js.map +1 -1
- package/dist/temporal/file/deroule.js +7 -5
- package/dist/temporal/file/deroule.js.map +1 -1
- package/dist/temporal/installation.d.ts +103 -53
- package/dist/temporal/installation.js +842 -237
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/nuits/deroule.js +3 -1
- package/dist/temporal/nuits/deroule.js.map +1 -1
- package/dist/temporal/places/deroule.js +2 -1
- package/dist/temporal/places/deroule.js.map +1 -1
- package/dist/temporal/sonde/deroule.js +2 -1
- package/dist/temporal/sonde/deroule.js.map +1 -1
- package/dist/temporal/tickets/deroule.js +4 -3
- package/dist/temporal/tickets/deroule.js.map +1 -1
- package/dist/temporal/travailleur.d.ts +7 -1
- package/dist/temporal/travailleur.js +49 -25
- package/dist/temporal/travailleur.js.map +1 -1
- package/docs/INTERFACE.md +20 -14
- package/docs/architecture/circuit.md +19 -16
- package/docs/architecture/entree.md +8 -9
- package/docs/architecture/greffon.md +54 -20
- package/docs/architecture/installation.md +99 -60
- package/docs/architecture/machine.md +31 -4
- package/docs/architecture/tests.md +22 -8
- package/docs/lexique.md +12 -3
- package/hooks/hooks.json +10 -10
- package/hooks/register.tsx +84 -2
- package/package.json +4 -2
- package/scripts/activites.mjs +25 -9
- package/scripts/aiguillage.mjs +1 -1
- package/scripts/attente-au-tour.mjs +2 -3
- package/scripts/bilan.mjs +116 -56
- package/scripts/bilans-gardes.mjs +37 -0
- package/scripts/circuit.mjs +256 -42
- package/scripts/circuits-du-serveur.mjs +3 -2
- package/scripts/circuits-tenus.d.mts +7 -0
- package/scripts/circuits-tenus.mjs +17 -0
- package/scripts/copie-de-montee.mjs +354 -0
- package/scripts/copies-du-depot.d.mts +13 -0
- package/scripts/copies-du-depot.mjs +66 -0
- package/scripts/copies-finies.mjs +6 -40
- package/scripts/crochets.mjs +16 -2
- package/scripts/direct.mjs +2 -2
- package/scripts/droits.mjs +117 -38
- package/scripts/engendres.mjs +5 -3
- package/scripts/entree-de-seance.mjs +35 -0
- package/scripts/enveloppe/enveloppe.mjs +23 -16
- package/scripts/enveloppe/lancer.sh +32 -22
- package/scripts/enveloppe/travail-de-la-copie.mjs +154 -0
- package/scripts/etapes.mjs +11 -3
- package/scripts/faits-du-circuit.mjs +12 -5
- package/scripts/file-des-tickets.d.mts +13 -2
- package/scripts/file-des-tickets.mjs +44 -12
- package/scripts/greffons.mjs +42 -27
- package/scripts/grillhouse-maj.mjs +105 -85
- package/scripts/init.mjs +1 -1
- package/scripts/integration/file.mjs +5 -2
- package/scripts/integration/integrer.mjs +14 -4
- package/scripts/jointure.d.ts +18 -1
- package/scripts/langages/c/commandes.mjs +17 -7
- package/scripts/langages/cargo/commandes.mjs +87 -34
- package/scripts/langages/cargo/index.mjs +6 -3
- package/scripts/langages/cargo/sccache.mjs +15 -12
- package/scripts/langages/python/commandes.mjs +68 -15
- package/scripts/langages/python/squelette.mjs +4 -3
- package/scripts/langages/typescript/configurations-de-vitest.mjs +118 -0
- package/scripts/langages/typescript/index.mjs +14 -12
- package/scripts/langages/typescript/migrations/configurations-en-commonjs.mjs +299 -0
- package/scripts/langages/typescript/squelette.mjs +20 -17
- package/scripts/langages/typescript/tests-de-nuit.mjs +3 -3
- package/scripts/langages/typescript/turbo-des-paquets.mjs +76 -39
- package/scripts/langages/typescript/verifier.mjs +27 -2
- package/scripts/langages/typescript/vitest-config/base.mjs +1 -1
- package/scripts/langages/typescript/vitest-config/bornes.mjs +1 -1
- package/scripts/langages/typescript/vitest-config/cibles.mjs +2 -2
- package/scripts/langages/typescript/{vitest.nuit.config.mjs → vitest.nuit.config.cjs} +61 -50
- package/scripts/mesure/pression.mjs +5 -3
- package/scripts/migrations/serveurs-de-l-index.mjs +1 -1
- package/scripts/migrations/suivi-du-superviseur-retire.mjs +56 -0
- package/scripts/migrations.mjs +2 -0
- package/scripts/montee.mjs +524 -0
- package/scripts/nuit.sh +3 -2
- package/scripts/outil.mjs +5 -3
- package/scripts/paquet-npm.mjs +22 -0
- package/scripts/paquet.mjs +5 -5
- package/scripts/pre-compact.mjs +25 -0
- package/scripts/reponses-du-circuit.d.mts +17 -2
- package/scripts/reponses-du-circuit.mjs +78 -20
- package/scripts/resultats.mjs +42 -14
- package/scripts/retirer-les-copies-finies.mjs +4 -7
- package/scripts/seances.mjs +81 -29
- package/scripts/services-du-noyau.mjs +7 -2
- package/scripts/session-start.sh +19 -10
- package/scripts/sortie-de-seance.mjs +70 -0
- package/scripts/sortie.mjs +4 -7
- package/scripts/sous-commandes.mjs +1 -1
- package/scripts/superviseur.mjs +417 -159
- package/scripts/tableau.mjs +249 -152
- package/scripts/ticket-du-circuit.mjs +22 -0
- package/scripts/transitions.d.mts +6 -9
- package/scripts/transitions.mjs +123 -36
- package/scripts/verrou-de-fichier.d.mts +11 -0
- package/skills/direct/SKILL.md +21 -11
- package/skills/explorateur/SKILL.md +8 -3
- package/skills/grill/SKILL.md +11 -8
- package/skills/grill/references/paquets.md +4 -4
- package/skills/pitmaster/SKILL.md +99 -53
- package/skills/pitmaster/references/cadre.md +1 -1
- package/skills/pitmaster/references/consigne-agent.md +1 -1
- package/skills/pitmaster/references/tour.md +6 -5
- package/skills/relecteur/SKILL.md +9 -2
- package/skills/testwriter/SKILL.md +3 -3
- package/cadre/templates/projet/pitmaster/SUIVI.md +0 -22
- package/cadre/templates/projet/vitest.config.ts +0 -44
- package/scripts/attente-a-l-arret.mjs +0 -114
|
@@ -61,11 +61,20 @@
|
|
|
61
61
|
// names the file of a bench plays it, as Bazel builds a target tagged `manual` when named; a path
|
|
62
62
|
// that names a night test is refused, named, and nothing plays (code 2): the night alone plays
|
|
63
63
|
// it; a folder named leaves them out, as the day does.
|
|
64
|
+
// - A time budget bench is built and played under cargo's profile `bench`, so that it measures
|
|
65
|
+
// optimized code: a build of its own (`cargo test --no-run --profile bench` on the benches of
|
|
66
|
+
// the crate alone, a task `build` with its log `<target>/grillhouse/<crate>-build-bench.log`),
|
|
67
|
+
// then `cargo nextest run --cargo-profile bench`; the other tests keep the profile `test`. A
|
|
68
|
+
// build of benches that fails leaves its benches not played; a build under the profile `test`
|
|
69
|
+
// that fails leaves the crate's build of benches and its benches not played. Every build of
|
|
70
|
+
// benches of a pass comes before the first bench played.
|
|
64
71
|
// - A time budget bench plays alone, one test at a time (`--test-threads 1`), in a task `budget` of
|
|
65
|
-
// its own after the other tests: in `tests-de-nuit` and in a path that names it.
|
|
66
|
-
//
|
|
67
|
-
//
|
|
68
|
-
//
|
|
72
|
+
// its own after the other tests: in `tests-de-nuit` and in a path that names it. Before it, the
|
|
73
|
+
// module waits for the rest of the machine (`attendreLeRepos` of ./jointure), one minute at
|
|
74
|
+
// most, or `GRILLHOUSE_ATTENTE_REPOS_MS` milliseconds; at the bound, or on a pressure that does
|
|
75
|
+
// not read, the bench plays all the same. A red of the task while the CPU pressure of the machine
|
|
76
|
+
// (`lirePression` of ./jointure) is at or above its threshold at its start or at its end is « à
|
|
77
|
+
// repasser », 75, said in one line with the pressure; at rest, a red.
|
|
69
78
|
// - `verifier` plays the tests of the crates as the tasks of Turborepo (`turbo run test:unit
|
|
70
79
|
// --filter=<crate>…`, each crate a package of the graph, the cache of the tasks selecting those
|
|
71
80
|
// that play again; `--tout` plays them for real, the moment of the pass in the variable
|
|
@@ -123,6 +132,7 @@
|
|
|
123
132
|
//
|
|
124
133
|
// Mechanism: packages/grillhouse/docs/architecture/tests.md §3.3 (the modules of language), §3.4
|
|
125
134
|
// (the guards); `GRILLHOUSE_TESTS` and `GRILLHOUSE_RESULTATS` are data of a pass (tests.md §4.2),
|
|
135
|
+
// `GRILLHOUSE_ATTENTE_REPOS_MS` and `GRILLHOUSE_PRESSION_CPU` data of the trials,
|
|
126
136
|
// and the code applies no key of the project (installation.md §4.2) nor file of the post (§4.3).
|
|
127
137
|
import { spawnSync } from 'node:child_process';
|
|
128
138
|
import {
|
|
@@ -142,12 +152,14 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
|
142
152
|
import { RESULTATS } from '../../resultats.mjs';
|
|
143
153
|
import {
|
|
144
154
|
AttenteDeLaMachine,
|
|
155
|
+
attendreLeRepos,
|
|
145
156
|
surUnePart,
|
|
146
157
|
avecLaPasse,
|
|
147
158
|
cheminsDeLaTache,
|
|
148
159
|
construireDepuisLesArguments,
|
|
149
160
|
constructionDuGraphe,
|
|
150
161
|
ecrirePression,
|
|
162
|
+
gesteDuPackageJson,
|
|
151
163
|
GRAPHE_JOUE,
|
|
152
164
|
joueCeQuiNeSeDivisePas,
|
|
153
165
|
lancerLesTaches,
|
|
@@ -196,6 +208,10 @@ const AUCUN_HORS_DU_POSTE = 'aucun test hors du poste';
|
|
|
196
208
|
const RACINE = '//';
|
|
197
209
|
// The task of the time budget benches of a crate.
|
|
198
210
|
const BUDGET = 'budget';
|
|
211
|
+
// The longest wait for rest before a bench, and the variable that sets it, in ms (a datum of the
|
|
212
|
+
// trials, as GRILLHOUSE_PRESSION_CPU).
|
|
213
|
+
const ATTENTE_DU_BANC_MS = 60_000;
|
|
214
|
+
const VARIABLE_ATTENTE = 'GRILLHOUSE_ATTENTE_REPOS_MS';
|
|
199
215
|
const VERROU = 'Cargo.lock';
|
|
200
216
|
// The commands that play the exact versions of the repository, refused without its Cargo.lock.
|
|
201
217
|
const VERROUILLEES = ['tests-du-paquet', 'verifier', 'tests-de-nuit'];
|
|
@@ -282,6 +298,20 @@ function passe(racine, env) {
|
|
|
282
298
|
const compilation = avecSccache(racine, env);
|
|
283
299
|
// The CPU pressure of the machine, the file <env> names or the kernel's.
|
|
284
300
|
const pression = () => lirePression(env.GRILLHOUSE_PRESSION_CPU || undefined);
|
|
301
|
+
// Waits for the rest of the machine before a bench, so that the load of the builds of the pass,
|
|
302
|
+
// once fallen, leaves a red bench red; at the bound, the bench plays all the same.
|
|
303
|
+
const attendre = () => {
|
|
304
|
+
const posee = env[VARIABLE_ATTENTE];
|
|
305
|
+
const borne = posee ? Number(posee) : ATTENTE_DU_BANC_MS;
|
|
306
|
+
if (!Number.isFinite(borne) || borne < 0) {
|
|
307
|
+
throw new Error(`⛔ ${VARIABLE_ATTENTE} : « ${posee} » n'est pas un temps en millisecondes.`);
|
|
308
|
+
}
|
|
309
|
+
attendreLeRepos({
|
|
310
|
+
lire: pression,
|
|
311
|
+
limite: Date.now() + borne,
|
|
312
|
+
dire: l => process.stderr.write(`${l}\n`),
|
|
313
|
+
});
|
|
314
|
+
};
|
|
285
315
|
const ecrire = () => {
|
|
286
316
|
if (!dossier) {
|
|
287
317
|
return;
|
|
@@ -334,6 +364,9 @@ function passe(racine, env) {
|
|
|
334
364
|
return t.code;
|
|
335
365
|
}
|
|
336
366
|
const banc = t.script === BUDGET;
|
|
367
|
+
if (banc) {
|
|
368
|
+
attendre();
|
|
369
|
+
}
|
|
337
370
|
const avant = banc ? pression() : null;
|
|
338
371
|
let r;
|
|
339
372
|
if (journal) {
|
|
@@ -457,8 +490,10 @@ export const partitionDeNextest = tranche =>
|
|
|
457
490
|
// the test targets named, empty for the whole crate of the day (its night tests and its benches
|
|
458
491
|
// left out). For a crate that plays tests:
|
|
459
492
|
// the build of its test targets first, then nextest, then its doctests; a failed build leaves the
|
|
460
|
-
// crate's other tasks not played. The benches named, each crate's
|
|
461
|
-
//
|
|
493
|
+
// crate's other tasks not played. The benches named, each crate's built under cargo's profile
|
|
494
|
+
// `bench` in a task `build` of its own and played in a task `budget`, are planned with the rest
|
|
495
|
+
// and played by the function this one returns, after the other tests: every build of benches
|
|
496
|
+
// first, then the benches whose build is green.
|
|
462
497
|
// In a tranche <tranche>, nextest plays its part (`partitionDeNextest`); the doctests and the
|
|
463
498
|
// benches, which nextest does not split, play in the first tranche alone. With <videVert>, a run
|
|
464
499
|
// of nextest whose filter keeps no test is green, and said.
|
|
@@ -483,7 +518,7 @@ function jouerLesTests(
|
|
|
483
518
|
const j = travailleurs === null ? [] : ['-j', String(travailleurs)];
|
|
484
519
|
// A bench plays on one thread (`--test-threads 1`, which `-j` of nextest is the alias of): it
|
|
485
520
|
// takes the arguments without `-j`.
|
|
486
|
-
const nextestDuBanc = [...nextest];
|
|
521
|
+
const nextestDuBanc = ['nextest', 'run', '--cargo-profile', 'bench', ...nextest.slice(2)];
|
|
487
522
|
nextest.push(...j, ...partitionDeNextest(tranche));
|
|
488
523
|
const indivisible = joueCeQuiNeSeDivisePas(tranche);
|
|
489
524
|
const parCrate = [];
|
|
@@ -505,18 +540,25 @@ function jouerLesTests(
|
|
|
505
540
|
const deBanc = n => tests.some(t => t.name === n && horsDuJour(t) === 'banc');
|
|
506
541
|
const desBancs = cibles.filter(deBanc);
|
|
507
542
|
const autres = cibles.filter(n => !deBanc(n));
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
543
|
+
// The build of the targets `noms` (every test target without one) under the options
|
|
544
|
+
// `profil` of cargo, planned with its log `<crate>-<journal>.log`.
|
|
545
|
+
const construire = (journal, profil, noms) => {
|
|
546
|
+
const args = [
|
|
547
|
+
'test',
|
|
548
|
+
'--no-run',
|
|
549
|
+
...profil,
|
|
550
|
+
MESSAGES,
|
|
551
|
+
...j,
|
|
552
|
+
'-p',
|
|
553
|
+
nom,
|
|
554
|
+
...noms.flatMap(n => ['--test', n]),
|
|
555
|
+
];
|
|
556
|
+
const sortie = path.join(m.target_directory, 'grillhouse', `${nom}-${journal}.log`);
|
|
557
|
+
return [p.prevoir(nom, d, 'build', false, args), { journal: sortie, executables }];
|
|
558
|
+
};
|
|
559
|
+
// A run that names benches alone builds nothing under the profile `test`.
|
|
519
560
|
if (cibles.length === 0 || autres.length || avecLeJour) {
|
|
561
|
+
prevues.push(construire('build', [], avecLeJour ? [] : autres));
|
|
520
562
|
const duC = duJour(c);
|
|
521
563
|
const nommes = autres.flatMap(n => ['--test', n]);
|
|
522
564
|
const selection = !cibles.length
|
|
@@ -552,6 +594,7 @@ function jouerLesTests(
|
|
|
552
594
|
...filtreDesModules(nom, desBancs, modules),
|
|
553
595
|
];
|
|
554
596
|
bancs.push({
|
|
597
|
+
construction: construire('build-bench', ['--profile', 'bench'], desBancs),
|
|
555
598
|
nom,
|
|
556
599
|
d,
|
|
557
600
|
temporaire: temporaire(nom),
|
|
@@ -567,11 +610,10 @@ function jouerLesTests(
|
|
|
567
610
|
}
|
|
568
611
|
parCrate.push([prevues, etat]);
|
|
569
612
|
}
|
|
570
|
-
const prevusBancs = bancs.map(b =>
|
|
571
|
-
|
|
572
|
-
b.
|
|
573
|
-
|
|
574
|
-
]);
|
|
613
|
+
const prevusBancs = bancs.map(b => ({
|
|
614
|
+
...b,
|
|
615
|
+
tache: p.prevoir(b.nom, b.d, BUDGET, true, b.args),
|
|
616
|
+
}));
|
|
575
617
|
for (const [prevues, etat] of parCrate) {
|
|
576
618
|
for (const [t, o] of prevues) {
|
|
577
619
|
if (p.jouer(t, o) !== 0 && t.t.script === 'build') {
|
|
@@ -581,10 +623,12 @@ function jouerLesTests(
|
|
|
581
623
|
}
|
|
582
624
|
}
|
|
583
625
|
return () => {
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
626
|
+
// A crate whose build under the profile `test` failed builds no bench.
|
|
627
|
+
const construits = prevusBancs.filter(
|
|
628
|
+
b => b.etat.construit && p.jouer(...b.construction) === 0
|
|
629
|
+
);
|
|
630
|
+
for (const { tache, temporaire } of construits) {
|
|
631
|
+
p.jouer(tache, { junit, temporaire });
|
|
588
632
|
}
|
|
589
633
|
// The copy keeps no test executable between two passes: cargo builds again the one it misses.
|
|
590
634
|
for (const f of executables) {
|
|
@@ -734,7 +778,7 @@ function nomsDuGraphe(racine, crates) {
|
|
|
734
778
|
for (const c of crates) {
|
|
735
779
|
const nom = nomDuPaquet(racine, c.composant.dossier);
|
|
736
780
|
if (nom === null) {
|
|
737
|
-
absents.push(c.composant
|
|
781
|
+
absents.push(c.composant);
|
|
738
782
|
} else {
|
|
739
783
|
noms.add(nom);
|
|
740
784
|
}
|
|
@@ -744,14 +788,20 @@ function nomsDuGraphe(racine, crates) {
|
|
|
744
788
|
|
|
745
789
|
// Says, on the error stream, each crate of <absents> that is no package of the graph: its tests do
|
|
746
790
|
// not play, as a package without a `package.json` is out of Turborepo's tasks.
|
|
747
|
-
function direLesAbsents(absents) {
|
|
748
|
-
for (const
|
|
791
|
+
function direLesAbsents(racine, absents) {
|
|
792
|
+
for (const c of absents) {
|
|
749
793
|
process.stderr.write(
|
|
750
|
-
`⚠️ ${nom} : pas un paquet du graphe (package.json absent) ; ses tests ne se jouent pas
|
|
794
|
+
`⚠️ ${c.nom} : pas un paquet du graphe (package.json absent) ; ses tests ne se jouent pas${suiteDuGeste(racine, c)}\n`
|
|
751
795
|
);
|
|
752
796
|
}
|
|
753
797
|
}
|
|
754
798
|
|
|
799
|
+
// The gesture by hand for the component <c> that is no package of the graph, as the end of its line.
|
|
800
|
+
function suiteDuGeste(racine, c) {
|
|
801
|
+
const geste = gesteDuPackageJson(racine, c.dossier, c.paquet ?? c.nom);
|
|
802
|
+
return geste ? ` : ${geste}` : '.';
|
|
803
|
+
}
|
|
804
|
+
|
|
755
805
|
// The pass of `verifier` in <racine>, under the lock of the machine (<env> carries its mark): the
|
|
756
806
|
// tests of the crates as tasks of Turborepo (every one played for real with <args> `--tout`), then
|
|
757
807
|
// cargo deny. It keeps no green.
|
|
@@ -764,7 +814,7 @@ function verifier(racine, args, env) {
|
|
|
764
814
|
const { noms, absents } = env[GRAPHE_JOUE]
|
|
765
815
|
? { noms: new Set(), absents: [] }
|
|
766
816
|
: nomsDuGraphe(racine, crates(racine));
|
|
767
|
-
direLesAbsents(absents);
|
|
817
|
+
direLesAbsents(racine, absents);
|
|
768
818
|
const code = noms.size
|
|
769
819
|
? lancerLesTaches({
|
|
770
820
|
outil: OUTIL,
|
|
@@ -975,11 +1025,14 @@ function tester(racine, tous, args, env) {
|
|
|
975
1025
|
const { noms, absents } = nomsDuGraphe(racine, choisis);
|
|
976
1026
|
if (chemins.length && absents.length) {
|
|
977
1027
|
process.stderr.write(
|
|
978
|
-
`⛔ ${absents.join(', ')} : pas un paquet du graphe (package.json absent)
|
|
1028
|
+
`⛔ ${absents.map(c => c.nom).join(', ')} : pas un paquet du graphe (package.json absent)\n`
|
|
979
1029
|
);
|
|
1030
|
+
for (const c of absents) {
|
|
1031
|
+
process.stderr.write(`${c.nom}${suiteDuGeste(racine, c)}\n`);
|
|
1032
|
+
}
|
|
980
1033
|
return 2;
|
|
981
1034
|
}
|
|
982
|
-
direLesAbsents(absents);
|
|
1035
|
+
direLesAbsents(racine, absents);
|
|
983
1036
|
if (noms.size === 0) {
|
|
984
1037
|
return 0;
|
|
985
1038
|
}
|
|
@@ -61,7 +61,7 @@ import { miseAJour } from './mise-a-jour.mjs';
|
|
|
61
61
|
import * as taillesDesTests from './migrations/0.28.4-tailles-des-tests.mjs';
|
|
62
62
|
import * as executablesDeTests from './migrations/0.34.0-executables-de-tests.mjs';
|
|
63
63
|
import { squelette } from './squelette.mjs';
|
|
64
|
-
import { CACHE, CIBLES } from './sccache.mjs';
|
|
64
|
+
import { CACHE, CIBLES, DOSSIER_DU_LANCEUR } from './sccache.mjs';
|
|
65
65
|
import { echecDeCompilation, verdict } from './verdict.mjs';
|
|
66
66
|
|
|
67
67
|
// The scripts of this module, beside this file.
|
|
@@ -94,8 +94,10 @@ export default {
|
|
|
94
94
|
// registry's index and sources, the git dependencies, cargo-deny's advisories, and the files of
|
|
95
95
|
// its locks and of the SQLite cache of its packages (`.package-cache`, `.package-cache-mutate`,
|
|
96
96
|
// `.global-cache`), files without a trailing `/`; the cache of sccache, common to the copies
|
|
97
|
-
// (./sccache.mjs), where a server of sccache the session starts writes; the
|
|
98
|
-
//
|
|
97
|
+
// (./sccache.mjs), where a server of sccache the session starts writes; the directory of the
|
|
98
|
+
// wrapper of rustc, out of that cache, which a run of the session writes when it is missing
|
|
99
|
+
// (./sccache.mjs); the targets of the workspaces rooted in the temporary directory,
|
|
100
|
+
// `~/.cache/grillhouse/cargo/` (./sccache.mjs). What it reads, read-only: its home, `~/.cargo`
|
|
99
101
|
// (its binaries, its `env`, which the shells source, and its configuration stay unwritten), and
|
|
100
102
|
// rustup's toolchains, `~/.rustup`.
|
|
101
103
|
sorties: {
|
|
@@ -108,6 +110,7 @@ export default {
|
|
|
108
110
|
'~/.cargo/.package-cache-mutate',
|
|
109
111
|
'~/.cargo/.global-cache',
|
|
110
112
|
CACHE,
|
|
113
|
+
DOSSIER_DU_LANCEUR,
|
|
111
114
|
CIBLES,
|
|
112
115
|
],
|
|
113
116
|
propres: [],
|
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
// temporary directory of a pass of tests under the working directory of a session passes them
|
|
44
44
|
// (grillhouse-qmk, OSC Bridge OB-p58). Cargo then finds the server running and starts none; it
|
|
45
45
|
// keeps its own temporary directory, the pass's. Its wrapper still runs the client under `/tmp`
|
|
46
|
-
// (`lanceurCourt
|
|
46
|
+
// (`lanceurCourt`, a file of its own directory, ~/.cache/grillhouse/sccache-lanceur, out of
|
|
47
|
+
// `SCCACHE_DIR`, whose oldest files sccache removes past its size, whatever they are): a client that must start the server itself, which cargo's long TMPDIR
|
|
47
48
|
// would break, binds its socket there (grillhouse-3uv.239, OSD-sf1.25.1). The two ends of the
|
|
48
49
|
// start are so short whoever begins it, rather than one more rescue of the first.
|
|
49
50
|
// - That wrapper changes nothing else of what rustc sees: it is run by bash, which hands on every
|
|
@@ -89,6 +90,10 @@ const require = createRequire(import.meta.url);
|
|
|
89
90
|
/** The cache of sccache, from the home: what the envelope opens in writing. */
|
|
90
91
|
export const CACHE = '~/.cache/grillhouse/sccache/';
|
|
91
92
|
|
|
93
|
+
/** The directory of the wrapper of rustc (`lanceurCourt`), from the home: what the envelope opens
|
|
94
|
+
* in writing, out of the cache sccache prunes. */
|
|
95
|
+
export const DOSSIER_DU_LANCEUR = '~/.cache/grillhouse/sccache-lanceur/';
|
|
96
|
+
|
|
92
97
|
/** The targets of the workspaces rooted in the temporary directory, from the home: what the
|
|
93
98
|
* envelope opens in writing (`cibleDeCompilation`). */
|
|
94
99
|
export const CIBLES = '~/.cache/grillhouse/cargo/';
|
|
@@ -136,16 +141,15 @@ function lanceurDuProjet(racine, env) {
|
|
|
136
141
|
// `-p`: bash reads no startup file of the caller (`BASH_ENV`) and imports none of its functions.
|
|
137
142
|
const LANCEUR = '#!/bin/bash -p\nTMPDIR=/tmp exec sccache "$@"\n';
|
|
138
143
|
|
|
139
|
-
// The wrapper of rustc of the run: a script of the
|
|
144
|
+
// The wrapper of rustc of the run: a script of the directory <dossier> that runs sccache under
|
|
140
145
|
// the machine's `COURT` temporary directory. Cargo hands its wrapper its own TMPDIR, which a
|
|
141
146
|
// client that has to start the server (a server stopped by its idle time, killed, or born in
|
|
142
147
|
// another envelope) binds a socket under, refused past 108 bytes of a path (« path must be
|
|
143
|
-
// shorter than SUN_LEN », OSD-sf1.25.1); the compilations keep cargo's TMPDIR.
|
|
144
|
-
//
|
|
145
|
-
//
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
const fichier = path.join(cache, 'sccache-court-bash');
|
|
148
|
+
// shorter than SUN_LEN », OSD-sf1.25.1); the compilations keep cargo's TMPDIR. <dossier> is out of
|
|
149
|
+
// `SCCACHE_DIR`, which sccache owns and prunes. Written when missing, then read: a file cannot
|
|
150
|
+
// carry an executable bit in a package, so the script is made here.
|
|
151
|
+
function lanceurCourt(dossier) {
|
|
152
|
+
const fichier = path.join(dossier, 'sccache-court-bash');
|
|
149
153
|
try {
|
|
150
154
|
if (readFileSync(fichier, 'utf8') === LANCEUR && (statSync(fichier).mode & 0o111) !== 0) {
|
|
151
155
|
return fichier;
|
|
@@ -153,7 +157,7 @@ function lanceurCourt(cache) {
|
|
|
153
157
|
} catch {
|
|
154
158
|
// Absent: written below.
|
|
155
159
|
}
|
|
156
|
-
mkdirSync(
|
|
160
|
+
mkdirSync(dossier, { recursive: true });
|
|
157
161
|
const temporaire = `${fichier}.${process.pid}`;
|
|
158
162
|
writeFileSync(temporaire, LANCEUR, { mode: 0o755 });
|
|
159
163
|
renameSync(temporaire, fichier);
|
|
@@ -304,12 +308,11 @@ export function avecSccache(racine, env) {
|
|
|
304
308
|
if (lanceurDuProjet(racine, env)) {
|
|
305
309
|
return { ...env, ...cible };
|
|
306
310
|
}
|
|
307
|
-
const cache = cacheDeCompilation('sccache', env);
|
|
308
311
|
return {
|
|
309
312
|
...env,
|
|
310
313
|
...cible,
|
|
311
|
-
RUSTC_WRAPPER: lanceurCourt(
|
|
312
|
-
SCCACHE_DIR:
|
|
314
|
+
RUSTC_WRAPPER: lanceurCourt(cacheDeCompilation('sccache-lanceur', env)),
|
|
315
|
+
SCCACHE_DIR: cacheDeCompilation('sccache', env),
|
|
313
316
|
SCCACHE_SERVER_UDS: socketDuServeur(racine, env.TMPDIR || tmpdir()),
|
|
314
317
|
};
|
|
315
318
|
}
|
|
@@ -28,8 +28,13 @@
|
|
|
28
28
|
// - `tests-du-paquet <chemin>…` is the body of that task, which the `test:unit` script of a project
|
|
29
29
|
// calls (`grillhouse tests-du-paquet <dossier du projet>`, written with the package): it never
|
|
30
30
|
// runs Turborepo, so `tester` and the task do not loop. It plays pytest in the project:
|
|
31
|
-
// `uv run --locked --group test pytest`, the
|
|
32
|
-
//
|
|
31
|
+
// `uv run --locked --group test <racine>/.venv/<dossier>/bin/pytest`, the pytest of the
|
|
32
|
+
// environment of the package by its path, the group `test` holding pytest and what the tests
|
|
33
|
+
// depend on, its JUnit report in the family `xunit1` (./verdict.mjs). Never `pytest` by its
|
|
34
|
+
// name: uv then plays the one of the PATH, without a word, when the environment holds none that
|
|
35
|
+
// launches. A pytest of the environment absent or broken (the interpreter of its shebang gone,
|
|
36
|
+
// as after the repository moved) is red, its line naming the repair, `uv sync --locked --group
|
|
37
|
+
// test --reinstall` on that environment. A path, written from the
|
|
33
38
|
// root, chooses the project that holds it, and pytest plays that path alone; the paths of the
|
|
34
39
|
// variable `GRILLHOUSE_TESTS` that lie in the project replace the folder the script names. A path
|
|
35
40
|
// out of every project is refused, named, and nothing plays (code 2). The night tests
|
|
@@ -76,11 +81,11 @@
|
|
|
76
81
|
// - While the environment names a results directory (`GRILLHOUSE_RESULTATS`), the run writes
|
|
77
82
|
// there what ./verdict.mjs reads: its tasks, each planned before it plays, and the JUnit report
|
|
78
83
|
// of each run of pytest.
|
|
79
|
-
// - uv absent from the PATH: one line that names it and `npx grillhouse
|
|
84
|
+
// - uv absent from the PATH: one line that names it and `npx grillhouse binaires`, which installs it.
|
|
80
85
|
// - The exit code: 0 when every task is green, 75 when the only reds are « à repasser », 1
|
|
81
86
|
// otherwise; 2 for a path refused or a command unknown.
|
|
82
87
|
import { spawnSync } from 'node:child_process';
|
|
83
|
-
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
88
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
84
89
|
import { constants, tmpdir } from 'node:os';
|
|
85
90
|
import path from 'node:path';
|
|
86
91
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
@@ -93,6 +98,7 @@ import {
|
|
|
93
98
|
cheminsDeLaTache,
|
|
94
99
|
construireDepuisLesArguments,
|
|
95
100
|
constructionDuGraphe,
|
|
101
|
+
gesteDuPackageJson,
|
|
96
102
|
GRAPHE_JOUE,
|
|
97
103
|
joueCeQuiNeSeDivisePas,
|
|
98
104
|
lancerLesTaches,
|
|
@@ -160,6 +166,7 @@ function passe(racine, env) {
|
|
|
160
166
|
const id = `${Date.now()}-${process.pid}`;
|
|
161
167
|
const taches = [];
|
|
162
168
|
const rapports = {};
|
|
169
|
+
let uvAbsent = false;
|
|
163
170
|
// uv keeps its cache with the frame's caches of compilation, out of the temporary directory.
|
|
164
171
|
const environnement = {
|
|
165
172
|
...env,
|
|
@@ -205,14 +212,14 @@ function passe(racine, env) {
|
|
|
205
212
|
},
|
|
206
213
|
// <vert>, the codes that count green beside 0.
|
|
207
214
|
jouer({ t, args, cwd, programme }, vert = []) {
|
|
208
|
-
|
|
209
|
-
const venv = path.join(racine, VENV, path.relative(racine, cwd));
|
|
215
|
+
const venv = environnementDe(racine, cwd);
|
|
210
216
|
const r = spawnSync(programme, args, {
|
|
211
217
|
cwd,
|
|
212
218
|
env: { ...environnement, UV_PROJECT_ENVIRONMENT: venv },
|
|
213
219
|
stdio: 'inherit',
|
|
214
220
|
});
|
|
215
221
|
if (r.error?.code === 'ENOENT' && programme === 'uv') {
|
|
222
|
+
uvAbsent = true;
|
|
216
223
|
process.stderr.write("⛔ uv absent du PATH : `npx grillhouse binaires` l'installe.\n");
|
|
217
224
|
}
|
|
218
225
|
t.code = r.error ? 127 : (r.status ?? 128 + (constants.signals[r.signal] ?? 0));
|
|
@@ -222,6 +229,8 @@ function passe(racine, env) {
|
|
|
222
229
|
ecrire();
|
|
223
230
|
return t.code;
|
|
224
231
|
},
|
|
232
|
+
// Whether a task found no uv to run, which `jouer` said.
|
|
233
|
+
uvAbsent: () => uvAbsent,
|
|
225
234
|
code() {
|
|
226
235
|
const rouges = taches.filter(t => t.code !== 0);
|
|
227
236
|
if (rouges.length === 0) {
|
|
@@ -232,6 +241,35 @@ function passe(racine, env) {
|
|
|
232
241
|
};
|
|
233
242
|
}
|
|
234
243
|
|
|
244
|
+
// The environment of uv of the package at <dossier>, at the root (`sorties` of ./index.mjs).
|
|
245
|
+
const environnementDe = (racine, dossier) =>
|
|
246
|
+
path.join(racine, VENV, path.relative(racine, dossier));
|
|
247
|
+
|
|
248
|
+
// Whether the script <f> of an environment launches: there, and the interpreter it names there,
|
|
249
|
+
// by its shebang or, for a path too long or with a space, by the `exec` of its `/bin/sh` header.
|
|
250
|
+
function seLance(f) {
|
|
251
|
+
let texte;
|
|
252
|
+
try {
|
|
253
|
+
texte = readFileSync(f, 'utf8');
|
|
254
|
+
} catch {
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
const [premiere, seconde = ''] = texte.split('\n');
|
|
258
|
+
const interpretes = [
|
|
259
|
+
/^#!\s*(\S+)/.exec(premiere)?.[1],
|
|
260
|
+
/^'''exec' '(\/[^']*)' "\$0"/.exec(seconde)?.[1],
|
|
261
|
+
];
|
|
262
|
+
return interpretes.every(i => i === undefined || existsSync(i));
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// The line of a red run of the package at <dossier> whose pytest <pytest> does not launch: the
|
|
266
|
+
// repair, on the environment of the package at the root.
|
|
267
|
+
function ligneDeReparation(racine, dossier, pytest) {
|
|
268
|
+
const venv = environnementDe(racine, dossier);
|
|
269
|
+
const paquet = path.relative(racine, dossier) || '.';
|
|
270
|
+
return `⛔ ${paquet} : pytest de son environnement absent ou cassé (${pytest}) ; le réparer, dans ${paquet} : \`UV_PROJECT_ENVIRONMENT='${venv}' uv sync --locked --group ${GROUPE} --reinstall\`\n`;
|
|
271
|
+
}
|
|
272
|
+
|
|
235
273
|
const UV_RUN = ['run', '--locked'];
|
|
236
274
|
// The code of pytest for « no tests collected », distinct from a failure (1).
|
|
237
275
|
const AUCUN_TEST = 5;
|
|
@@ -259,7 +297,9 @@ function declareXdist(dossier) {
|
|
|
259
297
|
function jouerLesTests(p, choix, options) {
|
|
260
298
|
for (const { c, chemins } of choix) {
|
|
261
299
|
const cache = path.join(p.racine, CACHE_DE_PYTEST, path.relative(p.racine, c.dossier));
|
|
262
|
-
|
|
300
|
+
// By its path: by its name, uv falls back to the pytest of the PATH.
|
|
301
|
+
const pytest = path.join(environnementDe(p.racine, c.dossier), 'bin', 'pytest');
|
|
302
|
+
const args = [...UV_RUN, '--group', GROUPE, pytest, '-o', `cache_dir=${cache}`];
|
|
263
303
|
args.push(...p.junit(c.nom, c.dossier));
|
|
264
304
|
// The workers of the task (GRILLHOUSE_TRAVAILLEURS, which a session and a pass set): `-n` of
|
|
265
305
|
// pytest-xdist, for a package whose test group declares it; without the variable, one process.
|
|
@@ -268,10 +308,14 @@ function jouerLesTests(p, choix, options) {
|
|
|
268
308
|
args.push('-n', String(travailleurs));
|
|
269
309
|
}
|
|
270
310
|
const entier = chemins.every(ch => ch === '.');
|
|
271
|
-
p.jouer(
|
|
311
|
+
const code = p.jouer(
|
|
272
312
|
p.prevoir(c.nom, c.dossier, 'pytest', true, [...args, ...selection(chemins), ...options]),
|
|
273
313
|
entier ? [AUCUN_TEST] : []
|
|
274
314
|
);
|
|
315
|
+
// Read after the run: `uv run` syncs the environment first, which lays a pytest it lacks.
|
|
316
|
+
if (code !== 0 && !p.uvAbsent() && !seLance(pytest)) {
|
|
317
|
+
process.stderr.write(ligneDeReparation(p.racine, c.dossier, pytest));
|
|
318
|
+
}
|
|
275
319
|
}
|
|
276
320
|
}
|
|
277
321
|
|
|
@@ -308,7 +352,7 @@ function nomsDuGraphe(racine, projets) {
|
|
|
308
352
|
for (const c of projets) {
|
|
309
353
|
const nom = nomDuPaquet(racine, c.dossier);
|
|
310
354
|
if (nom === null) {
|
|
311
|
-
absents.push(c
|
|
355
|
+
absents.push(c);
|
|
312
356
|
} else {
|
|
313
357
|
noms.add(nom);
|
|
314
358
|
}
|
|
@@ -318,14 +362,20 @@ function nomsDuGraphe(racine, projets) {
|
|
|
318
362
|
|
|
319
363
|
// Says, on the error stream, each project of <absents> that is no package of the graph: its tests
|
|
320
364
|
// do not play, as a package without a `package.json` is out of Turborepo's tasks.
|
|
321
|
-
function direLesAbsents(absents) {
|
|
322
|
-
for (const
|
|
365
|
+
function direLesAbsents(racine, absents) {
|
|
366
|
+
for (const c of absents) {
|
|
323
367
|
process.stderr.write(
|
|
324
|
-
`⚠️ ${nom} : pas un paquet du graphe (package.json absent) ; ses tests ne se jouent pas
|
|
368
|
+
`⚠️ ${c.nom} : pas un paquet du graphe (package.json absent) ; ses tests ne se jouent pas${suiteDuGeste(racine, c)}\n`
|
|
325
369
|
);
|
|
326
370
|
}
|
|
327
371
|
}
|
|
328
372
|
|
|
373
|
+
// The gesture by hand for the component <c> that is no package of the graph, as the end of its line.
|
|
374
|
+
function suiteDuGeste(racine, c) {
|
|
375
|
+
const geste = gesteDuPackageJson(racine, c.dossier, c.paquet ?? c.nom);
|
|
376
|
+
return geste ? ` : ${geste}` : '.';
|
|
377
|
+
}
|
|
378
|
+
|
|
329
379
|
// The pass of `tester` in <racine>, its arguments <args>, under <env>: the tasks `test:unit` of the
|
|
330
380
|
// projects the paths choose (every project that plays tests without a path) as Turborepo's, the
|
|
331
381
|
// exit code its.
|
|
@@ -347,11 +397,14 @@ function tester(racine, args, env) {
|
|
|
347
397
|
const { noms, absents } = nomsDuGraphe(racine, choisis);
|
|
348
398
|
if (chemins.length && absents.length) {
|
|
349
399
|
process.stderr.write(
|
|
350
|
-
`⛔ ${absents.join(', ')} : pas un paquet du graphe (package.json absent)
|
|
400
|
+
`⛔ ${absents.map(c => c.nom).join(', ')} : pas un paquet du graphe (package.json absent)\n`
|
|
351
401
|
);
|
|
402
|
+
for (const c of absents) {
|
|
403
|
+
process.stderr.write(`${c.nom}${suiteDuGeste(racine, c)}\n`);
|
|
404
|
+
}
|
|
352
405
|
return 2;
|
|
353
406
|
}
|
|
354
|
-
direLesAbsents(absents);
|
|
407
|
+
direLesAbsents(racine, absents);
|
|
355
408
|
if (noms.size === 0) {
|
|
356
409
|
return 0;
|
|
357
410
|
}
|
|
@@ -411,7 +464,7 @@ function verifier(racine, args, env) {
|
|
|
411
464
|
return 0;
|
|
412
465
|
}
|
|
413
466
|
const { noms, absents } = nomsDuGraphe(racine, composants(racine));
|
|
414
|
-
direLesAbsents(absents);
|
|
467
|
+
direLesAbsents(racine, absents);
|
|
415
468
|
if (noms.size === 0) {
|
|
416
469
|
return 0;
|
|
417
470
|
}
|
|
@@ -12,10 +12,11 @@
|
|
|
12
12
|
// package's), as `cargo new` refuses a name Rust reserves: `import site` reaches the standard
|
|
13
13
|
// module, never the package. The list is the interpreter's own, `sys.stdlib_module_names`, of
|
|
14
14
|
// the Python the package requires, which uv provides; without uv, the refusal names `npx
|
|
15
|
-
// grillhouse
|
|
15
|
+
// grillhouse binaires`, which installs it.
|
|
16
16
|
// - Its files: its pyproject.toml (PEP 621: its name, its version 0.1.0, the Python it requires, no
|
|
17
17
|
// dependency; its group `test` of `[dependency-groups]`, PEP 735, pytest, which the module runs
|
|
18
|
-
// by
|
|
18
|
+
// by its path in the environment of the package (./commandes.mjs); the configuration of pytest,
|
|
19
|
+
// `[tool.pytest.ini_options]`, its
|
|
19
20
|
// tests under `tests/` and its code importable from `src/`, as uv's layout of a library has it);
|
|
20
21
|
// `src/<module>/__init__.py`, without code; `tests/.gitkeep`, its folder of tests. The typing is
|
|
21
22
|
// `python -m compileall`, which needs no configuration. No build system: uv neither builds nor
|
|
@@ -86,7 +87,7 @@ function modulesStandard(racine) {
|
|
|
86
87
|
);
|
|
87
88
|
if (r.status !== 0) {
|
|
88
89
|
throw new Error(
|
|
89
|
-
`uv ne donne pas les modules de la bibliothèque standard de Python (${String(r.error?.message ?? r.stderr).trim()}) ; \`npx grillhouse
|
|
90
|
+
`uv ne donne pas les modules de la bibliothèque standard de Python (${String(r.error?.message ?? r.stderr).trim()}) ; \`npx grillhouse binaires\` installe uv, puis relance la commande.`
|
|
90
91
|
);
|
|
91
92
|
}
|
|
92
93
|
return new Set(r.stdout.split('\n').filter(Boolean));
|