@roomi-fields/grillhouse 0.32.0 → 0.33.1
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 +32 -0
- package/bin/grillhouse.mjs +6 -4
- package/cadre/templates/projet/.github/workflows/ci.yml +169 -16
- package/cadre/templates/projet/.github/workflows/nuit.yml +111 -0
- package/cadre/templates/projet/deployment/docs/01-INSTALL.md +4 -4
- package/cadre/templates/projet/package.json +2 -2
- package/charte.md +8 -5
- package/dist/temporal/circuit/client.d.ts +10 -3
- package/dist/temporal/circuit/client.js +8 -4
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +25 -0
- package/dist/temporal/circuit/contrat.js +31 -0
- package/dist/temporal/circuit/contrat.js.map +1 -1
- package/dist/temporal/circuit/deroule.js +67 -38
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/commande.js +13 -3
- package/dist/temporal/commande.js.map +1 -1
- package/dist/temporal/deroules.d.ts +1 -0
- package/dist/temporal/deroules.js +3 -1
- package/dist/temporal/deroules.js.map +1 -1
- package/dist/temporal/file/activites.d.ts +1 -0
- package/dist/temporal/file/activites.js +5 -2
- package/dist/temporal/file/activites.js.map +1 -1
- package/dist/temporal/file/contrat.d.ts +50 -33
- package/dist/temporal/file/contrat.js +2 -2
- package/dist/temporal/file/contrat.js.map +1 -1
- package/dist/temporal/file/deroule.d.ts +3 -1
- package/dist/temporal/file/deroule.js +128 -26
- package/dist/temporal/file/deroule.js.map +1 -1
- package/dist/temporal/installation.d.ts +15 -1
- package/dist/temporal/installation.js +57 -15
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/nuits/activites.d.ts +10 -0
- package/dist/temporal/nuits/activites.js +114 -0
- package/dist/temporal/nuits/activites.js.map +1 -0
- package/dist/temporal/nuits/appel.d.ts +23 -0
- package/dist/temporal/nuits/appel.js +40 -0
- package/dist/temporal/nuits/appel.js.map +1 -0
- package/dist/temporal/nuits/choix.d.ts +14 -0
- package/dist/temporal/nuits/choix.js +119 -0
- package/dist/temporal/nuits/choix.js.map +1 -0
- package/dist/temporal/nuits/client.d.ts +28 -0
- package/dist/temporal/nuits/client.js +83 -0
- package/dist/temporal/nuits/client.js.map +1 -0
- package/dist/temporal/nuits/commande.d.ts +2 -0
- package/dist/temporal/nuits/commande.js +107 -0
- package/dist/temporal/nuits/commande.js.map +1 -0
- package/dist/temporal/nuits/contrat.d.ts +98 -0
- package/dist/temporal/nuits/contrat.js +30 -0
- package/dist/temporal/nuits/contrat.js.map +1 -0
- package/dist/temporal/nuits/deroule.d.ts +5 -0
- package/dist/temporal/nuits/deroule.js +100 -0
- package/dist/temporal/nuits/deroule.js.map +1 -0
- package/dist/temporal/travailleur.js +4 -1
- package/dist/temporal/travailleur.js.map +1 -1
- package/docs/ARCHITECTURE.md +214 -49
- package/docs/CADRE.md +31 -1
- package/docs/INTERFACE.md +47 -7
- package/hooks/register.tsx +11 -3
- package/package.json +4 -1
- package/scripts/abi-des-dependances.mjs +105 -0
- package/scripts/activites.mjs +113 -42
- package/scripts/aiguillage.mjs +1 -0
- package/scripts/avancement.mjs +8 -18
- package/scripts/ci-des-branches.mjs +91 -0
- package/scripts/circuit.mjs +79 -4
- package/scripts/circuits-du-serveur.mjs +4 -3
- package/scripts/composants-affectes.mjs +24 -7
- package/scripts/composition-des-langages.mjs +3 -0
- package/scripts/crochets.mjs +4 -0
- package/scripts/dernier-vert.mjs +31 -10
- package/scripts/enveloppe/enveloppe.mjs +3 -1
- package/scripts/enveloppe/lancer.sh +1 -1
- package/scripts/enveloppe/travail-de-la-copie.mjs +219 -59
- package/scripts/etapes.mjs +18 -1
- package/scripts/faits-du-circuit.mjs +43 -20
- package/scripts/fichier-du-poste.mjs +87 -0
- package/scripts/grillhouse-maj.mjs +15 -1
- package/scripts/integration/file.mjs +215 -275
- package/scripts/integration/integrer.mjs +82 -41
- package/scripts/integration/rejeu.mjs +13 -64
- package/scripts/jointure.d.ts +26 -2
- package/scripts/langages/cargo/commandes.mjs +81 -19
- package/scripts/langages/cargo/exemples.mjs +2 -2
- package/scripts/langages/cargo/index.mjs +11 -5
- package/scripts/langages/cargo/tailles-des-tests.mjs +19 -11
- package/scripts/langages/python/commandes.mjs +11 -7
- package/scripts/langages/python/exemples.mjs +1 -1
- package/scripts/langages/python/index.mjs +9 -2
- package/scripts/langages/python/tailles-des-tests.mjs +19 -11
- package/scripts/langages/typescript/code-mort.mjs +41 -24
- package/scripts/langages/typescript/consommateurs.mjs +28 -17
- package/scripts/langages/typescript/exemples.mjs +2 -0
- package/scripts/langages/typescript/index.mjs +22 -3
- package/scripts/langages/typescript/migrations/0.33.0-binaire-de-jour.mjs +34 -0
- package/scripts/langages/typescript/migrations/0.33.0-tests-du-poste.mjs +31 -0
- package/scripts/langages/typescript/resumes.mjs +17 -7
- package/scripts/langages/typescript/tailles-des-tests.mjs +251 -22
- package/scripts/langages/typescript/tests-de-nuit.mjs +101 -9
- package/scripts/langages/typescript/tests-du-poste.mjs +172 -0
- package/scripts/langages/typescript/tests.mjs +8 -2
- package/scripts/langages/typescript/tranches.mjs +273 -0
- package/scripts/langages/typescript/verifier.mjs +140 -31
- package/scripts/langages/typescript/vitest-config/changements.mjs +23 -11
- package/scripts/langages/typescript/vitest-config/cibles.mjs +78 -7
- package/scripts/langages/typescript/vitest-config/lances.mjs +4 -4
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +9 -0
- package/scripts/langages/typescript/vitest.nuit.config.mjs +3 -2
- package/scripts/lint-des-scripts.mjs +23 -6
- package/scripts/migrations/0.33.0-cache-distant.mjs +36 -0
- package/scripts/migrations/0.33.0-ci-des-branches-de-ticket.mjs +31 -0
- package/scripts/migrations/0.33.0-ci-du-cadre.mjs +31 -0
- package/scripts/migrations/0.33.0-node-26.mjs +58 -0
- package/scripts/migrations.mjs +8 -0
- package/scripts/newday.mjs +18 -0
- package/scripts/nuit.sh +35 -17
- package/scripts/registre.d.mts +90 -0
- package/scripts/registre.mjs +28 -3
- package/scripts/reprise.mjs +12 -8
- package/scripts/services-du-noyau.mjs +5 -1
- package/scripts/session-start.sh +40 -32
- package/scripts/sous-commandes.mjs +29 -10
- package/scripts/superviseur.mjs +72 -27
- package/scripts/tableau.mjs +129 -20
- package/scripts/taches-du-graphe.mjs +39 -6
- package/scripts/transitions.mjs +42 -3
- package/scripts/verrou-de-machine.mjs +1 -2
- package/scripts/workflows-du-cadre.mjs +75 -0
- package/skills/grill/SKILL.md +8 -6
- package/skills/pitmaster/SKILL.md +15 -9
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
// npx grillhouse verifier [<argument of Turborepo>…] (npm run verifier -- --force)
|
|
7
7
|
// npx grillhouse verifier --tout [<argument>…] every test, played for real
|
|
8
8
|
// npx grillhouse verifier --gardes [<argument>…] the guards alone (the reviewer)
|
|
9
|
+
// npx grillhouse verifier --sans-tests [<argument>…] every control but the tests
|
|
10
|
+
// npx grillhouse verifier --tranche i/n [<argument>…] the tests of the tranche i of n
|
|
9
11
|
//
|
|
10
12
|
// - A pass measures itself against the last green (scripts/dernier-vert.mjs), as
|
|
11
13
|
// `vitest --changed` and `jest --onlyChanged` do: the tree of the last pass green on every
|
|
@@ -15,7 +17,10 @@
|
|
|
15
17
|
// a package whose inputs did not move replays from Turborepo's cache, the guards play whole,
|
|
16
18
|
// and so do the builds. The changes reach Vitest in a variable no hash counts
|
|
17
19
|
// (`GRILLHOUSE_CHANGEMENTS`). Without a last green that counts, the pass is complete. The
|
|
18
|
-
// line `↳` says which.
|
|
20
|
+
// line `↳` says which. The final pass of a circuit gives the base of its lot
|
|
21
|
+
// (`GRILLHOUSE_BASE_DU_LOT`, scripts/dernier-vert.mjs): it measures itself against it, targeted,
|
|
22
|
+
// the tests Vitest relates to the lot, never the whole package for a file out of its graph; a
|
|
23
|
+
// `--base` given takes precedence. A pass green, restricted by no filter, keeps its tree as the last green;
|
|
19
24
|
// a red one keeps the last green as it was. The pass is the one that keeps it, for every language
|
|
20
25
|
// of the project: it plays the tasks of every package of the graph, a crate's and a Python
|
|
21
26
|
// project's beside a TypeScript package's (their `test:unit` and `typecheck`, scripts of their
|
|
@@ -80,6 +85,18 @@
|
|
|
80
85
|
// run of Turborepo gets it in TMPDIR, TMP and TEMP, the root's `globalPassThroughEnv` passing
|
|
81
86
|
// TMPDIR on to every task (scripts/langages/typescript/turbo-des-paquets.mjs), and the pass
|
|
82
87
|
// removes it at its end, green, red or interrupted (SIGINT, SIGTERM, SIGHUP).
|
|
88
|
+
// - `--sans-tests` plays every task of the pass but the tests: the guards, the typing, the format
|
|
89
|
+
// check and the lint (`turbo run grillhouse:gardes gardes typecheck format:check lint …`), with no
|
|
90
|
+
// measure; `--tranche i/n` plays the tasks of tests alone (`turbo run test:unit …`), with the
|
|
91
|
+
// builds they depend on, each package of Vitest playing the i-th of n parts of its test files
|
|
92
|
+
// (./tranches.mjs): the n tranches and `--sans-tests` together play the complete pass, each task
|
|
93
|
+
// once, as the CI plays it, one job each. A tranche is measured as the pass is (against the last
|
|
94
|
+
// green or its `--base`; complete with `--tout`), carries itself in the variable
|
|
95
|
+
// `GRILLHOUSE_TESTS`, which the hash of the tests counts (two tranches never replay one another
|
|
96
|
+
// from the cache), plays for real, since it writes its reports (./tranches.mjs, under
|
|
97
|
+
// `.vitest-reports/`, its former ones removed first), and never keeps its tree as the last green,
|
|
98
|
+
// green or not; neither does `--sans-tests`. A tranche not of the form `i/n` (1 ≤ i ≤ n), or given
|
|
99
|
+
// with `--gardes` or `--sans-tests`, is refused before any work, code 1.
|
|
83
100
|
// - The run plays without the paths of a targeted run's tests: the variable `GRILLHOUSE_TESTS`
|
|
84
101
|
// (scripts/langages/typescript/vitest-config/cibles.mjs) carries only `rejouer`, for a complete
|
|
85
102
|
// pass.
|
|
@@ -92,9 +109,12 @@ import {
|
|
|
92
109
|
AttenteDeLaMachine,
|
|
93
110
|
AVANCEMENT,
|
|
94
111
|
avecLaMachineEtUnePlace,
|
|
112
|
+
BASE_DU_LOT,
|
|
95
113
|
CHANGEMENTS,
|
|
96
114
|
garderLeTotal,
|
|
97
115
|
garderLeVert,
|
|
116
|
+
LA_FORME,
|
|
117
|
+
lireLaTranche,
|
|
98
118
|
mesure,
|
|
99
119
|
nommerLAvancement,
|
|
100
120
|
ouvrirAvancement,
|
|
@@ -106,6 +126,7 @@ import {
|
|
|
106
126
|
testsCibles,
|
|
107
127
|
} from '../../services-du-noyau.mjs';
|
|
108
128
|
import { paquets, TYPAGE } from '../../paquets.mjs';
|
|
129
|
+
import { fichiersDeLaTranche, RAPPORTS } from './tranches.mjs';
|
|
109
130
|
import { controlesDuDepot, planifier } from './turbo-des-paquets.mjs';
|
|
110
131
|
import { garderLesResumes } from './verdict.mjs';
|
|
111
132
|
|
|
@@ -136,6 +157,12 @@ export function verifier({
|
|
|
136
157
|
dire = l => process.stdout.write(`${l}\n`),
|
|
137
158
|
coeurs = availableParallelism(),
|
|
138
159
|
}) {
|
|
160
|
+
// A malformed request is refused before any work.
|
|
161
|
+
const { erreur } = lireLesDemandes(demandes);
|
|
162
|
+
if (erreur) {
|
|
163
|
+
dire(erreur);
|
|
164
|
+
return 1;
|
|
165
|
+
}
|
|
139
166
|
// The base of the pass, in the temporary directory of <env>: every task writes in it (TMPDIR,
|
|
140
167
|
// which Turborepo passes on), and it goes at the end of the pass.
|
|
141
168
|
const base = ouvrirBase('verification', { dans: env.TMPDIR || tmpdir() });
|
|
@@ -200,28 +227,40 @@ function depotAvecTests(racine) {
|
|
|
200
227
|
const filtre = args => args.some(a => a.startsWith('--filter=') || a === '--filter' || a === '-F');
|
|
201
228
|
|
|
202
229
|
// A pass green on every package keeps its tree as the last green (`garder`): not when it is
|
|
203
|
-
// restricted by a filter
|
|
204
|
-
|
|
205
|
-
|
|
230
|
+
// restricted by a filter or to a part of its tasks (<partielle>: a tranche, `--sans-tests`),
|
|
231
|
+
// measured against nothing, or run after a red module (PASSE_ROUGE).
|
|
232
|
+
export function poserLeVert({ code, etat, args, env, garder, partielle = false }) {
|
|
233
|
+
if (code === 0 && etat && !partielle && !filtre(args) && !env[PASSE_ROUGE]) {
|
|
206
234
|
garder(etat);
|
|
207
235
|
}
|
|
208
236
|
}
|
|
209
237
|
|
|
210
|
-
// The options of the pass in <demandes>: `{ gardesSeules, tout, base, args
|
|
211
|
-
// (or `--base=<commit>`) belongs to the verification alone: it never
|
|
212
|
-
// '' when it has no value (alone, or followed by another option), and
|
|
213
|
-
// given or when the guards alone ask for
|
|
238
|
+
// The options of the pass in <demandes>: `{ gardesSeules, sansTests, tranche, tout, base, args,
|
|
239
|
+
// erreur }`. `--base <commit>` (or `--base=<commit>`) belongs to the verification alone: it never
|
|
240
|
+
// reaches the tasks, `base` is '' when it has no value (alone, or followed by another option), and
|
|
241
|
+
// undefined when it is not given or when the guards alone, or the pass without its tests, ask for
|
|
242
|
+
// no measure. `--tranche i/n` (or `--tranche=i/n`) neither: `tranche` is `{ index, count }`;
|
|
243
|
+
// `erreur`, the line that refuses a tranche not of the form i/n, or given with `--gardes` or
|
|
244
|
+
// `--sans-tests`.
|
|
214
245
|
export function lireLesDemandes(demandes) {
|
|
215
246
|
const gardesSeules = demandes.includes('--gardes');
|
|
247
|
+
const sansTests = demandes.includes('--sans-tests');
|
|
216
248
|
const tout = demandes.includes('--tout') || demandes.includes('--force');
|
|
217
249
|
let base;
|
|
250
|
+
let texte;
|
|
218
251
|
const args = [];
|
|
219
252
|
for (let i = 0; i < demandes.length; i++) {
|
|
220
253
|
const a = demandes[i];
|
|
221
|
-
if (a === '--gardes' || a === '--tout') {
|
|
254
|
+
if (a === '--gardes' || a === '--tout' || a === '--sans-tests') {
|
|
222
255
|
continue;
|
|
223
256
|
}
|
|
224
|
-
if (a === '--
|
|
257
|
+
if (a === '--tranche') {
|
|
258
|
+
const suite = demandes[i + 1];
|
|
259
|
+
texte = suite !== undefined && !suite.startsWith('-') ? suite : '';
|
|
260
|
+
i += texte ? 1 : 0;
|
|
261
|
+
} else if (a.startsWith('--tranche=')) {
|
|
262
|
+
texte = a.slice('--tranche='.length);
|
|
263
|
+
} else if (a === '--base') {
|
|
225
264
|
const suite = demandes[i + 1];
|
|
226
265
|
if (suite !== undefined && !suite.startsWith('-')) {
|
|
227
266
|
base = suite;
|
|
@@ -235,21 +274,84 @@ export function lireLesDemandes(demandes) {
|
|
|
235
274
|
args.push(a);
|
|
236
275
|
}
|
|
237
276
|
}
|
|
238
|
-
|
|
277
|
+
const tranche = texte === undefined ? undefined : (lireLaTranche(texte) ?? undefined);
|
|
278
|
+
let erreur;
|
|
279
|
+
if (texte !== undefined && !tranche) {
|
|
280
|
+
erreur = `⛔ --tranche attend la forme ${LA_FORME}, deux entiers avec 1 ≤ i ≤ n (par exemple --tranche 1/3) : « ${texte} » ne l'a pas.`;
|
|
281
|
+
} else if (tranche && (gardesSeules || sansTests)) {
|
|
282
|
+
erreur = `⛔ --tranche joue les seuls tests : elle ne se combine ni avec --gardes ni avec --sans-tests.`;
|
|
283
|
+
}
|
|
284
|
+
const mesure = !gardesSeules && !sansTests;
|
|
285
|
+
return {
|
|
286
|
+
gardesSeules,
|
|
287
|
+
sansTests,
|
|
288
|
+
tranche,
|
|
289
|
+
tout,
|
|
290
|
+
base: mesure ? base : undefined,
|
|
291
|
+
args,
|
|
292
|
+
...(erreur ? { erreur } : {}),
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* The tasks of Turborepo a pass plays, from its options (`lireLesDemandes`), <controles> the tasks
|
|
298
|
+
* of the format check and the lint of the repository (`controlesDuDepot`): a tranche, the tests
|
|
299
|
+
* alone; `--gardes`, the guards and the controls; `--sans-tests`, every task but the tests; else
|
|
300
|
+
* every task.
|
|
301
|
+
* @param {{ gardesSeules?: boolean, sansTests?: boolean, tranche?: object }} demandes
|
|
302
|
+
* @param {string[]} controles
|
|
303
|
+
* @returns {string[]}
|
|
304
|
+
*/
|
|
305
|
+
export function tachesDeLaPasse({ gardesSeules, sansTests, tranche }, controles) {
|
|
306
|
+
if (tranche) {
|
|
307
|
+
return [SCRIPT_DES_TESTS];
|
|
308
|
+
}
|
|
309
|
+
if (gardesSeules) {
|
|
310
|
+
return [...GARDES, ...controles];
|
|
311
|
+
}
|
|
312
|
+
if (sansTests) {
|
|
313
|
+
return [...GARDES, TYPAGE, ...controles];
|
|
314
|
+
}
|
|
315
|
+
return [...TACHES, ...controles];
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* The content of the variable of the tests (`GRILLHOUSE_TESTS`) for the tranche <tranche> of a pass
|
|
320
|
+
* in <racine>: the tranche and the directory of its reports, and the moment of the pass, which no
|
|
321
|
+
* cached run holds.
|
|
322
|
+
* @param {{ index: number, count: number }} tranche
|
|
323
|
+
* @param {string} racine
|
|
324
|
+
*/
|
|
325
|
+
export function testsDeLaTranche(tranche, racine) {
|
|
326
|
+
return {
|
|
327
|
+
...testsCibles({ arguments: [], force: true }),
|
|
328
|
+
tranche: `${tranche.index}/${tranche.count}`,
|
|
329
|
+
rapports: path.join(racine, RAPPORTS),
|
|
330
|
+
};
|
|
239
331
|
}
|
|
240
332
|
|
|
241
333
|
function passe({ racine, demandes, env, dire, coeurs }) {
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
|
|
334
|
+
const lu = lireLesDemandes(demandes);
|
|
335
|
+
const { gardesSeules, sansTests, tranche, tout, base, args } = lu;
|
|
336
|
+
// The measure against the last green, or the base given: a pass without tests needs none.
|
|
337
|
+
const m =
|
|
338
|
+
gardesSeules || sansTests
|
|
339
|
+
? null
|
|
340
|
+
: mesure(racine, { tout, base, lot: env[BASE_DU_LOT], dans: env.TMPDIR });
|
|
245
341
|
if (m) {
|
|
246
342
|
dire(m.ligne);
|
|
247
343
|
}
|
|
248
344
|
const taches = new Set();
|
|
249
345
|
try {
|
|
346
|
+
// A tranche writes its reports anew.
|
|
347
|
+
if (tranche) {
|
|
348
|
+
for (const f of fichiersDeLaTranche(path.join(racine, RAPPORTS), tranche)) {
|
|
349
|
+
rmSync(f, { force: true });
|
|
350
|
+
}
|
|
351
|
+
}
|
|
250
352
|
const code = jouerLaPasse({
|
|
251
353
|
racine,
|
|
252
|
-
|
|
354
|
+
demandes: lu,
|
|
253
355
|
args,
|
|
254
356
|
tout,
|
|
255
357
|
ajouts: m?.env ?? {},
|
|
@@ -262,36 +364,43 @@ function passe({ racine, demandes, env, dire, coeurs }) {
|
|
|
262
364
|
writeFileSync(env[ROUGES], [...taches].map(t => `${t}\t${rejeu(t)}\n`).join(''));
|
|
263
365
|
}
|
|
264
366
|
// A pass green on every package keeps its tree as the last green.
|
|
265
|
-
poserLeVert({
|
|
367
|
+
poserLeVert({
|
|
368
|
+
code,
|
|
369
|
+
etat: m?.etat,
|
|
370
|
+
args,
|
|
371
|
+
env,
|
|
372
|
+
garder: garderLeVert,
|
|
373
|
+
partielle: Boolean(tranche) || sansTests,
|
|
374
|
+
});
|
|
266
375
|
return code;
|
|
267
376
|
} finally {
|
|
268
377
|
m?.retirer();
|
|
269
378
|
}
|
|
270
379
|
}
|
|
271
380
|
|
|
272
|
-
function jouerLaPasse({ racine,
|
|
273
|
-
const {
|
|
381
|
+
function jouerLaPasse({ racine, demandes, args, tout, ajouts, env, dire, coeurs, taches }) {
|
|
382
|
+
const { gardesSeules, sansTests, tranche } = demandes;
|
|
383
|
+
const { [TESTS_CIBLES]: _, [CHANGEMENTS]: __, [BASE_DU_LOT]: ___, ...propre } = env;
|
|
274
384
|
// The environment of the run: measured against the last green; the moment of a complete pass,
|
|
275
|
-
// which moves the hash of every task of tests, so that each plays for real.
|
|
276
|
-
const
|
|
277
|
-
?
|
|
278
|
-
:
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
};
|
|
385
|
+
// which moves the hash of every task of tests, so that each plays for real; a tranche, with it.
|
|
386
|
+
const cibles = tranche
|
|
387
|
+
? testsDeLaTranche(tranche, racine)
|
|
388
|
+
: tout
|
|
389
|
+
? testsCibles({ arguments: [], force: true })
|
|
390
|
+
: undefined;
|
|
391
|
+
const e =
|
|
392
|
+
gardesSeules || sansTests
|
|
393
|
+
? propre
|
|
394
|
+
: { ...propre, ...ajouts, ...(cibles ? { [TESTS_CIBLES]: JSON.stringify(cibles) } : {}) };
|
|
285
395
|
const borne = args.some(a => CONCURRENCE.test(a)) ? [] : [`--concurrency=${concurrence(coeurs)}`];
|
|
286
396
|
const a = [
|
|
287
|
-
...(
|
|
288
|
-
...controlesDuDepot(racine),
|
|
397
|
+
...tachesDeLaPasse(demandes, controlesDuDepot(racine)),
|
|
289
398
|
'--continue=dependencies-successful',
|
|
290
399
|
...borne,
|
|
291
400
|
...args,
|
|
292
401
|
];
|
|
293
402
|
// The plan of the run, before it: the progress knows all its tasks.
|
|
294
|
-
if (!gardesSeules && depotAvecTests(racine)) {
|
|
403
|
+
if (!gardesSeules && !sansTests && depotAvecTests(racine)) {
|
|
295
404
|
planifier(env[AVANCEMENT], { racine, args: a, env: e });
|
|
296
405
|
}
|
|
297
406
|
// The run of Turborepo, and its summary.
|
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
// the files that differ from the tree of the last green instead, which Vitest's git cannot read
|
|
8
8
|
// (a green kept on a copy whose lot is not committed).
|
|
9
9
|
//
|
|
10
|
-
// - The variable `GRILLHOUSE_CHANGEMENTS` names a JSON file, `{ racine, fichiers, supprimes }`:
|
|
11
|
-
// top of the repository, the files changed or added since the last green and the files
|
|
12
|
-
// each path from the top
|
|
10
|
+
// - The variable `GRILLHOUSE_CHANGEMENTS` names a JSON file, `{ racine, fichiers, supprimes, cible }`:
|
|
11
|
+
// the top of the repository, the files changed or added since the last green and the files
|
|
12
|
+
// removed, each path from the top, and, for a pass of the circuit measured against the base of
|
|
13
|
+
// its lot (scripts/dernier-vert.mjs), the mark `cible`. It passes through Turborepo without entering any hash (the root's
|
|
13
14
|
// `globalPassThroughEnv`, which scripts/langages/typescript/turbo-des-paquets.mjs writes and checks): a package whose
|
|
14
15
|
// inputs did not move replays its last green from Turborepo's cache, whatever the last green.
|
|
15
16
|
// The plugin takes it out of the environment once read: no process the tests start receives it.
|
|
@@ -46,7 +47,12 @@
|
|
|
46
47
|
// `.mjs`, `.cjs`, `.ts`, `.mts`, `.cts`, `.jsx`, `.tsx`, `.json`): data, a template, a
|
|
47
48
|
// script of the shell, a document, which a test reads without importing it.
|
|
48
49
|
// Vitest's own `forceRerunTriggers` (a configuration's, or its default) still apply, as with
|
|
49
|
-
// `--changed`.
|
|
50
|
+
// `--changed`. Under the mark `cible`, 5 and 7 do not play the package whole, and no test is
|
|
51
|
+
// related by the paths it reads (`testsQuiLancent`): the tests Vitest relates alone, and the
|
|
52
|
+
// files named, as `vitest --changed` leaves a file out of its graph to the complete pass, the
|
|
53
|
+
// CI's of the ticket's branch and the night's. Witness: grillhouse-4nr.21, whose
|
|
54
|
+
// `scripts/session-start.sh` the reads of 276 of the 282 test files of packages/grillhouse hold
|
|
55
|
+
// (a test that starts the command reads every script of its table).
|
|
50
56
|
// - Otherwise the tests played are those Vitest relates to the files changed or added (`related`,
|
|
51
57
|
// absolute), the tests that read one of them by its path, a script they launch or a file they
|
|
52
58
|
// read, with what it imports and names (`testsQuiLancent`, ./lances.mjs, as Bazel's `data`),
|
|
@@ -87,12 +93,18 @@ const sous = (f, dir) => {
|
|
|
87
93
|
return r === '' || (!r.startsWith('..') && !path.isAbsolute(r));
|
|
88
94
|
};
|
|
89
95
|
|
|
90
|
-
// The changes the file at <chemin> holds, `{ racine, fichiers, supprimes }`; null when it
|
|
91
|
-
// read.
|
|
96
|
+
// The changes the file at <chemin> holds, `{ racine, fichiers, supprimes, cible? }`; null when it
|
|
97
|
+
// does not read.
|
|
92
98
|
export function lireChangements(chemin) {
|
|
93
99
|
const c = lireJson(chemin);
|
|
94
100
|
const liste = l => Array.isArray(l) && l.every(x => typeof x === 'string');
|
|
95
|
-
if (
|
|
101
|
+
if (
|
|
102
|
+
!c ||
|
|
103
|
+
typeof c.racine !== 'string' ||
|
|
104
|
+
!liste(c.fichiers) ||
|
|
105
|
+
!liste(c.supprimes) ||
|
|
106
|
+
(c.cible !== undefined && typeof c.cible !== 'boolean')
|
|
107
|
+
) {
|
|
96
108
|
return null;
|
|
97
109
|
}
|
|
98
110
|
return c;
|
|
@@ -213,11 +225,11 @@ function paquetEntier(ch, dossier, test = {}) {
|
|
|
213
225
|
? 'la configuration du paquet'
|
|
214
226
|
: preparation.includes(a)
|
|
215
227
|
? 'un fichier de préparation des tests'
|
|
216
|
-
: lit.some(l => f === l || f.startsWith(`${l}/`))
|
|
228
|
+
: !ch.cible && lit.some(l => f === l || f.startsWith(`${l}/`))
|
|
217
229
|
? 'un chemin que ses tests déclarent lire (grillhouse.lit)'
|
|
218
230
|
: deps.some(d => sous(a, d) && construit(racine, d, a))
|
|
219
231
|
? 'le code d’un paquet dont il dépend, que ses tests lisent construit'
|
|
220
|
-
: sous(a, dossier) && !MODULE.test(f)
|
|
232
|
+
: !ch.cible && sous(a, dossier) && !MODULE.test(f)
|
|
221
233
|
? 'un fichier qu’aucun module n’importe, qu’un test lit sans l’importer'
|
|
222
234
|
: null;
|
|
223
235
|
if (raison) {
|
|
@@ -238,10 +250,10 @@ export function restreindre(test, dossier, ch, nommes, dire) {
|
|
|
238
250
|
return;
|
|
239
251
|
}
|
|
240
252
|
const changes = ch.fichiers.map(f => path.join(ch.racine, f));
|
|
241
|
-
const lanceurs = testsQuiLancent(dossier, ch.racine, changes);
|
|
253
|
+
const lanceurs = ch.cible ? [] : testsQuiLancent(dossier, ch.racine, changes);
|
|
242
254
|
test.related = [...new Set([...changes, ...nommes, ...lanceurs])];
|
|
243
255
|
test.passWithNoTests = true;
|
|
244
256
|
dire(
|
|
245
|
-
`↳ ${nom} : les tests que Vitest relie aux ${ch.fichiers.length} fichier(s) changé(s) depuis le dernier vert${lanceurs.length ? `, et ${lanceurs.length} test(s) qui en lisent un par son chemin` : ''}.`
|
|
257
|
+
`↳ ${nom} : les tests que Vitest relie aux ${ch.fichiers.length} fichier(s) changé(s) depuis ${ch.cible ? 'la base du lot' : 'le dernier vert'}${lanceurs.length ? `, et ${lanceurs.length} test(s) qui en lisent un par son chemin` : ''}.`
|
|
246
258
|
);
|
|
247
259
|
}
|
|
@@ -38,9 +38,15 @@
|
|
|
38
38
|
// Vitest's `passWithNoTests: false`.
|
|
39
39
|
// - The night's configuration (scripts/langages/typescript/vitest.nuit.config.mjs) plays what the
|
|
40
40
|
// day leaves out, through the plugin `nuit`: the night tests, the benches and the witnesses; the
|
|
41
|
-
// variable `GRILLHOUSE_TESTS_DE_NUIT` (NUIT_VARIABLE) chooses `nuit`, the night tests alone,
|
|
42
|
-
// `
|
|
43
|
-
//
|
|
41
|
+
// variable `GRILLHOUSE_TESTS_DE_NUIT` (NUIT_VARIABLE) chooses `nuit`, the night tests alone,
|
|
42
|
+
// `hors-poste`, the night tests but those that bear the tag `@poste` at their head (the night of
|
|
43
|
+
// a shared machine), or `mesures`, the benches and the witnesses alone, one file at a time
|
|
44
|
+
// (`fileParallelism: false`), as scripts/langages/typescript/tests-de-nuit.mjs plays them; the
|
|
45
|
+
// variable `GRILLHOUSE_TRANCHE_DE_NUIT` (NUIT_TRANCHE) gives the run its tranche, as a tranche of
|
|
46
|
+
// the day (`trancher`, ../tranches.mjs).
|
|
47
|
+
// - A tranche of a pass (`tranche`, `i/n`, and `rapports` in the value, `npm run verifier --
|
|
48
|
+
// --tranche i/n`) plays its part of the files alone, writes its blob report and the files of its
|
|
49
|
+
// part (`trancher`, ../tranches.mjs).
|
|
44
50
|
// - The changes since the last green (`GRILLHOUSE_CHANGEMENTS`, ./changements.mjs) restrict the
|
|
45
51
|
// files played to those Vitest relates to them, the files named themselves kept, or leave every
|
|
46
52
|
// test when a change lies out of Vitest's graph.
|
|
@@ -48,6 +54,7 @@
|
|
|
48
54
|
import { globSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
|
49
55
|
import path from 'node:path';
|
|
50
56
|
import { CHANGEMENTS, TESTS_CIBLES } from '../../../services-du-noyau.mjs';
|
|
57
|
+
import { trancher } from '../tranches.mjs';
|
|
51
58
|
import { lireChangements, restreindre } from './changements.mjs';
|
|
52
59
|
|
|
53
60
|
// The name of the variable is the core's (`TESTS_CIBLES`); this module reads it under its own name.
|
|
@@ -60,6 +67,11 @@ export const BUDGET = '**/*.budget.{test,spec}.?(c|m)[jt]s?(x)';
|
|
|
60
67
|
export const HORS_DU_JOUR = [NUIT, BUDGET];
|
|
61
68
|
/** The variable that chooses the tests of a run of the night's configuration: `nuit` or `mesures`. */
|
|
62
69
|
export const NUIT_VARIABLE = 'GRILLHOUSE_TESTS_DE_NUIT';
|
|
70
|
+
/**
|
|
71
|
+
* The variable that carries the tranche of a run of the night's configuration, JSON: `tranche`,
|
|
72
|
+
* `i/n`, and `rapports`, the directory of its reports (`trancher`, ../tranches.mjs).
|
|
73
|
+
*/
|
|
74
|
+
export const NUIT_TRANCHE = 'GRILLHOUSE_TRANCHE_DE_NUIT';
|
|
63
75
|
// Whether the file at <fichier> bears the name of <motif>, a globstar then a name: by the name of
|
|
64
76
|
// the file, since a globstar passes no directory whose name starts with a dot, and a ticket's copy
|
|
65
77
|
// lives under `.claude/worktrees/`.
|
|
@@ -71,6 +83,28 @@ export const estUnTestDeNuit = fichier => parSonNom(fichier, NUIT);
|
|
|
71
83
|
export const estUnBanc = fichier => parSonNom(fichier, BUDGET);
|
|
72
84
|
/** Whether the file at <fichier> is a night test or a time budget bench, by its name. */
|
|
73
85
|
export const deNuitOuBanc = fichier => HORS_DU_JOUR.some(p => parSonNom(fichier, p));
|
|
86
|
+
// The tag of a night test that depends on the poste (its envelope, its tools, its session): a line
|
|
87
|
+
// `// @poste` of the comment at the head of the file, before its first line of code, its reason
|
|
88
|
+
// after it (`// @poste: l'enveloppe bwrap`), as Bazel's tags (`manual`, `exclusive`) and pytest's
|
|
89
|
+
// markers live with the test.
|
|
90
|
+
const ETIQUETTE_DU_POSTE = /^\/\/\s*@poste\b/;
|
|
91
|
+
/**
|
|
92
|
+
* Whether the text <texte> of a test file bears the tag `@poste` in the comment at its head: the
|
|
93
|
+
* night of a shared machine (`hors-poste`) leaves it out, the night of the poste plays it.
|
|
94
|
+
* @param {string} texte the text of the file
|
|
95
|
+
*/
|
|
96
|
+
export function porteLEtiquetteDuPoste(texte) {
|
|
97
|
+
for (const ligne of texte.split('\n')) {
|
|
98
|
+
const l = ligne.trim();
|
|
99
|
+
if (ETIQUETTE_DU_POSTE.test(l)) {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
if (l !== '' && !l.startsWith('//') && !l.startsWith('#!')) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
74
108
|
// Vitest's default `include` (its configDefaults).
|
|
75
109
|
const INCLUDE = ['**/*.{test,spec}.?(c|m)[jt]s?(x)'];
|
|
76
110
|
// The mark of a time witness: the import of `mesurerAuRepos`, on a line of its own, from the
|
|
@@ -165,7 +199,11 @@ export const ciblage = (env = process.env, dire = l => process.stdout.write(`${l
|
|
|
165
199
|
// The files a targeted run names themselves, absolute.
|
|
166
200
|
let nommes = [];
|
|
167
201
|
if (texte) {
|
|
168
|
-
|
|
202
|
+
const valeur = JSON.parse(texte);
|
|
203
|
+
nommes = await cibler(config, test, valeur, new Set(temoins));
|
|
204
|
+
if (valeur.tranche) {
|
|
205
|
+
await trancher(config, test, valeur);
|
|
206
|
+
}
|
|
169
207
|
}
|
|
170
208
|
// The witnesses out of the day, but those named themselves (in the include then).
|
|
171
209
|
const joues = new Set(Array.isArray(test.include) ? test.include : []);
|
|
@@ -244,26 +282,59 @@ async function cibler(config, test, valeur, temoins) {
|
|
|
244
282
|
return nommes;
|
|
245
283
|
}
|
|
246
284
|
|
|
285
|
+
/**
|
|
286
|
+
* The night tests under <dir> that bear the tag `@poste` (`porteLEtiquetteDuPoste`), node_modules,
|
|
287
|
+
* dist, .git, .turbo and .claude left out; each path relative to <dir>, sorted.
|
|
288
|
+
* @param {string} dir the directory searched
|
|
289
|
+
*/
|
|
290
|
+
export function testsDuPoste(dir) {
|
|
291
|
+
return [
|
|
292
|
+
...new Set(
|
|
293
|
+
globSync([NUIT], { cwd: dir, exclude: d => HORS_TEMOINS.has(path.basename(d)) }).map(f =>
|
|
294
|
+
f.split(path.sep).join('/')
|
|
295
|
+
)
|
|
296
|
+
),
|
|
297
|
+
]
|
|
298
|
+
.filter(f => porteLEtiquetteDuPoste(lireTexte(path.join(dir, f))))
|
|
299
|
+
.sort();
|
|
300
|
+
}
|
|
301
|
+
|
|
247
302
|
/**
|
|
248
303
|
* The plugin of the night's configuration: the night tests, the benches and the time witnesses
|
|
249
|
-
* under its directory, or, as <env> chooses in NUIT_VARIABLE, the night tests alone (`nuit`)
|
|
250
|
-
* the
|
|
304
|
+
* under its directory, or, as <env> chooses in NUIT_VARIABLE, the night tests alone (`nuit`), the
|
|
305
|
+
* night tests but those tagged `@poste` (`hors-poste`, the night of a shared machine: a CI), or the
|
|
306
|
+
* measures alone, one file at a time (`mesures`), the benches and the witnesses; with
|
|
307
|
+
* NUIT_TRANCHE, the tranche it carries of these files.
|
|
251
308
|
* @param {NodeJS.ProcessEnv} [env] the environment that holds the choice
|
|
252
309
|
*/
|
|
253
310
|
export const nuit = (env = process.env) => ({
|
|
254
311
|
name: 'grillhouse:nuit',
|
|
255
|
-
config(config) {
|
|
312
|
+
async config(config) {
|
|
256
313
|
const choix = env[NUIT_VARIABLE];
|
|
314
|
+
const tranche = env[NUIT_TRANCHE];
|
|
257
315
|
delete env[NUIT_VARIABLE];
|
|
316
|
+
delete env[NUIT_TRANCHE];
|
|
258
317
|
const test = (config.test ??= {});
|
|
259
318
|
const temoins = temoinsDe(config, { ...test, include: INCLUDE });
|
|
260
319
|
if (choix === 'nuit') {
|
|
261
320
|
test.include = [NUIT];
|
|
321
|
+
} else if (choix === 'hors-poste') {
|
|
322
|
+
test.include = [NUIT];
|
|
323
|
+
const duPoste = testsDuPoste(path.resolve(config.root ?? process.cwd(), test.dir ?? ''));
|
|
324
|
+
if (duPoste.length) {
|
|
325
|
+
test.exclude = [
|
|
326
|
+
...(test.exclude ?? ['**/node_modules/**']),
|
|
327
|
+
...duPoste.map(r => r.replace(SPECIAUX, '\\$&')),
|
|
328
|
+
];
|
|
329
|
+
}
|
|
262
330
|
} else if (choix === 'mesures') {
|
|
263
331
|
test.include = [BUDGET, ...temoins];
|
|
264
332
|
test.fileParallelism = false;
|
|
265
333
|
} else {
|
|
266
334
|
test.include = [...HORS_DU_JOUR, ...temoins];
|
|
267
335
|
}
|
|
336
|
+
if (tranche) {
|
|
337
|
+
await trancher(config, test, JSON.parse(tranche));
|
|
338
|
+
}
|
|
268
339
|
},
|
|
269
340
|
});
|
|
@@ -167,7 +167,7 @@ function sansCommentaires(texte) {
|
|
|
167
167
|
|
|
168
168
|
// The code of <texte>: without its comments, whose words name no path read, nor its imports, whose
|
|
169
169
|
// strings are in Vitest's graph.
|
|
170
|
-
const code = texte => sansCommentaires(texte).replace(IMPORT, '');
|
|
170
|
+
export const code = texte => sansCommentaires(texte).replace(IMPORT, '');
|
|
171
171
|
|
|
172
172
|
// The strings of the code <texte> (without its comments), read character by character: a quoted
|
|
173
173
|
// string, or a template without a substitution, each once.
|
|
@@ -193,9 +193,9 @@ function chainesDe(texte) {
|
|
|
193
193
|
return out;
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
function chaines(texte) {
|
|
196
|
+
/** The strings of the code <texte>, then the strings of each call of `join` or `resolve` written
|
|
197
|
+
* together, each once. */
|
|
198
|
+
export function chaines(texte) {
|
|
199
199
|
const jointes = [...texte.matchAll(APPEL)]
|
|
200
200
|
.map(a => chainesDe(a[1]).filter(Boolean))
|
|
201
201
|
.filter(l => l.length > 1)
|
|
@@ -27,3 +27,12 @@ process.env.GRILLHOUSE_MESURE_D_ESSAI ||= JSON.stringify({
|
|
|
27
27
|
});
|
|
28
28
|
process.env.GRILLHOUSE_TEMPORAIRE_LIBRE ||= '0';
|
|
29
29
|
process.env.GRILLHOUSE_COPIE_LIBRE ||= '0';
|
|
30
|
+
// The cache of a test's Turborepo is local alone: the remote cache of the CI or of the poste
|
|
31
|
+
// (scripts/fichier-du-poste.mjs) would serve a repository of trial the tasks another test or run
|
|
32
|
+
// wrote there. `TURBO_CACHE` says local alone; `TURBO_TOKEN`, named empty, keeps the file of the
|
|
33
|
+
// poste unread (`avecLeFichierDuPoste` leaves an environment that names one of its variables).
|
|
34
|
+
for (const nom of ['TURBO_API', 'TURBO_TEAM', 'TURBO_TEAMID', 'TURBO_REMOTE_CACHE_SIGNATURE_KEY']) {
|
|
35
|
+
delete process.env[nom];
|
|
36
|
+
}
|
|
37
|
+
process.env.TURBO_TOKEN = '';
|
|
38
|
+
process.env.TURBO_CACHE = 'local:rw';
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
// its copy (`vitest run --root <copy> --config <this file>`), after a green full pass (`npm run
|
|
9
9
|
// verifier -- --force`) and before the project's night script: its include names the night tests
|
|
10
10
|
// and the benches, and its plugin adds the witnesses under the root, or chooses the night tests
|
|
11
|
-
// alone
|
|
12
|
-
//
|
|
11
|
+
// alone, the night tests but those tagged `@poste` (the night of a shared machine, a CI), or the
|
|
12
|
+
// measures alone, one file at a time (`nuit` of ./vitest-config/cibles.mjs, the variable
|
|
13
|
+
// GRILLHOUSE_TESTS_DE_NUIT). It reads no day configuration of the project, whether the
|
|
13
14
|
// project has one at its root or one per package; it takes from the base configuration the common
|
|
14
15
|
// environment (git's settings) and the measure of time: the setup file that notes the CPU pressure
|
|
15
16
|
// of each test and the duration reporter, which gives 75, « à repasser », to a measure that fails
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { spawnSync } from 'node:child_process';
|
|
7
7
|
import path from 'node:path';
|
|
8
8
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
9
|
-
import { trancher } from './dette.mjs';
|
|
9
|
+
import { MODE, trancher } from './dette.mjs';
|
|
10
10
|
|
|
11
11
|
const DOSSIER = 'packages/grillhouse/scripts';
|
|
12
12
|
// The executable of ESLint in the repository's node_modules, from this file (packages/grillhouse/scripts).
|
|
@@ -43,16 +43,33 @@ export async function verifier(racine) {
|
|
|
43
43
|
return constats;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
// The report of the check at <racine>: `lignes`, what the command writes on stderr (each refusal
|
|
47
|
+
// prefixed with `⛔`, then the debt's lines), and `code`, its exit code (1 on a refusal). The
|
|
48
|
+
// functional core of the command: it runs ESLint and reads the project's debt, and writes nothing to
|
|
49
|
+
// the standard streams; the command below is its shell. The refusals reach SARIF through `trancher`
|
|
50
|
+
// under the results directory <env> names (scripts/resultats.mjs); without it none is written, and
|
|
51
|
+
// the debt's mode is <env>'s `GRILLHOUSE_DETTE`.
|
|
52
|
+
export async function rapport(racine, env = process.env) {
|
|
53
|
+
const { refus, lignes } = trancher(
|
|
54
|
+
racine,
|
|
55
|
+
'lint-des-scripts',
|
|
56
|
+
await verifier(racine),
|
|
57
|
+
env[MODE] || undefined,
|
|
58
|
+
env
|
|
59
|
+
);
|
|
60
|
+
return {
|
|
61
|
+
lignes: [...refus.map(r => `⛔ ${r.message}`), ...lignes],
|
|
62
|
+
code: refus.length ? 1 : 0,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
46
66
|
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
47
67
|
// The root of the repository: the first argument (the script `lint` of the package passes it),
|
|
48
68
|
// the working directory otherwise.
|
|
49
69
|
const racine = path.resolve(process.argv[2] ?? process.cwd());
|
|
50
|
-
const {
|
|
51
|
-
for (const r of refus) {
|
|
52
|
-
process.stderr.write(`⛔ ${r.message}\n`);
|
|
53
|
-
}
|
|
70
|
+
const { lignes, code } = await rapport(racine);
|
|
54
71
|
for (const l of lignes) {
|
|
55
72
|
process.stderr.write(`${l}\n`);
|
|
56
73
|
}
|
|
57
|
-
process.exitCode =
|
|
74
|
+
process.exitCode = code;
|
|
58
75
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// From 0.33.0 the remote cache of Turborepo is shared between the CI and the poste
|
|
2
|
+
// (grillhouse-44b.12.6): the template's CI takes its server from the repository's variables and
|
|
3
|
+
// secrets, and the commands of the frame on the poste read it from
|
|
4
|
+
// ~/.config/grillhouse/turbo-cache.env, read alone (scripts/fichier-du-poste.mjs).
|
|
5
|
+
//
|
|
6
|
+
// - The migration changes no file: without a server, the CI and the poste keep their local cache,
|
|
7
|
+
// and a marked workflow of the frame reaches the project by the update.
|
|
8
|
+
// - What stays to the project (`restes`), once: a project whose root's turbo.json does not sign
|
|
9
|
+
// the artifacts (`remoteCache.signature`) is told how to plug a server. One that signs them has
|
|
10
|
+
// plugged it already.
|
|
11
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
|
|
14
|
+
export const version = '0.33.0';
|
|
15
|
+
export const nom = 'cache distant';
|
|
16
|
+
|
|
17
|
+
/** Changes nothing: plugging a server is the project's gesture (`restes`). */
|
|
18
|
+
export function migrer() {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Whether the root's turbo.json (or turbo.jsonc) of <projet> signs the artifacts of its remote cache.
|
|
23
|
+
const signe = projet =>
|
|
24
|
+
['turbo.json', 'turbo.jsonc']
|
|
25
|
+
.map(f => path.join(projet, f))
|
|
26
|
+
.some(f => existsSync(f) && /"signature"\s*:\s*true/.test(readFileSync(f, 'utf8')));
|
|
27
|
+
|
|
28
|
+
/** How to plug a server of remote cache, for a project whose turbo.json does not sign. */
|
|
29
|
+
export function restes(projet) {
|
|
30
|
+
if (signe(projet)) {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
return [
|
|
34
|
+
'turbo.json : le cache distant de Turborepo se partage entre la CI et le poste, s\'il y a un serveur (facultatif ; sans lui rien ne change). Pour le brancher : les variables TURBO_API et TURBO_TEAM et les secrets TURBO_TOKEN et TURBO_REMOTE_CACHE_SIGNATURE_KEY du dépôt sur GitHub (la CI du cadre les lit : un push vers main ou agent/** écrit, tout autre run lit), `"remoteCache": { "signature": true }` dans le turbo.json racine, et, sur le poste, les quatre mêmes variables dans ~/.config/grillhouse/turbo-cache.env (droits 600), que chaque projet du poste lit seul, sans jamais écrire.',
|
|
35
|
+
];
|
|
36
|
+
}
|