@roomi-fields/grillhouse 0.52.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 +48 -0
- package/agents/direct.md +1 -1
- package/cadre/templates/projet/vitest.config.cjs +45 -0
- package/charte/superviseur.md +36 -37
- package/charte.md +1 -1
- 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 +14 -5
- package/dist/temporal/circuit/client.js +41 -9
- 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 +17 -12
- package/docs/architecture/circuit.md +18 -15
- package/docs/architecture/entree.md +7 -8
- package/docs/architecture/greffon.md +30 -21
- package/docs/architecture/installation.md +87 -58
- package/docs/architecture/machine.md +1 -1
- package/docs/architecture/tests.md +14 -5
- package/docs/lexique.md +2 -2
- package/hooks/hooks.json +10 -0
- package/hooks/register.tsx +19 -25
- package/package.json +3 -2
- package/scripts/activites.mjs +5 -4
- package/scripts/aiguillage.mjs +1 -0
- package/scripts/circuit.mjs +254 -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 +2 -2
- package/scripts/engendres.mjs +5 -3
- package/scripts/enveloppe/travail-de-la-copie.mjs +77 -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 +16 -0
- 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 +18 -8
- package/scripts/langages/python/squelette.mjs +2 -2
- package/scripts/langages/typescript/configurations-de-vitest.mjs +118 -0
- package/scripts/langages/typescript/index.mjs +2 -0
- 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 +24 -37
- 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/montee.mjs +524 -0
- 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 +40 -12
- package/scripts/retirer-les-copies-finies.mjs +4 -7
- package/scripts/seances.mjs +28 -3
- package/scripts/services-du-noyau.mjs +7 -2
- package/scripts/session-start.sh +18 -11
- package/scripts/sortie.mjs +4 -7
- package/scripts/sous-commandes.mjs +1 -0
- package/scripts/superviseur.mjs +110 -70
- package/scripts/tableau.mjs +127 -108
- 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 +6 -1
- package/skills/grill/SKILL.md +9 -7
- package/skills/grill/references/paquets.md +4 -4
- package/skills/pitmaster/SKILL.md +45 -33
- package/skills/pitmaster/references/consigne-agent.md +1 -1
- package/skills/relecteur/SKILL.md +8 -1
- package/skills/testwriter/SKILL.md +1 -1
- package/cadre/templates/projet/vitest.config.ts +0 -44
|
@@ -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
|
}
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
// - While the environment names a results directory (`GRILLHOUSE_RESULTATS`), the run writes
|
|
82
82
|
// there what ./verdict.mjs reads: its tasks, each planned before it plays, and the JUnit report
|
|
83
83
|
// of each run of pytest.
|
|
84
|
-
// - 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.
|
|
85
85
|
// - The exit code: 0 when every task is green, 75 when the only reds are « à repasser », 1
|
|
86
86
|
// otherwise; 2 for a path refused or a command unknown.
|
|
87
87
|
import { spawnSync } from 'node:child_process';
|
|
@@ -98,6 +98,7 @@ import {
|
|
|
98
98
|
cheminsDeLaTache,
|
|
99
99
|
construireDepuisLesArguments,
|
|
100
100
|
constructionDuGraphe,
|
|
101
|
+
gesteDuPackageJson,
|
|
101
102
|
GRAPHE_JOUE,
|
|
102
103
|
joueCeQuiNeSeDivisePas,
|
|
103
104
|
lancerLesTaches,
|
|
@@ -351,7 +352,7 @@ function nomsDuGraphe(racine, projets) {
|
|
|
351
352
|
for (const c of projets) {
|
|
352
353
|
const nom = nomDuPaquet(racine, c.dossier);
|
|
353
354
|
if (nom === null) {
|
|
354
|
-
absents.push(c
|
|
355
|
+
absents.push(c);
|
|
355
356
|
} else {
|
|
356
357
|
noms.add(nom);
|
|
357
358
|
}
|
|
@@ -361,14 +362,20 @@ function nomsDuGraphe(racine, projets) {
|
|
|
361
362
|
|
|
362
363
|
// Says, on the error stream, each project of <absents> that is no package of the graph: its tests
|
|
363
364
|
// do not play, as a package without a `package.json` is out of Turborepo's tasks.
|
|
364
|
-
function direLesAbsents(absents) {
|
|
365
|
-
for (const
|
|
365
|
+
function direLesAbsents(racine, absents) {
|
|
366
|
+
for (const c of absents) {
|
|
366
367
|
process.stderr.write(
|
|
367
|
-
`⚠️ ${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`
|
|
368
369
|
);
|
|
369
370
|
}
|
|
370
371
|
}
|
|
371
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
|
+
|
|
372
379
|
// The pass of `tester` in <racine>, its arguments <args>, under <env>: the tasks `test:unit` of the
|
|
373
380
|
// projects the paths choose (every project that plays tests without a path) as Turborepo's, the
|
|
374
381
|
// exit code its.
|
|
@@ -390,11 +397,14 @@ function tester(racine, args, env) {
|
|
|
390
397
|
const { noms, absents } = nomsDuGraphe(racine, choisis);
|
|
391
398
|
if (chemins.length && absents.length) {
|
|
392
399
|
process.stderr.write(
|
|
393
|
-
`⛔ ${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`
|
|
394
401
|
);
|
|
402
|
+
for (const c of absents) {
|
|
403
|
+
process.stderr.write(`${c.nom}${suiteDuGeste(racine, c)}\n`);
|
|
404
|
+
}
|
|
395
405
|
return 2;
|
|
396
406
|
}
|
|
397
|
-
direLesAbsents(absents);
|
|
407
|
+
direLesAbsents(racine, absents);
|
|
398
408
|
if (noms.size === 0) {
|
|
399
409
|
return 0;
|
|
400
410
|
}
|
|
@@ -454,7 +464,7 @@ function verifier(racine, args, env) {
|
|
|
454
464
|
return 0;
|
|
455
465
|
}
|
|
456
466
|
const { noms, absents } = nomsDuGraphe(racine, composants(racine));
|
|
457
|
-
direLesAbsents(absents);
|
|
467
|
+
direLesAbsents(racine, absents);
|
|
458
468
|
if (noms.size === 0) {
|
|
459
469
|
return 0;
|
|
460
470
|
}
|
|
@@ -12,7 +12,7 @@
|
|
|
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
18
|
// by its path in the environment of the package (./commandes.mjs); the configuration of pytest,
|
|
@@ -87,7 +87,7 @@ function modulesStandard(racine) {
|
|
|
87
87
|
);
|
|
88
88
|
if (r.status !== 0) {
|
|
89
89
|
throw new Error(
|
|
90
|
-
`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.`
|
|
91
91
|
);
|
|
92
92
|
}
|
|
93
93
|
return new Set(r.stdout.split('\n').filter(Boolean));
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// The configurations of Vitest of a repository, the part of the guard `turbo-des-paquets`
|
|
2
|
+
// (./turbo-des-paquets.mjs) that has a known debt. The envelope of a role shows a package out of
|
|
3
|
+
// its plan read-only, and Vite 5 bundles an ESM configuration into a file beside it
|
|
4
|
+
// (`vitest.config.ts.timestamp-<n>.mjs`) to load it; a `.cjs` one is loaded in memory.
|
|
5
|
+
// Mechanism: packages/grillhouse/docs/architecture/tests.md, §5.1.
|
|
6
|
+
//
|
|
7
|
+
// Judged: the root of the repository and each of its packages (hors-cadre.txt aside), one finding
|
|
8
|
+
// per refused file:
|
|
9
|
+
// - a `vitest.config.*` other than `.cjs`, whatever the `type` of the manifest;
|
|
10
|
+
// - the configuration the script `test:unit` names (`--config`, `-c`) when it is not a `.cjs`;
|
|
11
|
+
// - in a package that plays tests (`test:unit`) without `vitest.config.*` nor named
|
|
12
|
+
// configuration, the `vite.config.*` they play under when Vite loads it as ESM: it asks for a
|
|
13
|
+
// `vitest.config.cjs` beside it, `vite.config` staying as it is for the build.
|
|
14
|
+
// A finding inscribed in the project's debt (`grillhouse-dette.json`, ../../dette.mjs) passes.
|
|
15
|
+
import { existsSync, readFileSync, statSync } from 'node:fs';
|
|
16
|
+
import path from 'node:path';
|
|
17
|
+
import { trancher } from '../../dette.mjs';
|
|
18
|
+
import { paquets } from '../../paquets.mjs';
|
|
19
|
+
|
|
20
|
+
export const GARDE = 'turbo-des-paquets';
|
|
21
|
+
export const REGLE = 'config-hors-cjs';
|
|
22
|
+
// The extensions of a configuration, in the order Vitest looks for them, `.cjs` the only one
|
|
23
|
+
// that passes.
|
|
24
|
+
const REFUSEES = ['ts', 'mts', 'cts', 'js', 'mjs'];
|
|
25
|
+
const EXTENSIONS = [...REFUSEES, 'cjs'];
|
|
26
|
+
const POURQUOI =
|
|
27
|
+
"Vite écrit un fichier à côté d'une configuration ESM pour la charger, et l'enveloppe montre en lecture seule un paquet hors du plan";
|
|
28
|
+
|
|
29
|
+
const posix = f => f.split(path.sep).join('/');
|
|
30
|
+
const manifeste = dir => {
|
|
31
|
+
const f = path.join(dir, 'package.json');
|
|
32
|
+
return existsSync(f) ? JSON.parse(readFileSync(f, 'utf8')) : {};
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// The configurations the command line `script` gives Vitest by `--config` or `-c`.
|
|
36
|
+
function configurationsNommees(script) {
|
|
37
|
+
const noms = [];
|
|
38
|
+
for (const commande of script.split(/&&|\|\||;|\|/)) {
|
|
39
|
+
if (!/\bvitest\b/.test(commande)) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
const mots = commande.split(/\s+/).map(m => m.replace(/["']/g, ''));
|
|
43
|
+
mots.forEach((m, i) => {
|
|
44
|
+
const colle = /^(?:--config|-c)=(.+)$/.exec(m)?.[1];
|
|
45
|
+
const nom = colle ?? (m === '--config' || m === '-c' ? mots[i + 1] : undefined);
|
|
46
|
+
if (nom) {
|
|
47
|
+
noms.push(nom);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return noms;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Whether Vite loads the file `f` of a package of manifest `pkg` as ESM.
|
|
55
|
+
const enEsm = (f, pkg) => /\.m[jt]s$/.test(f) || (/\.[jt]s$/.test(f) && pkg.type === 'module');
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The refused configurations of Vitest of the repository at `racine`, one finding per file.
|
|
59
|
+
* @param {string} racine
|
|
60
|
+
* @returns {{ fichier: string, regle: string, message: string }[]}
|
|
61
|
+
*/
|
|
62
|
+
export function configurationsRefusees(racine) {
|
|
63
|
+
const dossiers = [
|
|
64
|
+
'',
|
|
65
|
+
...(existsSync(path.join(racine, 'package.json'))
|
|
66
|
+
? paquets(racine)
|
|
67
|
+
.filter(p => !p.hors)
|
|
68
|
+
.map(p => p.dossier)
|
|
69
|
+
: []),
|
|
70
|
+
];
|
|
71
|
+
const constats = new Map();
|
|
72
|
+
const refuser = (fichier, message) =>
|
|
73
|
+
constats.set(fichier, { fichier, regle: REGLE, message: `⛔ ${fichier} : ${message}` });
|
|
74
|
+
const enCjs = (fichier, attendu) =>
|
|
75
|
+
refuser(
|
|
76
|
+
fichier,
|
|
77
|
+
`la configuration de Vitest s'écrit en CommonJS, \`${attendu}\` (la base du cadre par \`await import()\`) ; ${POURQUOI}.`
|
|
78
|
+
);
|
|
79
|
+
for (const dossier of new Set(dossiers)) {
|
|
80
|
+
const dir = path.join(racine, dossier);
|
|
81
|
+
const pkg = manifeste(dir);
|
|
82
|
+
const ici = nom => posix(path.join(dossier, nom));
|
|
83
|
+
const presents = base =>
|
|
84
|
+
EXTENSIONS.map(ext => `${base}.${ext}`).filter(f => existsSync(path.join(dir, f)));
|
|
85
|
+
const deVitest = presents('vitest.config');
|
|
86
|
+
for (const f of deVitest.filter(f => !f.endsWith('.cjs'))) {
|
|
87
|
+
enCjs(ici(f), 'vitest.config.cjs');
|
|
88
|
+
}
|
|
89
|
+
const script = pkg.scripts?.['test:unit'];
|
|
90
|
+
if (typeof script !== 'string') {
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
const nommees = configurationsNommees(script);
|
|
94
|
+
for (const nom of nommees) {
|
|
95
|
+
const f = path.join(dir, nom);
|
|
96
|
+
if (!nom.endsWith('.cjs') && existsSync(f) && statSync(f).isFile()) {
|
|
97
|
+
const { dir: d, name } = path.posix.parse(posix(nom));
|
|
98
|
+
enCjs(ici(nom), path.posix.join(d, `${name}.cjs`));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (nommees.length === 0 && deVitest.length === 0) {
|
|
102
|
+
const vite = presents('vite.config')[0];
|
|
103
|
+
if (vite && enEsm(vite, pkg)) {
|
|
104
|
+
refuser(
|
|
105
|
+
ici(vite),
|
|
106
|
+
`les tests jouent sous cette configuration ESM : ajoute un \`vitest.config.cjs\` à côté, que Vitest préfère, ce fichier restant celui de la construction ; ${POURQUOI}.`
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return [...constats.values()];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* The findings of the guard `turbo-des-paquets` at `racine` judged against the known debt, in the
|
|
116
|
+
* mode of the run (`trancher`, ../../dette.mjs): `{ refus, lignes }`.
|
|
117
|
+
*/
|
|
118
|
+
export const trancherLaGarde = (racine, constats) => trancher(racine, GARDE, constats);
|
|
@@ -78,6 +78,7 @@ import * as binaireDeJour from './migrations/0.33.0-binaire-de-jour.mjs';
|
|
|
78
78
|
import * as testsDuPoste from './migrations/0.33.0-tests-du-poste.mjs';
|
|
79
79
|
import * as cacheDesOutils from './migrations/0.34.1-cache-des-outils.mjs';
|
|
80
80
|
import * as testsEquipes from './migrations/0.49.0-tests-equipes.mjs';
|
|
81
|
+
import * as configurationsEnCommonJs from './migrations/configurations-en-commonjs.mjs';
|
|
81
82
|
import { COMMANDE as COMMANDE_DU_VERROU } from './verrou-des-dependances.mjs';
|
|
82
83
|
|
|
83
84
|
// The scripts of this module, beside this file.
|
|
@@ -377,6 +378,7 @@ export default {
|
|
|
377
378
|
testsDuPoste,
|
|
378
379
|
cacheDesOutils,
|
|
379
380
|
testsEquipes,
|
|
381
|
+
configurationsEnCommonJs,
|
|
380
382
|
],
|
|
381
383
|
miseAJour: miseAJour(joueDesTests),
|
|
382
384
|
squelette,
|