@roomi-fields/grillhouse 0.28.3 → 0.30.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 +739 -0
- package/bin/grillhouse.mjs +128 -26
- package/cadre/templates/projet/.github/workflows/ci.yml +2 -13
- package/cadre/templates/projet/CLAUDE.md +5 -1
- package/cadre/templates/projet/README.md +11 -11
- package/cadre/templates/projet/_gitignore +2 -5
- package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
- package/cadre/templates/projet/package.json +2 -2
- package/charte.md +37 -4
- package/dist/temporal/acte.d.ts +24 -0
- package/dist/temporal/acte.js +139 -0
- package/dist/temporal/acte.js.map +1 -0
- package/dist/temporal/attributs.d.ts +6 -0
- package/dist/temporal/attributs.js +15 -0
- package/dist/temporal/attributs.js.map +1 -0
- package/dist/temporal/circuit/activites.d.ts +13 -0
- package/dist/temporal/circuit/activites.js +33 -0
- package/dist/temporal/circuit/activites.js.map +1 -0
- package/dist/temporal/circuit/client.d.ts +72 -0
- package/dist/temporal/circuit/client.js +247 -0
- package/dist/temporal/circuit/client.js.map +1 -0
- package/dist/temporal/circuit/commande.d.ts +2 -0
- package/dist/temporal/circuit/commande.js +238 -0
- package/dist/temporal/circuit/commande.js.map +1 -0
- package/dist/temporal/circuit/contrat.d.ts +305 -0
- package/dist/temporal/circuit/contrat.js +24 -0
- package/dist/temporal/circuit/contrat.js.map +1 -0
- package/dist/temporal/circuit/deroule.d.ts +3 -0
- package/dist/temporal/circuit/deroule.js +540 -0
- package/dist/temporal/circuit/deroule.js.map +1 -0
- package/dist/temporal/client.d.ts +47 -0
- package/dist/temporal/client.js +69 -0
- package/dist/temporal/client.js.map +1 -0
- package/dist/temporal/commande.d.ts +2 -0
- package/dist/temporal/commande.js +95 -0
- package/dist/temporal/commande.js.map +1 -0
- package/dist/temporal/deroules.d.ts +5 -0
- package/dist/temporal/deroules.js +10 -0
- package/dist/temporal/deroules.js.map +1 -0
- package/dist/temporal/etat.d.ts +33 -0
- package/dist/temporal/etat.js +59 -0
- package/dist/temporal/etat.js.map +1 -0
- package/dist/temporal/file/activites.d.ts +10 -0
- package/dist/temporal/file/activites.js +25 -0
- package/dist/temporal/file/activites.js.map +1 -0
- package/dist/temporal/file/client.d.ts +4 -0
- package/dist/temporal/file/client.js +6 -0
- package/dist/temporal/file/client.js.map +1 -0
- package/dist/temporal/file/contrat.d.ts +158 -0
- package/dist/temporal/file/contrat.js +14 -0
- package/dist/temporal/file/contrat.js.map +1 -0
- package/dist/temporal/file/deroule.d.ts +15 -0
- package/dist/temporal/file/deroule.js +235 -0
- package/dist/temporal/file/deroule.js.map +1 -0
- package/dist/temporal/installation.d.ts +124 -0
- package/dist/temporal/installation.js +408 -0
- package/dist/temporal/installation.js.map +1 -0
- package/dist/temporal/places/activites.d.ts +8 -0
- package/dist/temporal/places/activites.js +13 -0
- package/dist/temporal/places/activites.js.map +1 -0
- package/dist/temporal/places/client.d.ts +28 -0
- package/dist/temporal/places/client.js +64 -0
- package/dist/temporal/places/client.js.map +1 -0
- package/dist/temporal/places/contrat.d.ts +106 -0
- package/dist/temporal/places/contrat.js +21 -0
- package/dist/temporal/places/contrat.js.map +1 -0
- package/dist/temporal/places/deroule.d.ts +3 -0
- package/dist/temporal/places/deroule.js +198 -0
- package/dist/temporal/places/deroule.js.map +1 -0
- package/dist/temporal/sonde/activites.d.ts +6 -0
- package/dist/temporal/sonde/activites.js +52 -0
- package/dist/temporal/sonde/activites.js.map +1 -0
- package/dist/temporal/sonde/contrat.d.ts +35 -0
- package/dist/temporal/sonde/contrat.js +10 -0
- package/dist/temporal/sonde/contrat.js.map +1 -0
- package/dist/temporal/sonde/deroule.d.ts +3 -0
- package/dist/temporal/sonde/deroule.js +39 -0
- package/dist/temporal/sonde/deroule.js.map +1 -0
- package/dist/temporal/tickets/activites.d.ts +7 -0
- package/dist/temporal/tickets/activites.js +81 -0
- package/dist/temporal/tickets/activites.js.map +1 -0
- package/dist/temporal/tickets/client.d.ts +10 -0
- package/dist/temporal/tickets/client.js +31 -0
- package/dist/temporal/tickets/client.js.map +1 -0
- package/dist/temporal/tickets/contrat.d.ts +56 -0
- package/dist/temporal/tickets/contrat.js +13 -0
- package/dist/temporal/tickets/contrat.js.map +1 -0
- package/dist/temporal/tickets/deroule.d.ts +3 -0
- package/dist/temporal/tickets/deroule.js +94 -0
- package/dist/temporal/tickets/deroule.js.map +1 -0
- package/dist/temporal/travailleur.d.ts +2 -0
- package/dist/temporal/travailleur.js +69 -0
- package/dist/temporal/travailleur.js.map +1 -0
- package/docs/ARCHITECTURE.md +813 -53
- package/docs/CADRE.md +17 -0
- package/docs/INTERFACE.md +161 -30
- package/hooks/crochet.mjs +19 -2
- package/hooks/hooks.json +11 -0
- package/package.json +16 -4
- package/scripts/activites.mjs +2182 -0
- package/scripts/aiguillage.d.mts +37 -0
- package/scripts/aiguillage.mjs +328 -0
- package/scripts/avancement.mjs +159 -64
- package/scripts/bilan.mjs +37 -19
- package/scripts/cadre.mjs +11 -2
- package/scripts/circuit.mjs +888 -3654
- package/scripts/circuits-cles.d.mts +4 -0
- package/scripts/circuits-cles.mjs +21 -0
- package/scripts/circuits-du-serveur.mjs +105 -0
- package/scripts/codes-de-sortie.mjs +9 -0
- package/scripts/commandes-composees.mjs +45 -41
- package/scripts/commandes-du-path.d.mts +7 -0
- package/scripts/commandes-du-path.mjs +25 -0
- package/scripts/composition-des-langages.mjs +30 -11
- package/scripts/conformite.mjs +19 -10
- package/scripts/copies-finies.mjs +188 -42
- package/scripts/depart-du-ticket.d.mts +53 -0
- package/scripts/depart-du-ticket.mjs +124 -0
- package/scripts/dependances-internes.mjs +115 -0
- package/scripts/dernier-vert.mjs +7 -15
- package/scripts/donnees-cles.mjs +228 -0
- package/scripts/droits.mjs +11 -1
- package/scripts/effets.mjs +352 -0
- package/scripts/enveloppe/enveloppe.mjs +119 -8
- package/scripts/enveloppe/lancer.sh +27 -32
- package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
- package/scripts/enveloppe/travail-de-la-copie.mjs +99 -12
- package/scripts/etapes.mjs +6 -3
- package/scripts/faits-du-circuit.mjs +493 -0
- package/scripts/file-des-tickets.d.mts +21 -0
- package/scripts/file-des-tickets.mjs +58 -0
- package/scripts/flux-des-paquets.mjs +187 -0
- package/scripts/fusion-du-changelog.mjs +0 -1
- package/scripts/gardes-du-cadre.mjs +12 -2
- package/scripts/grillhouse-maj.mjs +16 -7
- package/scripts/integration/file.mjs +477 -422
- package/scripts/integration/integrer.mjs +20 -22
- package/scripts/integration/rejeu.mjs +19 -4
- package/scripts/jointure.d.ts +168 -28
- package/scripts/langages/cargo/commandes.mjs +426 -119
- package/scripts/langages/cargo/composants.mjs +187 -3
- package/scripts/langages/cargo/exemples.mjs +75 -17
- package/scripts/langages/cargo/index.mjs +32 -13
- package/scripts/langages/cargo/migrations/0.28.4-tailles-des-tests.mjs +35 -0
- package/scripts/langages/cargo/sccache.mjs +62 -16
- package/scripts/langages/cargo/squelette.mjs +72 -3
- package/scripts/langages/cargo/tailles-des-tests.mjs +195 -0
- package/scripts/langages/cargo/tests-de-head.mjs +159 -0
- package/scripts/langages/python/commandes.mjs +232 -79
- package/scripts/langages/python/composants.mjs +65 -3
- package/scripts/langages/python/exemples.mjs +21 -12
- package/scripts/langages/python/index.mjs +25 -5
- package/scripts/langages/python/lot.mjs +1 -36
- package/scripts/langages/python/squelette.mjs +119 -17
- package/scripts/langages/typescript/construire.mjs +6 -163
- package/scripts/langages/typescript/exemples.mjs +19 -11
- package/scripts/langages/typescript/frontieres.mjs +1 -1
- package/scripts/langages/typescript/index.mjs +48 -63
- package/scripts/langages/typescript/interfaces-contre-code.mjs +4 -4
- package/scripts/langages/typescript/migrations/0.30.0-prefixe-des-tickets.mjs +63 -0
- package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +31 -0
- package/scripts/langages/typescript/migrations/0.30.0-titres-nommant-un-ticket.mjs +40 -0
- package/scripts/langages/typescript/mise-a-jour.mjs +1 -2
- package/scripts/langages/typescript/regle-des-tests.mjs +13 -0
- package/scripts/langages/typescript/squelette.mjs +18 -2
- package/scripts/langages/typescript/tailles-des-tests.mjs +40 -9
- package/scripts/langages/typescript/tests-de-nuit.mjs +44 -21
- package/scripts/langages/typescript/tests.mjs +17 -8
- package/scripts/langages/typescript/titres-de-tests.mjs +297 -0
- package/scripts/langages/typescript/turbo-des-paquets.mjs +183 -38
- package/scripts/langages/typescript/verdict.mjs +1 -1
- package/scripts/langages/typescript/verifier.mjs +110 -296
- package/scripts/langages/typescript/vitest-config/base.mjs +30 -10
- package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
- package/scripts/langages/typescript/vitest-config/cibles.mjs +123 -62
- package/scripts/langages/typescript/vitest-config/delais.mjs +54 -0
- package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
- package/scripts/langages/typescript/vitest-config/duree.classement.mjs +100 -0
- package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +56 -64
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +7 -2
- package/scripts/langages/typescript/vitest-config/mesure.mjs +3 -2
- package/scripts/langages/typescript/vitest.nuit.config.mjs +22 -13
- package/scripts/lecture-unique.mjs +51 -0
- package/scripts/mesure/pression.mjs +11 -9
- package/scripts/mesure-de-la-machine.d.mts +21 -0
- package/scripts/mesure-de-la-machine.mjs +76 -0
- package/scripts/migrations/0.23.2-copies-du-cadre.mjs +8 -2
- package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +120 -0
- package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
- package/scripts/migrations.mjs +5 -0
- package/scripts/nuit.sh +29 -15
- package/scripts/outil.mjs +72 -0
- package/scripts/outils-cles.d.mts +24 -0
- package/scripts/outils-cles.mjs +0 -1
- package/scripts/paquet-npm.mjs +147 -0
- package/scripts/paquet.mjs +112 -14
- package/scripts/paquets.mjs +34 -6
- package/scripts/passe-de-la-machine.mjs +66 -0
- package/scripts/places-de-la-machine.mjs +360 -0
- package/scripts/places-du-serveur.mjs +170 -0
- package/scripts/prefixe-des-tickets.mjs +68 -0
- package/scripts/preparation.mjs +10 -3
- package/scripts/registre.mjs +3 -2
- package/scripts/regles-des-places.d.mts +36 -0
- package/scripts/regles-des-places.mjs +70 -0
- package/scripts/reponses-du-circuit.d.mts +6 -0
- package/scripts/reponses-du-circuit.mjs +28 -0
- package/scripts/resultats.mjs +29 -14
- package/scripts/retirer-les-copies-finies.mjs +25 -0
- package/scripts/sans-reponse.d.mts +4 -0
- package/scripts/sans-reponse.mjs +13 -0
- package/scripts/seances.mjs +918 -0
- package/scripts/services-du-noyau.mjs +28 -11
- package/scripts/session-start.sh +10 -1
- package/scripts/sortie.mjs +23 -4
- package/scripts/sources.mjs +3 -3
- package/scripts/sous-commandes.mjs +39 -9
- package/scripts/style-a-l-ecriture.mjs +229 -0
- package/scripts/superviseur.mjs +382 -16
- package/scripts/tableau.mjs +329 -130
- package/scripts/taches-du-graphe.mjs +328 -0
- package/scripts/ticket-du-circuit.mjs +206 -0
- package/scripts/transitions.d.mts +148 -0
- package/scripts/transitions.mjs +901 -0
- package/scripts/verrou-de-fichier.mjs +2 -2
- package/scripts/verrou-de-machine.mjs +322 -62
- package/skills/developpeur/SKILL.md +11 -3
- package/skills/explorateur/SKILL.md +2 -1
- package/skills/pitmaster/SKILL.md +62 -28
- package/skills/pitmaster/references/consigne-agent.md +5 -1
- package/skills/release/SKILL.md +3 -3
- package/skills/relecteur/SKILL.md +22 -8
- package/skills/testwriter/SKILL.md +47 -39
- package/scripts/demon.mjs +0 -138
- package/scripts/integration/file-attente.mjs +0 -61
- package/scripts/langages/cargo/touches.mjs +0 -93
- package/scripts/langages/typescript/script-des-tests.mjs +0 -6
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// `npm run verifier`: the full pass, what the integration, the queue, the continuous integration
|
|
3
|
-
// and the night play. Its verdict is green (0)
|
|
3
|
+
// and the night play. Its verdict is green (0) or red (1); « à repasser » (75) only when the wait
|
|
4
|
+
// for the lock of the machine, or for room in the temporary directory, reaches its bound.
|
|
4
5
|
//
|
|
5
6
|
// npx grillhouse verifier [<argument of Turborepo>…] (npm run verifier -- --force)
|
|
6
7
|
// npx grillhouse verifier --tout [<argument>…] every test, played for real
|
|
@@ -15,7 +16,11 @@
|
|
|
15
16
|
// and so do the builds. The changes reach Vitest in a variable no hash counts
|
|
16
17
|
// (`GRILLHOUSE_CHANGEMENTS`). Without a last green that counts, the pass is complete. The
|
|
17
18
|
// line `↳` says which. A pass green, restricted by no filter, keeps its tree as the last green;
|
|
18
|
-
// a red one keeps the last green as it was.
|
|
19
|
+
// a red one keeps the last green as it was. The pass is the one that keeps it, for every language
|
|
20
|
+
// of the project: it plays the tasks of every package of the graph, a crate's and a Python
|
|
21
|
+
// project's beside a TypeScript package's (their `test:unit` and `typecheck`, scripts of their
|
|
22
|
+
// package.json), so it is green only when every task of every language is, and no module of
|
|
23
|
+
// language keeps a green of its own (scripts/dernier-vert.mjs).
|
|
19
24
|
// - `--tout`, and `--force` (the night, scripts/nuit.sh), play the complete pass: no measure
|
|
20
25
|
// against the last green, and each task of tests played for real (the variable of the tests
|
|
21
26
|
// carries the moment of the pass, `rejouer`, which no cached run holds).
|
|
@@ -35,94 +40,77 @@
|
|
|
35
40
|
// side, is half the cores of the machine, one at least (`concurrence`): each task of tests is
|
|
36
41
|
// itself parallel (Vitest's workers), as make's `-j` and Bazel's `--local_cpu_resources` bound a
|
|
37
42
|
// build by the machine; a `--concurrency` among the arguments replaces it.
|
|
38
|
-
// - The
|
|
39
|
-
//
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
//
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
-
//
|
|
49
|
-
//
|
|
50
|
-
//
|
|
51
|
-
//
|
|
52
|
-
// same verdict: what the reviewer plays on the
|
|
43
|
+
// - The pass plays no measure of time (grillhouse-bd7): the time budget benches and the time
|
|
44
|
+
// witnesses (a test file that imports `mesurerAuRepos`) are out of the day, as the night tests
|
|
45
|
+
// are, and the night plays them (scripts/langages/typescript/vitest-config/cibles.mjs,
|
|
46
|
+
// scripts/langages/typescript/tests-de-nuit.mjs), as Bazel leaves a test tagged `manual` out of
|
|
47
|
+
// its patterns and the benchmarks of Chromium and rustc-perf leave the CI of each commit for a
|
|
48
|
+
// machine at rest. The day waits for no rest: a delay past is a red (the duration reporter
|
|
49
|
+
// classifies a delay of a day test as a real red), and so is a task at 75.
|
|
50
|
+
// - The pass plays too the format check and the lint (grillhouse-61z, grillhouse-44b.9), per
|
|
51
|
+
// package: the scripts `format:check` and `lint` of each package that holds them, as its tasks
|
|
52
|
+
// (`<package>#format:check`, `<package>#lint`), and the root's for its own files only, as root
|
|
53
|
+
// tasks (`//#format:check`, `//#lint`), under the same `--continue`: a red lint hides no red
|
|
54
|
+
// test, each red is named with its package. The CI calls the pass alone.
|
|
55
|
+
// - `--gardes` plays the tasks of guards and these two controls alone, `turbo run grillhouse:gardes
|
|
56
|
+
// gardes format:check lint …`, the repository whole (ESLint and Prettier have no notion of a lot;
|
|
57
|
+
// their cache reads again what changed), with the same verdict: what the reviewer plays on the
|
|
58
|
+
// ticket's copy, the tests aside.
|
|
53
59
|
// - The verdict reads the exit code of each task in the summary of each run
|
|
54
60
|
// (`.turbo/runs/<id>.json`), since Turborepo exits with the greatest code of its tasks (a 75
|
|
55
61
|
// would hide a 1). The summary each run writes is removed, and `.turbo/runs` with it when the
|
|
56
62
|
// run created it; while the pass names a results directory (`GRILLHOUSE_RESULTATS`,
|
|
57
63
|
// scripts/resultats.mjs), it goes there instead, where the circuit reads it.
|
|
58
|
-
// - A task at 0 is green. A task at any other code
|
|
59
|
-
//
|
|
60
|
-
// task of the witnesses' pass with « (témoins de temps) ».
|
|
61
|
-
// - A task at 75 (« à repasser »: every failure of its tests depended on a duration and one took
|
|
62
|
-
// place under load, scripts/langages/typescript/vitest-config/duree.reporter.mjs) is played again alone, once the CPU
|
|
63
|
-
// pressure is back under the threshold (scripts/mesure/pression.mjs; one line per 30 s at
|
|
64
|
-
// most while it waits, with the pressure), one task after the other, in the choice of its run
|
|
65
|
-
// (a task of the witnesses' pass plays its witnesses alone again):
|
|
66
|
-
// `turbo run <task> --filter=<package>`, the arguments given after it, with what it depends on,
|
|
67
|
-
// which passed in the pass and replays from the cache: its hash holds theirs, as in the pass.
|
|
68
|
-
// Green at rest, it is green; at any code other
|
|
69
|
-
// than 0 and 75, red; at 75 again (the load came back during the run), it waits and plays again.
|
|
70
|
-
// - The wait is bounded: 15 min after the pass. The bound reached, the verdict is 75, « à
|
|
71
|
-
// repasser »: neither green nor red; whoever launched the pass presents it again later
|
|
72
|
-
// (scripts/integration/integrer.mjs, scripts/integration/file.mjs, scripts/nuit.sh).
|
|
64
|
+
// - A task at 0 is green. A task at any other code, 75 included, and a summary that does not read
|
|
65
|
+
// while Turborepo failed: red, code 1, each task named.
|
|
73
66
|
// - The progress of the pass (scripts/avancement.mjs): the directory its caller names in
|
|
74
67
|
// GRILLHOUSE_AVANCEMENT (the circuit's), else one of its own, which it names beside the lock of
|
|
75
|
-
// the machine while it plays (
|
|
76
|
-
//
|
|
77
|
-
//
|
|
78
|
-
//
|
|
68
|
+
// the machine it holds while it plays (`nommerLAvancement`), as the board shows its holder, and
|
|
69
|
+
// removes at its end, its total kept. Before its run of Turborepo, the plan of
|
|
70
|
+
// the run (`turbo run … --dry=json`) names its tasks of tests and counts done the files of those
|
|
71
|
+
// Turborepo replays from its cache.
|
|
79
72
|
// - The red tasks: while the variable `GRILLHOUSE_ROUGES` (`ROUGES`) names a file, the pass writes
|
|
80
73
|
// there, one Turborepo task id per line (`<package>#<task>`, `//#<task>` for the root), then a
|
|
81
74
|
// tab and the command that replays it alone (`npx turbo run <task> --filter=<package>`), each task
|
|
82
|
-
// red on its own exit code, a task
|
|
83
|
-
//
|
|
84
|
-
// file is empty. The night reads it for its bisect commands (scripts/nuit.sh), with no second
|
|
75
|
+
// red on its own exit code, once each; a task that did not play is none of them (its
|
|
76
|
+
// prerequisite red is). Green, the file is empty. The night reads it for its bisect commands (scripts/nuit.sh), with no second
|
|
85
77
|
// reading of the summaries.
|
|
86
78
|
// - The pass has a base of its own (scripts/mesure/base-de-passe.mjs), in the temporary
|
|
87
79
|
// directory of its environment, which it sweeps first of the bases a killed pass left: every
|
|
88
80
|
// run of Turborepo gets it in TMPDIR, TMP and TEMP, the root's `globalPassThroughEnv` passing
|
|
89
81
|
// TMPDIR on to every task (scripts/langages/typescript/turbo-des-paquets.mjs), and the pass
|
|
90
82
|
// removes it at its end, green, red or interrupted (SIGINT, SIGTERM, SIGHUP).
|
|
91
|
-
// -
|
|
92
|
-
// (scripts/langages/typescript/vitest-config/cibles.mjs) carries only
|
|
93
|
-
//
|
|
83
|
+
// - The run plays without the paths of a targeted run's tests: the variable `GRILLHOUSE_TESTS`
|
|
84
|
+
// (scripts/langages/typescript/vitest-config/cibles.mjs) carries only `rejouer`, for a complete
|
|
85
|
+
// pass.
|
|
94
86
|
import { spawnSync } from 'node:child_process';
|
|
95
87
|
import { existsSync, readdirSync, readFileSync, rmdirSync, rmSync, writeFileSync } from 'node:fs';
|
|
96
88
|
import { availableParallelism, tmpdir } from 'node:os';
|
|
97
89
|
import path from 'node:path';
|
|
98
90
|
import { pathToFileURL } from 'node:url';
|
|
99
91
|
import {
|
|
100
|
-
A_REPASSER,
|
|
101
|
-
attendreLeRepos,
|
|
102
92
|
AttenteDeLaMachine,
|
|
103
93
|
AVANCEMENT,
|
|
104
|
-
|
|
105
|
-
BORNE_ATTENTE_MS,
|
|
94
|
+
avecLaMachineEtUnePlace,
|
|
106
95
|
CHANGEMENTS,
|
|
107
|
-
ecrireLaMesure,
|
|
108
96
|
garderLeTotal,
|
|
109
97
|
garderLeVert,
|
|
110
|
-
lirePression,
|
|
111
98
|
mesure,
|
|
99
|
+
nommerLAvancement,
|
|
112
100
|
ouvrirAvancement,
|
|
113
101
|
ouvrirBase,
|
|
114
|
-
|
|
102
|
+
PASSE_ROUGE,
|
|
115
103
|
retirerALInterruption,
|
|
104
|
+
SCRIPT_DES_TESTS,
|
|
105
|
+
TESTS_CIBLES,
|
|
106
|
+
testsCibles,
|
|
116
107
|
} from '../../services-du-noyau.mjs';
|
|
117
108
|
import { paquets, TYPAGE } from '../../paquets.mjs';
|
|
118
|
-
import { planifier } from './turbo-des-paquets.mjs';
|
|
119
|
-
import { SCRIPT_DES_TESTS } from './script-des-tests.mjs';
|
|
109
|
+
import { controlesDuDepot, planifier } from './turbo-des-paquets.mjs';
|
|
120
110
|
import { garderLesResumes } from './verdict.mjs';
|
|
121
|
-
import { fichiersTemoins, VARIABLE as TESTS_CIBLES } from './vitest-config/cibles.mjs';
|
|
122
111
|
|
|
123
112
|
const GARDES = ['grillhouse:gardes', 'gardes'];
|
|
124
113
|
const TACHES = [...GARDES, TYPAGE, SCRIPT_DES_TESTS];
|
|
125
|
-
const TEMOINS = ' (témoins de temps)';
|
|
126
114
|
const CONCURRENCE = /^--concurrency(?:=|$)/;
|
|
127
115
|
// The variable that names the file of the red tasks, which the night reads.
|
|
128
116
|
const ROUGES = 'GRILLHOUSE_ROUGES';
|
|
@@ -135,71 +123,16 @@ const rejeu = id => {
|
|
|
135
123
|
|
|
136
124
|
const lister = dossier => (existsSync(dossier) ? readdirSync(dossier) : []);
|
|
137
125
|
|
|
138
|
-
// The filters of Turborepo among <args> (`--filter=<f>`, `--filter <f>`, `-F <f>`) and the other
|
|
139
|
-
// arguments: `{ filtres, autres }`, the filters each written `--filter=<f>`.
|
|
140
|
-
function separerLesFiltres(args) {
|
|
141
|
-
const filtres = [];
|
|
142
|
-
const autres = [];
|
|
143
|
-
for (let i = 0; i < args.length; i++) {
|
|
144
|
-
if (args[i].startsWith('--filter=')) filtres.push(args[i]);
|
|
145
|
-
else if ((args[i] === '--filter' || args[i] === '-F') && i + 1 < args.length)
|
|
146
|
-
filtres.push(`--filter=${args[++i]}`);
|
|
147
|
-
else autres.push(args[i]);
|
|
148
|
-
}
|
|
149
|
-
return { filtres, autres };
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// The names of the packages of <racine> the filters <filtres> choose, as Turborepo lists them.
|
|
153
|
-
function paquetsChoisis(racine, filtres, env) {
|
|
154
|
-
const r = spawnSync('turbo', ['ls', ...filtres, '--output=json'], {
|
|
155
|
-
cwd: racine,
|
|
156
|
-
env,
|
|
157
|
-
encoding: 'utf8',
|
|
158
|
-
maxBuffer: 64 * 1024 * 1024,
|
|
159
|
-
});
|
|
160
|
-
try {
|
|
161
|
-
return new Set(JSON.parse(r.stdout).packages.items.map(p => p.name));
|
|
162
|
-
} catch {
|
|
163
|
-
return null;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
126
|
// The tasks a pass plays side by side on a machine of <coeurs> cores: half of them, one at least.
|
|
168
127
|
const concurrence = (coeurs = availableParallelism()) => Math.max(1, Math.floor(coeurs / 2));
|
|
169
128
|
|
|
170
|
-
// <args> without a `--concurrency` (`--concurrency=<n>` or `--concurrency <n>`).
|
|
171
|
-
function sansConcurrence(args) {
|
|
172
|
-
const out = [];
|
|
173
|
-
for (let i = 0; i < args.length; i++) {
|
|
174
|
-
if (args[i] === '--concurrency') i++;
|
|
175
|
-
else if (!CONCURRENCE.test(args[i])) out.push(args[i]);
|
|
176
|
-
}
|
|
177
|
-
return out;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// The filters of the packages of <racine> that hold a time witness, `--filter=<name>` each; in a
|
|
181
|
-
// repository without packages, none when its root holds one. Null without a witness.
|
|
182
|
-
function filtresDesTemoins(racine) {
|
|
183
|
-
const liste = paquets(racine);
|
|
184
|
-
if (liste.length === 0) return fichiersTemoins(racine).length ? [] : null;
|
|
185
|
-
const noms = liste
|
|
186
|
-
.filter(p => !p.hors && p.pkg.scripts?.[SCRIPT_DES_TESTS])
|
|
187
|
-
.filter(p => fichiersTemoins(path.resolve(racine, p.dossier)).length > 0)
|
|
188
|
-
.map(p => p.pkg.name);
|
|
189
|
-
return noms.length ? noms.map(n => `--filter=${n}`) : null;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
129
|
// The full pass in <racine>, its arguments <args> (`--gardes` among them: the guards alone), under
|
|
193
|
-
// <env> and the lock of the machine; its verdict, 0
|
|
194
|
-
//
|
|
195
|
-
// `pasMs` are the bound of the wait and the gap between two readings of the pressure; `coeurs`,
|
|
196
|
-
// the cores of the machine.
|
|
130
|
+
// <env> and the lock of the machine; its verdict, 0 or 1, or 75 when the wait for the lock, or for
|
|
131
|
+
// room in the temporary directory, reaches its bound. `dire` writes a line; `coeurs`, the cores of the machine.
|
|
197
132
|
export function verifier({
|
|
198
133
|
racine = process.cwd(),
|
|
199
134
|
args: demandes = [],
|
|
200
135
|
env = process.env,
|
|
201
|
-
borneMs = BORNE_ATTENTE_MS,
|
|
202
|
-
pasMs = 2_000,
|
|
203
136
|
dire = l => process.stdout.write(`${l}\n`),
|
|
204
137
|
coeurs = availableParallelism(),
|
|
205
138
|
}) {
|
|
@@ -208,39 +141,26 @@ export function verifier({
|
|
|
208
141
|
const base = ouvrirBase('verification', { dans: env.TMPDIR || tmpdir() });
|
|
209
142
|
const lacher = retirerALInterruption(base.fermer);
|
|
210
143
|
try {
|
|
211
|
-
return
|
|
144
|
+
return avecLaMachineEtUnePlace(
|
|
212
145
|
envMachine => {
|
|
213
146
|
// The progress of the pass: the directory its caller names (the circuit's), else its own,
|
|
214
|
-
// named beside the lock of the machine while it plays.
|
|
147
|
+
// named beside the lock of the machine, which it holds, while it plays.
|
|
215
148
|
const propre = !envMachine[AVANCEMENT];
|
|
216
149
|
const dossier =
|
|
217
150
|
envMachine[AVANCEMENT] || ouvrirAvancement({ racine, genre: 'verification' });
|
|
218
|
-
const effacer =
|
|
219
|
-
propre && !paquetsDeLEnveloppe(envMachine)
|
|
220
|
-
? ecrireLaMesure({
|
|
221
|
-
env: envMachine,
|
|
222
|
-
depot: nomDuDepot(racine),
|
|
223
|
-
commande: [
|
|
224
|
-
'npm run verifier',
|
|
225
|
-
...(demandes.length ? ['--', ...demandes] : []),
|
|
226
|
-
].join(' '),
|
|
227
|
-
dossier,
|
|
228
|
-
})
|
|
229
|
-
: () => {};
|
|
151
|
+
const effacer = propre ? nommerLAvancement({ env: envMachine, dossier }) : () => {};
|
|
230
152
|
try {
|
|
231
153
|
return passe({
|
|
232
154
|
racine,
|
|
233
155
|
demandes,
|
|
234
156
|
env: { ...envMachine, [AVANCEMENT]: dossier, ...base.env },
|
|
235
|
-
borneMs,
|
|
236
|
-
pasMs,
|
|
237
157
|
dire,
|
|
238
158
|
coeurs,
|
|
239
159
|
});
|
|
240
160
|
} finally {
|
|
241
161
|
effacer();
|
|
242
162
|
if (propre) {
|
|
243
|
-
garderLeTotal(dossier
|
|
163
|
+
garderLeTotal(dossier);
|
|
244
164
|
rmSync(dossier, { recursive: true, force: true });
|
|
245
165
|
}
|
|
246
166
|
}
|
|
@@ -257,19 +177,6 @@ export function verifier({
|
|
|
257
177
|
}
|
|
258
178
|
}
|
|
259
179
|
|
|
260
|
-
// The name of the repository at <racine>: the folder of its main tree, its copies included; the
|
|
261
|
-
// folder of <racine> out of git.
|
|
262
|
-
function nomDuDepot(racine) {
|
|
263
|
-
const r = spawnSync(
|
|
264
|
-
'git',
|
|
265
|
-
['-C', racine, 'rev-parse', '--path-format=absolute', '--git-common-dir'],
|
|
266
|
-
{
|
|
267
|
-
encoding: 'utf8',
|
|
268
|
-
}
|
|
269
|
-
);
|
|
270
|
-
return path.basename(r.status === 0 ? path.dirname(r.stdout.trim()) : path.resolve(racine));
|
|
271
|
-
}
|
|
272
|
-
|
|
273
180
|
// Whether a package of <racine>, or its root, plays tests (a script `test:unit`).
|
|
274
181
|
function depotAvecTests(racine) {
|
|
275
182
|
const liste = paquets(racine);
|
|
@@ -287,11 +194,19 @@ function depotAvecTests(racine) {
|
|
|
287
194
|
return liste.some(p => !p.hors && p.pkg.scripts?.[SCRIPT_DES_TESTS]);
|
|
288
195
|
}
|
|
289
196
|
|
|
290
|
-
|
|
197
|
+
// Whether <args> hold a filter of Turborepo (`--filter=<f>`, `--filter <f>`, `-F <f>`).
|
|
198
|
+
const filtre = args => args.some(a => a.startsWith('--filter=') || a === '--filter' || a === '-F');
|
|
199
|
+
|
|
200
|
+
// A pass green on every package keeps its tree as the last green (`garder`): not when it is
|
|
201
|
+
// restricted by a filter, measured against nothing, or run after a red module (PASSE_ROUGE).
|
|
202
|
+
export function poserLeVert({ code, etat, args, env, garder }) {
|
|
203
|
+
if (code === 0 && etat && !filtre(args) && !env[PASSE_ROUGE]) garder(etat);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function passe({ racine, demandes, env, dire, coeurs }) {
|
|
291
207
|
const gardesSeules = demandes.includes('--gardes');
|
|
292
208
|
const tout = demandes.includes('--tout') || demandes.includes('--force');
|
|
293
209
|
const args = demandes.filter(a => a !== '--gardes' && a !== '--tout');
|
|
294
|
-
const { filtres: filtresDeLaPasse } = separerLesFiltres(args);
|
|
295
210
|
// The measure against the last green: the guards alone need none.
|
|
296
211
|
const m = gardesSeules ? null : mesure(racine, { tout, dans: env.TMPDIR });
|
|
297
212
|
if (m) dire(m.ligne);
|
|
@@ -304,8 +219,6 @@ function passe({ racine, demandes, env, borneMs, pasMs, dire, coeurs }) {
|
|
|
304
219
|
tout,
|
|
305
220
|
ajouts: m?.env ?? {},
|
|
306
221
|
env,
|
|
307
|
-
borneMs,
|
|
308
|
-
pasMs,
|
|
309
222
|
dire,
|
|
310
223
|
coeurs,
|
|
311
224
|
taches,
|
|
@@ -313,178 +226,79 @@ function passe({ racine, demandes, env, borneMs, pasMs, dire, coeurs }) {
|
|
|
313
226
|
if (env[ROUGES])
|
|
314
227
|
writeFileSync(env[ROUGES], [...taches].map(t => `${t}\t${rejeu(t)}\n`).join(''));
|
|
315
228
|
// A pass green on every package keeps its tree as the last green.
|
|
316
|
-
|
|
229
|
+
poserLeVert({ code, etat: m?.etat, args, env, garder: garderLeVert });
|
|
317
230
|
return code;
|
|
318
231
|
} finally {
|
|
319
232
|
m?.retirer();
|
|
320
233
|
}
|
|
321
234
|
}
|
|
322
235
|
|
|
323
|
-
function jouerLaPasse({
|
|
324
|
-
racine,
|
|
325
|
-
gardesSeules,
|
|
326
|
-
args,
|
|
327
|
-
tout,
|
|
328
|
-
ajouts,
|
|
329
|
-
env,
|
|
330
|
-
borneMs,
|
|
331
|
-
pasMs,
|
|
332
|
-
dire,
|
|
333
|
-
coeurs,
|
|
334
|
-
taches,
|
|
335
|
-
}) {
|
|
236
|
+
function jouerLaPasse({ racine, gardesSeules, args, tout, ajouts, env, dire, coeurs, taches }) {
|
|
336
237
|
const { [TESTS_CIBLES]: _, [CHANGEMENTS]: __, ...propre } = env;
|
|
337
|
-
// The
|
|
338
|
-
// real.
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
spawnSync('turbo', ['run', ...a], { cwd: racine, env: e, stdio: 'inherit' });
|
|
349
|
-
// Each red named, then the verdict 1.
|
|
350
|
-
const rouge = liste => {
|
|
351
|
-
for (const r of liste) dire(`⛔ ${r}`);
|
|
352
|
-
dire('⛔ rouge.');
|
|
353
|
-
return 1;
|
|
354
|
-
};
|
|
355
|
-
|
|
356
|
-
// One run of Turborepo, and its summary.
|
|
357
|
-
const runs = path.join(racine, '.turbo', 'runs');
|
|
358
|
-
const jouer = (a, e, libelle) => {
|
|
359
|
-
const existait = existsSync(runs);
|
|
360
|
-
const avant = new Set(lister(runs));
|
|
361
|
-
const r = turbo([...a, '--summarize'], e);
|
|
362
|
-
const nouveaux = lister(runs).filter(f => !avant.has(f) && f.endsWith('.json'));
|
|
363
|
-
let resume = null;
|
|
364
|
-
if (nouveaux.length === 1) {
|
|
365
|
-
try {
|
|
366
|
-
resume = JSON.parse(readFileSync(path.join(runs, nouveaux[0]), 'utf8'));
|
|
367
|
-
} catch {
|
|
368
|
-
resume = null;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
garderLesResumes(racine, avant, e);
|
|
372
|
-
if (!existait && existsSync(runs) && lister(runs).length === 0) rmdirSync(runs);
|
|
373
|
-
return { r, resume, env: e, libelle };
|
|
374
|
-
};
|
|
375
|
-
|
|
238
|
+
// The environment of the run: measured against the last green; the moment of a complete pass,
|
|
239
|
+
// which moves the hash of every task of tests, so that each plays for real.
|
|
240
|
+
const e = gardesSeules
|
|
241
|
+
? propre
|
|
242
|
+
: {
|
|
243
|
+
...propre,
|
|
244
|
+
...ajouts,
|
|
245
|
+
...(tout
|
|
246
|
+
? { [TESTS_CIBLES]: JSON.stringify(testsCibles({ arguments: [], force: true })) }
|
|
247
|
+
: {}),
|
|
248
|
+
};
|
|
376
249
|
const borne = args.some(a => CONCURRENCE.test(a)) ? [] : [`--concurrency=${concurrence(coeurs)}`];
|
|
377
|
-
const
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
...args,
|
|
384
|
-
],
|
|
385
|
-
e: gardesSeules ? propre : choix('hors'),
|
|
386
|
-
libelle: '',
|
|
387
|
-
},
|
|
250
|
+
const a = [
|
|
251
|
+
...(gardesSeules ? GARDES : TACHES),
|
|
252
|
+
...controlesDuDepot(racine),
|
|
253
|
+
'--continue=dependencies-successful',
|
|
254
|
+
...borne,
|
|
255
|
+
...args,
|
|
388
256
|
];
|
|
389
|
-
// The
|
|
390
|
-
const { filtres: filtresDeLaPasse, autres } = separerLesFiltres(args);
|
|
391
|
-
let filtres = gardesSeules ? null : filtresDesTemoins(racine);
|
|
392
|
-
if (filtres?.length && filtresDeLaPasse.length) {
|
|
393
|
-
const choisis = paquetsChoisis(racine, filtresDeLaPasse, propre);
|
|
394
|
-
if (choisis) filtres = filtres.filter(f => choisis.has(f.slice('--filter='.length)));
|
|
395
|
-
if (filtres.length === 0) filtres = null;
|
|
396
|
-
}
|
|
397
|
-
if (filtres) {
|
|
398
|
-
lancements.push({
|
|
399
|
-
a: [
|
|
400
|
-
SCRIPT_DES_TESTS,
|
|
401
|
-
...filtres,
|
|
402
|
-
'--continue=dependencies-successful',
|
|
403
|
-
'--concurrency=1',
|
|
404
|
-
...sansConcurrence(filtres.length || !filtresDeLaPasse.length ? autres : args),
|
|
405
|
-
],
|
|
406
|
-
e: choix('seuls'),
|
|
407
|
-
libelle: TEMOINS,
|
|
408
|
-
});
|
|
409
|
-
}
|
|
410
|
-
// The plan of each run that plays tests, before the first: the progress knows all its tasks.
|
|
257
|
+
// The plan of the run, before it: the progress knows all its tasks.
|
|
411
258
|
if (!gardesSeules && depotAvecTests(racine)) {
|
|
412
|
-
|
|
259
|
+
planifier(env[AVANCEMENT], { racine, args: a, env: e });
|
|
413
260
|
}
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
261
|
+
// The run of Turborepo, and its summary.
|
|
262
|
+
const runs = path.join(racine, '.turbo', 'runs');
|
|
263
|
+
const existait = existsSync(runs);
|
|
264
|
+
const avant = new Set(lister(runs));
|
|
265
|
+
const r = spawnSync('turbo', ['run', ...a, '--summarize'], {
|
|
266
|
+
cwd: racine,
|
|
267
|
+
env: e,
|
|
268
|
+
stdio: 'inherit',
|
|
269
|
+
});
|
|
270
|
+
const nouveaux = lister(runs).filter(f => !avant.has(f) && f.endsWith('.json'));
|
|
271
|
+
let resume = null;
|
|
272
|
+
if (nouveaux.length === 1) {
|
|
273
|
+
try {
|
|
274
|
+
resume = JSON.parse(readFileSync(path.join(runs, nouveaux[0]), 'utf8'));
|
|
275
|
+
} catch {
|
|
276
|
+
resume = null;
|
|
419
277
|
}
|
|
420
|
-
passes.push(jouer(a, e, libelle));
|
|
421
278
|
}
|
|
422
|
-
|
|
279
|
+
garderLesResumes(racine, avant, e);
|
|
280
|
+
if (!existait && existsSync(runs) && lister(runs).length === 0) rmdirSync(runs);
|
|
281
|
+
if (r.status === 0) return 0;
|
|
423
282
|
|
|
424
|
-
// The verdict of each task.
|
|
283
|
+
// The verdict of each task: any code but 0 is a red, named.
|
|
425
284
|
const rouges = [];
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
`rouge${libelle} : Turborepo sort en ${r.status ?? r.signal}, et le résumé de la passe ne se lit pas.`
|
|
432
|
-
);
|
|
433
|
-
continue;
|
|
434
|
-
}
|
|
435
|
-
let echecs = 0;
|
|
285
|
+
if (!Array.isArray(resume?.tasks)) {
|
|
286
|
+
rouges.push(
|
|
287
|
+
`rouge : Turborepo sort en ${r.status ?? r.signal}, et le résumé de la passe ne se lit pas.`
|
|
288
|
+
);
|
|
289
|
+
} else {
|
|
436
290
|
for (const t of resume.tasks) {
|
|
437
291
|
const code = t.execution?.exitCode;
|
|
438
292
|
if (code === 0) continue;
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
if (code === A_REPASSER && (t.dependents ?? []).length === 0)
|
|
442
|
-
aRepasser.push({ ...t, nom, env: e });
|
|
443
|
-
else if (code === A_REPASSER)
|
|
444
|
-
rouges.push(`${nom} à repasser, mais ${t.dependents.join(', ')} l'attendent`);
|
|
445
|
-
else {
|
|
446
|
-
rouges.push(`${nom} (code ${code ?? 'absent'})`);
|
|
447
|
-
if (typeof code === 'number') taches.add(t.taskId);
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
if (echecs === 0)
|
|
451
|
-
rouges.push(`Turborepo sort en ${r.status ?? r.signal}${libelle} sans tâche en échec`);
|
|
452
|
-
}
|
|
453
|
-
if (rouges.length > 0) return rouge(rouges);
|
|
454
|
-
|
|
455
|
-
// The tasks à repasser, each played again at rest in the choice of its run, until the bound.
|
|
456
|
-
const limite = Date.now() + borneMs;
|
|
457
|
-
const lire = () => lirePression(env.GRILLHOUSE_PRESSION_CPU || undefined);
|
|
458
|
-
let restants = aRepasser;
|
|
459
|
-
dire(
|
|
460
|
-
`⏱ à repasser : ${restants.map(t => t.nom).join(', ')} ; chaque tâche se rejoue seule, au repos.`
|
|
461
|
-
);
|
|
462
|
-
while (restants.length > 0) {
|
|
463
|
-
const suivants = [];
|
|
464
|
-
for (const [i, t] of restants.entries()) {
|
|
465
|
-
if (Date.now() >= limite || !attendreLeRepos({ lire, limite, pasMs, dire })) {
|
|
466
|
-
const ouverts = [...suivants, ...restants.slice(i)].map(x => x.nom).join(', ');
|
|
467
|
-
const borneTexte =
|
|
468
|
-
borneMs >= 60_000 ? `${Math.round(borneMs / 60_000)} min` : `${borneMs / 1000} s`;
|
|
469
|
-
dire(`⏱ pas de repos en ${borneTexte} : ${ouverts} ni vert ni rouge.`);
|
|
470
|
-
// A task red at rest makes the pass red, whatever remains to play.
|
|
471
|
-
if (rouges.length > 0) return rouge(rouges);
|
|
472
|
-
dire(`⏱ à repasser (code ${A_REPASSER}).`);
|
|
473
|
-
return A_REPASSER;
|
|
474
|
-
}
|
|
475
|
-
dire(`↻ ${t.nom} : relance au repos.`);
|
|
476
|
-
const r = turbo([t.task, `--filter=${t.package}`, ...args], t.env);
|
|
477
|
-
if (r.status === 0) dire(`✓ ${t.nom} vert au repos.`);
|
|
478
|
-
else if (r.status === A_REPASSER) suivants.push(t);
|
|
479
|
-
else {
|
|
480
|
-
rouges.push(`${t.nom} rouge au repos (code ${r.status ?? r.signal})`);
|
|
481
|
-
taches.add(t.taskId);
|
|
482
|
-
}
|
|
293
|
+
rouges.push(`${t.taskId} (code ${code ?? 'absent'})`);
|
|
294
|
+
if (typeof code === 'number') taches.add(t.taskId);
|
|
483
295
|
}
|
|
484
|
-
|
|
296
|
+
if (rouges.length === 0)
|
|
297
|
+
rouges.push(`Turborepo sort en ${r.status ?? r.signal} sans tâche en échec`);
|
|
485
298
|
}
|
|
486
|
-
|
|
487
|
-
|
|
299
|
+
for (const l of rouges) dire(`⛔ ${l}`);
|
|
300
|
+
dire('⛔ rouge.');
|
|
301
|
+
return 1;
|
|
488
302
|
}
|
|
489
303
|
|
|
490
304
|
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
@@ -11,12 +11,13 @@
|
|
|
11
11
|
// writes (scripts/grillhouse-maj.mjs). Grillhouse's package imports it by its own name.
|
|
12
12
|
//
|
|
13
13
|
// - The exclusions of the day: a night test (`*.nuit.test.*`, `*.nuit.spec.*`) is too long for the
|
|
14
|
-
// day, and
|
|
15
|
-
//
|
|
16
|
-
// the
|
|
14
|
+
// day, and every measure of time, a time budget bench (`*.budget.test.*`, `*.budget.spec.*`) or
|
|
15
|
+
// a time witness (a test file that imports `mesurerAuRepos`), moves with the load of the day:
|
|
16
|
+
// `npm test`, `npm run verifier` and the integration leave them out, and the night plays them
|
|
17
|
+
// (scripts/nuit.sh, scripts/langages/typescript/vitest.nuit.config.mjs); a targeted run that
|
|
17
18
|
// names the file of one itself plays it, under the measure of time below (./cibles.mjs, where
|
|
18
|
-
// the patterns live). `mergeConfig` adds the
|
|
19
|
-
// to these.
|
|
19
|
+
// the patterns live, and whose plugin leaves the witnesses out). `mergeConfig` adds the
|
|
20
|
+
// exclusions of a configuration that extends this one to these.
|
|
20
21
|
// - A run that plays no test fails, as Vitest's default has it (`passWithNoTests` unset): a
|
|
21
22
|
// targeted run (`npm test -- <paths>`, scripts/langages/typescript/tests.mjs) plays each path in its package only,
|
|
22
23
|
// and a path that names no test is a mistake, never a green.
|
|
@@ -26,23 +27,25 @@
|
|
|
26
27
|
// tests Vitest relates to the files changed since it (`GRILLHOUSE_CHANGEMENTS`,
|
|
27
28
|
// ./changements.mjs). `mergeConfig` adds the plugins of a configuration that extends this one to
|
|
28
29
|
// it.
|
|
30
|
+
// - A test has the delay of its size, as in Bazel (the delays are in ./bornes.mjs), the size read
|
|
31
|
+
// by the classification of the guard of the sizes, one address (./delais.mjs, applied to each
|
|
32
|
+
// test file by ./delais.setup.mjs). `slowTestThreshold` marks the slow tests, and the duration
|
|
33
|
+
// reporter names the 20 slowest files and their share of the time.
|
|
29
34
|
// - The common environment: Node, no watch, and git's settings for the tests by the environment
|
|
30
35
|
// (GIT_CONFIG_COUNT/KEY/VALUE, git-config(1)), the automatic maintenance and garbage collection
|
|
31
36
|
// off (maintenance.auto=false, gc.auto=0). This file is the one address of these settings; the
|
|
32
37
|
// night configuration takes them from here.
|
|
33
|
-
// - A time
|
|
38
|
+
// - A measure of time is taken with the CPU at rest: a setup file notes the CPU pressure at the
|
|
34
39
|
// start and at the end of each test (./mesure.setup.mjs), and the duration reporter, beside
|
|
35
40
|
// Vitest's default one, gives the exit code 75, « à repasser », when every failure depends on a
|
|
36
41
|
// duration and one took place under load (./duree.reporter.mjs; the signal and its threshold,
|
|
37
|
-
//
|
|
42
|
+
// scripts/mesure/pression.mjs); a delay past in a day test is a red. A test that measures time marks itself (`mesurerAuRepos`,
|
|
38
43
|
// `@roomi-fields/grillhouse/vitest-config/mesure`). `mergeConfig` adds the reporters and the setup files of
|
|
39
44
|
// a configuration that extends this one to these; a reporter named on the command line
|
|
40
45
|
// (`--reporter`) replaces them, and Vitest's code then stands.
|
|
41
46
|
// - The machine of a test file is its own: a setup file gives it a lock of the heavy measure of
|
|
42
47
|
// its own, so that a `npm run verifier` a test plays in a repository of trial neither waits for
|
|
43
48
|
// the lock of the machine nor holds it (./machine.setup.mjs, scripts/verrou-de-machine.mjs).
|
|
44
|
-
// - The time witnesses play alone in `npm run verifier`: the plugin below leaves them out of its
|
|
45
|
-
// pass, then plays them in a pass of their own (./cibles.mjs, scripts/langages/typescript/verifier.mjs).
|
|
46
49
|
// - While a run names its results directory (`GRILLHOUSE_RESULTATS`, ./resultats.mjs), the JSON
|
|
47
50
|
// reporter writes Vitest's report there too, which the circuit reads (scripts/resultats.mjs); a
|
|
48
51
|
// setup file gives each test file's processes a results directory of their own, so that a run a
|
|
@@ -63,7 +66,12 @@
|
|
|
63
66
|
// task at each test file done, which the board reads (scripts/avancement.mjs,
|
|
64
67
|
// scripts/tableau.mjs).
|
|
65
68
|
import { fileURLToPath } from 'node:url';
|
|
66
|
-
import {
|
|
69
|
+
import {
|
|
70
|
+
ligneDesRestes,
|
|
71
|
+
ouvrirBase,
|
|
72
|
+
retirerALInterruption,
|
|
73
|
+
travailleursDeLaSeance,
|
|
74
|
+
} from '../../../services-du-noyau.mjs';
|
|
67
75
|
import { ciblage, HORS_DU_JOUR } from './cibles.mjs';
|
|
68
76
|
import { rapportAvancement } from './avancement.reporter.mjs';
|
|
69
77
|
import { rapportJson } from './resultats.mjs';
|
|
@@ -131,11 +139,23 @@ export default {
|
|
|
131
139
|
},
|
|
132
140
|
exclude: ['**/node_modules/**', '**/dist/**', ...HORS_DU_JOUR],
|
|
133
141
|
reporters: ['default', ici('./duree.reporter.mjs'), ...rapportJson(), ...rapportAvancement()],
|
|
142
|
+
// The slow-test mark of the report, in ms: Vitest's default, fixed, apart from the delays.
|
|
143
|
+
slowTestThreshold: 300,
|
|
134
144
|
setupFiles: [
|
|
145
|
+
ici('./delais.setup.mjs'),
|
|
135
146
|
ici('./mesure.setup.mjs'),
|
|
136
147
|
ici('./machine.setup.mjs'),
|
|
137
148
|
ici('./resultats.setup.mjs'),
|
|
138
149
|
],
|
|
139
150
|
watch: false,
|
|
151
|
+
...travailleurs(),
|
|
140
152
|
},
|
|
141
153
|
};
|
|
154
|
+
|
|
155
|
+
// The workers of a session of an agent: `maxWorkers` of Vitest is GRILLHOUSE_TRAVAILLEURS
|
|
156
|
+
// (max(1, cores ÷ places), scripts/places-de-la-machine.mjs); without it (a heavy pass), Vitest's
|
|
157
|
+
// own default stands: every core.
|
|
158
|
+
function travailleurs() {
|
|
159
|
+
const n = travailleursDeLaSeance(process.env);
|
|
160
|
+
return n === null ? {} : { maxWorkers: n };
|
|
161
|
+
}
|