@roomi-fields/grillhouse 0.25.5 → 0.26.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/agents/testwriter.md +1 -1
- package/bin/grillhouse.mjs +20 -3
- package/cadre/templates/cargo/package.json +3 -0
- package/cadre/templates/projet/.gitattributes +1 -0
- package/cadre/templates/projet/CLAUDE.md +6 -0
- package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
- package/charte.md +10 -1
- package/docs/ARCHITECTURE.md +91 -26
- package/docs/INTERFACE.md +16 -4
- package/hooks/register.tsx +57 -16
- package/package.json +9 -3
- package/scripts/circuit.mjs +121 -19
- package/scripts/copies-finies.mjs +167 -28
- package/scripts/crochets.mjs +9 -3
- package/scripts/enveloppe/enveloppe.mjs +59 -17
- package/scripts/enveloppe/lancer.sh +15 -22
- package/scripts/enveloppe/travail-de-la-copie.mjs +188 -0
- package/scripts/etapes.mjs +1 -1
- package/scripts/fusion-du-changelog.mjs +120 -0
- package/scripts/grillhouse-maj.mjs +19 -0
- package/scripts/integration/file.mjs +196 -104
- package/scripts/jointure.d.ts +22 -1
- package/scripts/langages/cargo/binaires.json +2 -1
- package/scripts/langages/cargo/clippy.mjs +10 -2
- package/scripts/langages/cargo/commandes.mjs +19 -4
- package/scripts/langages/cargo/composants.mjs +229 -8
- package/scripts/langages/cargo/index.mjs +17 -8
- package/scripts/langages/cargo/sccache.mjs +143 -0
- package/scripts/langages/cargo/verdict.mjs +50 -10
- package/scripts/langages/typescript/index.mjs +4 -2
- package/scripts/langages/typescript/regle-des-tests.mjs +37 -0
- package/scripts/nuit.sh +15 -1
- package/scripts/outils-cles.mjs +188 -0
- package/scripts/resultats.mjs +22 -6
- package/scripts/sous-commandes.mjs +16 -0
- package/scripts/verrou-de-machine.mjs +14 -13
- package/scripts/verrous/verrou.mjs +50 -14
- package/skills/developpeur/SKILL.md +4 -0
- package/skills/explorateur/SKILL.md +3 -1
- package/skills/pitmaster/SKILL.md +6 -2
- package/skills/pitmaster/references/consigne-agent.md +3 -3
- package/skills/relecteur/SKILL.md +6 -2
- package/skills/testwriter/SKILL.md +23 -6
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
// circuit of a ticket (scripts/circuit.mjs), once it has put the ticket's branch in the queue, and
|
|
5
5
|
// by the supervisor by hand.
|
|
6
6
|
//
|
|
7
|
-
// npx grillhouse file
|
|
7
|
+
// npx grillhouse file [--ci <ticket>]
|
|
8
8
|
//
|
|
9
|
-
// No argument (exit 2 and the usage otherwise). It takes the branches waiting one by one until none is
|
|
9
|
+
// No argument, or `--ci <ticket>` (below; exit 2 and the usage otherwise). It takes the branches waiting one by one until none is
|
|
10
10
|
// left, then exits 0, whatever became of each branch. A queue launched while another runs exits 0 at
|
|
11
11
|
// once, refusing nothing: the running queue takes the branch that arrived (it reads the entries
|
|
12
12
|
// again before it lets go of its lock, `.git/file-integration.lock`).
|
|
@@ -58,7 +58,16 @@
|
|
|
58
58
|
// `npm run verifier` play out of it. A red CI reopens the ticket (`bd reopen`), its comment giving the
|
|
59
59
|
// address of the run (`gh run view <id> --json url`) and the end of `gh run view <id>
|
|
60
60
|
// --log-failed`. Without `gh`, without a run found, with `gh` refusing or past the 30 min, the
|
|
61
|
-
// ticket is told that the CI was not read, and why, and stays closed.
|
|
61
|
+
// ticket is told that the CI was not read, and why, and stays closed. The run is read at its current
|
|
62
|
+
// attempt (`gh run view <id>` without `--attempt`), as a merge queue judges the last attempt of a
|
|
63
|
+
// commit's checks.
|
|
64
|
+
// `--ci <ticket>` reads again the CI of a ticket a red CI reopened, which the circuit runs at 5.2
|
|
65
|
+
// on `--reprendre` (scripts/circuit.mjs, `argumentsDeLaFile`), once the supervisor had the failed
|
|
66
|
+
// jobs run again (`gh run rerun <id> --failed`): the commit of main that delivers the ticket, its
|
|
67
|
+
// CI read as above (`relireCI`); green, the ticket closes « intégré : <commit> », the run named at
|
|
68
|
+
// it; red or not read, it stays open, the reading at the ticket. A flaky test has no path of its
|
|
69
|
+
// own: the red comment gives the charter's rule, a test known red goes into quarantine in the test
|
|
70
|
+
// itself, with the ticket that fixes it. It takes no lock: it does not move main.
|
|
62
71
|
// Every comment and change of the queue at a ticket is written under the author `file`, which bd
|
|
63
72
|
// reads in BEADS_ACTOR, as the circuit writes its own lines under `circuit`.
|
|
64
73
|
import { spawnSync } from 'node:child_process';
|
|
@@ -67,6 +76,7 @@ import { createRequire } from 'node:module';
|
|
|
67
76
|
import path from 'node:path';
|
|
68
77
|
import { pathToFileURL } from 'node:url';
|
|
69
78
|
import { lireCommit } from '../poussee-cles.mjs';
|
|
79
|
+
import { commitsDelivering, gitLog } from '../un-commit-par-ticket.mjs';
|
|
70
80
|
import { attendreUnPeu, lacherVerrou, prendreVerrou } from '../verrou-de-fichier.mjs';
|
|
71
81
|
import { dossierCommun, lireEntrees, retirerEntree } from './file-attente.mjs';
|
|
72
82
|
import { ouvrirCopie } from './rejeu.mjs';
|
|
@@ -193,9 +203,185 @@ export function fluxDeLaBranche(fichiers, branche) {
|
|
|
193
203
|
.map(({ chemin }) => chemin);
|
|
194
204
|
}
|
|
195
205
|
|
|
206
|
+
// The verdicts of a reading of the CI (`lireCI`).
|
|
207
|
+
const VERTE = 'verte';
|
|
208
|
+
const ROUGE = 'rouge';
|
|
209
|
+
const SANS_CI = 'sans-ci';
|
|
210
|
+
const NON_LUE = 'non-lue';
|
|
211
|
+
|
|
212
|
+
// The workflows of the commit <sha> of the repository <racine> that run on a push to <branche>:
|
|
213
|
+
// their paths.
|
|
214
|
+
function fluxDuCommit(racine, sha, branche) {
|
|
215
|
+
const git = (...a) => spawnSync('git', ['-C', racine, ...a], { encoding: 'utf8' });
|
|
216
|
+
const l = git('ls-tree', '--name-only', `${sha}:${DOSSIER_DES_FLUX}`);
|
|
217
|
+
const noms = l.status === 0 ? l.stdout.split('\n').filter(n => EXTENSIONS_DES_FLUX.test(n)) : [];
|
|
218
|
+
const fichiers = noms.map(n => {
|
|
219
|
+
const chemin = `${DOSSIER_DES_FLUX}/${n}`;
|
|
220
|
+
const f = git('show', `${sha}:${chemin}`);
|
|
221
|
+
return { chemin, texte: f.status === 0 ? f.stdout : null };
|
|
222
|
+
});
|
|
223
|
+
return fluxDeLaBranche(fichiers, branche);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// The GitHub CLI run in the main tree <racine>.
|
|
227
|
+
const ghDans =
|
|
228
|
+
racine =>
|
|
229
|
+
(args, options = {}) =>
|
|
230
|
+
spawnSync('gh', args, {
|
|
231
|
+
cwd: racine,
|
|
232
|
+
encoding: 'utf8',
|
|
233
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
234
|
+
...options,
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
// The CI of the commit <sha> pushed to <branche>, for the ticket <ticket>, read with the tools <o>
|
|
238
|
+
// (`{ racine, principale, bd, gh, dire, avancement }`: the main tree, its branch, bd, the GitHub
|
|
239
|
+
// CLI, a line of the output, the progress directory or null): `{ verdict, passage }`, the verdict
|
|
240
|
+
// VERTE, ROUGE, SANS_CI or NON_LUE, and the id of the run read. The run is read by `gh run view
|
|
241
|
+
// <id>`, which gives its current attempt: a run whose failed jobs were run again
|
|
242
|
+
// (`gh run rerun <id> --failed`) is judged on that attempt, as a merge queue judges the last
|
|
243
|
+
// attempt of a commit's checks. No CI, red or not read, the ticket is told so; green, nothing is
|
|
244
|
+
// written to it.
|
|
245
|
+
function lireCI(o, ticket, sha, branche) {
|
|
246
|
+
const court = sha.slice(0, 7);
|
|
247
|
+
const commenter = texte => o.bd('comments', 'add', ticket, texte);
|
|
248
|
+
if (fluxDuCommit(o.racine, sha, branche).length === 0) {
|
|
249
|
+
const texte = `Aucune CI pour origin/${branche} : aucun flux de ${DOSSIER_DES_FLUX} de ${court} ne se lance sur la branche ${branche}, la file n'en attend pas.`;
|
|
250
|
+
commenter(texte);
|
|
251
|
+
o.dire(`✓ ${texte}`);
|
|
252
|
+
return { verdict: SANS_CI, passage: null };
|
|
253
|
+
}
|
|
254
|
+
const { gh } = o;
|
|
255
|
+
const nonLue = raison => {
|
|
256
|
+
commenter(`## CI non lue\n\nLa CI de ${court} n'a pas été lue : ${raison}`);
|
|
257
|
+
o.dire(`⚠ CI de ${court} non lue : ${raison}`);
|
|
258
|
+
return { verdict: NON_LUE, passage: null };
|
|
259
|
+
};
|
|
260
|
+
const recherche = delai('GRILLHOUSE_CI_RECHERCHE_MS', RECHERCHE_CI_MS);
|
|
261
|
+
const debut = Date.now();
|
|
262
|
+
let passage = null;
|
|
263
|
+
for (;;) {
|
|
264
|
+
const r = gh(['run', 'list', '--commit', sha, '--json', 'databaseId,status,conclusion']);
|
|
265
|
+
if (r.error) return nonLue(`gh ne se lance pas (${r.error.code ?? r.error.message}).`);
|
|
266
|
+
if (r.status !== 0) return nonLue(`gh run list refuse :\n${`${r.stderr}${r.stdout}`.trim()}`);
|
|
267
|
+
let passages = [];
|
|
268
|
+
try {
|
|
269
|
+
passages = JSON.parse(r.stdout || '[]');
|
|
270
|
+
} catch {
|
|
271
|
+
return nonLue(`gh run list rend une sortie illisible :\n${r.stdout.trim()}`);
|
|
272
|
+
}
|
|
273
|
+
passage = passages.find(x => x?.databaseId);
|
|
274
|
+
const reste = recherche - (Date.now() - debut);
|
|
275
|
+
if (passage || reste <= 0) break;
|
|
276
|
+
attendreUnPeu(Math.min(10_000, reste));
|
|
277
|
+
}
|
|
278
|
+
if (!passage) {
|
|
279
|
+
return nonLue(`aucun passage de la CI pour ce commit en ${Math.round(recherche / 1000)} s.`);
|
|
280
|
+
}
|
|
281
|
+
const id = String(passage.databaseId);
|
|
282
|
+
const attente = delai('GRILLHOUSE_CI_ATTENTE_MS', ATTENTE_CI_MS);
|
|
283
|
+
const pas = delai('GRILLHOUSE_CI_PAS_MS', PAS_CI_MS);
|
|
284
|
+
const limite = Date.now() + attente;
|
|
285
|
+
let vue = null;
|
|
286
|
+
for (;;) {
|
|
287
|
+
const v = gh(['run', 'view', id, '--json', 'status,conclusion,jobs'], {
|
|
288
|
+
timeout: 60_000,
|
|
289
|
+
killSignal: 'SIGKILL',
|
|
290
|
+
});
|
|
291
|
+
if (v.error) return nonLue(`gh ne se lance pas (${v.error.code ?? v.error.message}).`);
|
|
292
|
+
if (v.status !== 0) return nonLue(`gh run view refuse :\n${`${v.stderr}${v.stdout}`.trim()}`);
|
|
293
|
+
try {
|
|
294
|
+
vue = JSON.parse(v.stdout || '{}');
|
|
295
|
+
} catch {
|
|
296
|
+
return nonLue(`gh run view rend une sortie illisible :\n${v.stdout.trim()}`);
|
|
297
|
+
}
|
|
298
|
+
ecrireLesEtapes(o.avancement, vue);
|
|
299
|
+
if (vue?.status === 'completed') break;
|
|
300
|
+
const reste = limite - Date.now();
|
|
301
|
+
if (reste <= 0) {
|
|
302
|
+
return nonLue(`le passage ${id} n'a pas fini en ${Math.round(attente / 60_000)} min.`);
|
|
303
|
+
}
|
|
304
|
+
attendreUnPeu(Math.min(pas, reste));
|
|
305
|
+
}
|
|
306
|
+
if (vue.conclusion === 'success') {
|
|
307
|
+
o.dire(`✓ CI de ${court} verte (passage ${id})`);
|
|
308
|
+
return { verdict: VERTE, passage: id };
|
|
309
|
+
}
|
|
310
|
+
const url = gh(['run', 'view', id, '--json', 'url', '--jq', '.url']).stdout?.trim() || id;
|
|
311
|
+
const journal = `${gh(['run', 'view', id, '--log-failed']).stdout ?? ''}`
|
|
312
|
+
.trim()
|
|
313
|
+
.split('\n')
|
|
314
|
+
.slice(-60)
|
|
315
|
+
.join('\n');
|
|
316
|
+
commenter(
|
|
317
|
+
`## CI rouge\n\nLa CI de ${court} sur ${o.principale} est rouge : ${url}\n\nLa fin de gh run view ${id} --log-failed :\n\n${journal}\n\nLe ticket est rouvert : sa correction entre sous son numéro. Un rejeu vert de la même CI (\`gh run rerun ${id} --failed\`), puis \`--reprendre\` du circuit, le ferme ; un test connu instable se met en quarantaine dans le test, avec le ticket qui le corrige.`
|
|
318
|
+
);
|
|
319
|
+
o.dire(`✗ CI de ${court} rouge (passage ${id}) : ${ticket} rouvert`);
|
|
320
|
+
return { verdict: ROUGE, passage: id };
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* The CI of the ticket's commit on main read again, with the tools <o> (`{ racine, principale,
|
|
325
|
+
* ticket, bd, gh, dire, avancement }`, as `lireCI`), for a ticket a red CI reopened: as a merge
|
|
326
|
+
* queue judges the last attempt of a commit's checks, a run whose failed jobs were run again green
|
|
327
|
+
* is green. The commit is the last of main that delivers the ticket (its title line names it,
|
|
328
|
+
* `commitsDelivering` of ../un-commit-par-ticket.mjs, the prefix read from bd); green, or no CI
|
|
329
|
+
* for the branch pushed to, the ticket closes as an entry closes it (« intégré : <commit> »), its
|
|
330
|
+
* run named at the ticket; red or not read, it stays open, the reading at the ticket. No commit of
|
|
331
|
+
* main delivering it, or its branch `agent/<ticket>` still ahead of main (a lot not yet on main),
|
|
332
|
+
* the ticket is told that the CI is not read again. Exit 0.
|
|
333
|
+
*/
|
|
334
|
+
export function relireCI(o) {
|
|
335
|
+
const { racine, principale, ticket } = o;
|
|
336
|
+
const git = (...a) => spawnSync('git', ['-C', racine, ...a], { encoding: 'utf8' });
|
|
337
|
+
const nonRelue = raison => {
|
|
338
|
+
o.bd('comments', 'add', ticket, `## CI non relue\n\n${raison}`);
|
|
339
|
+
o.dire(`⚠ CI non relue : ${raison}`);
|
|
340
|
+
return 0;
|
|
341
|
+
};
|
|
342
|
+
const refPrincipale = `refs/heads/${principale}`;
|
|
343
|
+
const branche = `agent/${ticket}`;
|
|
344
|
+
const enAvance = git('rev-list', '--count', `${refPrincipale}..refs/heads/${branche}`);
|
|
345
|
+
if (enAvance.status === 0 && Number(enAvance.stdout.trim()) > 0) {
|
|
346
|
+
return nonRelue(
|
|
347
|
+
`La branche ${branche} a des commits hors de ${principale} : son lot n'est pas sur ${principale}, la file n'en relit pas la CI.`
|
|
348
|
+
);
|
|
349
|
+
}
|
|
350
|
+
const prefixe = o.bd('config', 'get', 'issue_prefix').stdout?.trim() ?? '';
|
|
351
|
+
const sha = commitsDelivering(ticket, prefixe, gitLog(racine))
|
|
352
|
+
.map(c => git('rev-parse', '--verify', '-q', `${c}^{commit}`).stdout.trim())
|
|
353
|
+
.find(c => c && git('merge-base', '--is-ancestor', c, refPrincipale).status === 0);
|
|
354
|
+
if (!sha) {
|
|
355
|
+
return nonRelue(
|
|
356
|
+
`Aucun commit de ${principale} ne livre ${ticket} : la file n'a pas de CI à relire.`
|
|
357
|
+
);
|
|
358
|
+
}
|
|
359
|
+
const court = sha.slice(0, 7);
|
|
360
|
+
const paquet = git('show', `${refPrincipale}:package.json`);
|
|
361
|
+
const { commit, faute } = lireCommit(paquet.status === 0 ? JSON.parse(paquet.stdout) : null);
|
|
362
|
+
if (faute) {
|
|
363
|
+
return nonRelue(`grillhouse.poussee.commit vaut ${faute}, pas un nom de branche.`);
|
|
364
|
+
}
|
|
365
|
+
const ci = lireCI(o, ticket, sha, commit);
|
|
366
|
+
if (ci.verdict === VERTE || ci.verdict === SANS_CI) {
|
|
367
|
+
o.bd('close', ticket, '--reason', `${INTEGRE}${court}`);
|
|
368
|
+
if (ci.passage) {
|
|
369
|
+
o.bd(
|
|
370
|
+
'comments',
|
|
371
|
+
'add',
|
|
372
|
+
ticket,
|
|
373
|
+
`## CI relue\n\nLa CI de ${court} sur ${principale} est verte au dernier essai du passage ${ci.passage} : le ticket se ferme.`
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
o.dire(`✓ ${ticket} fermé : ${court} est sur ${principale}`);
|
|
377
|
+
}
|
|
378
|
+
return 0;
|
|
379
|
+
}
|
|
380
|
+
|
|
196
381
|
function main(argv) {
|
|
197
|
-
|
|
198
|
-
|
|
382
|
+
const relecture = argv.length === 2 && argv[0] === '--ci' && argv[1] ? argv[1] : null;
|
|
383
|
+
if (argv.length && !relecture) {
|
|
384
|
+
process.stderr.write('usage: file.mjs [--ci <ticket>]\n');
|
|
199
385
|
return 2;
|
|
200
386
|
}
|
|
201
387
|
// The progress directory of the circuit's step (scripts/avancement.mjs), where the queue writes
|
|
@@ -227,6 +413,9 @@ function main(argv) {
|
|
|
227
413
|
process.stderr.write("⛔ L'arbre principal n'est pas sur une branche.\n");
|
|
228
414
|
return 1;
|
|
229
415
|
}
|
|
416
|
+
// The tools of the reading of the CI, the queue's and its reading again.
|
|
417
|
+
const lecture = { racine, principale, bd, gh: ghDans(racine), dire, avancement };
|
|
418
|
+
if (relecture) return relireCI({ ...lecture, ticket: relecture });
|
|
230
419
|
const refPrincipale = `refs/heads/${principale}`;
|
|
231
420
|
const copie = path.join(racine, '.claude', 'worktrees', 'file');
|
|
232
421
|
const verrou = path.join(dossierCommun(racine), 'file-integration.lock');
|
|
@@ -342,108 +531,11 @@ function main(argv) {
|
|
|
342
531
|
dire(`⚠ poussée de ${court} refusée`);
|
|
343
532
|
} else {
|
|
344
533
|
dire(`✓ poussée : ${court} est sur origin/${commit}`);
|
|
345
|
-
lireCI(entree, nouveau, commit);
|
|
534
|
+
const ci = lireCI(lecture, entree.ticket, nouveau, commit);
|
|
535
|
+
if (ci.verdict === ROUGE) bd('reopen', entree.ticket);
|
|
346
536
|
}
|
|
347
537
|
};
|
|
348
538
|
|
|
349
|
-
// The workflows of the commit <sha> that run on a push to <branche>: their paths.
|
|
350
|
-
const fluxDuCommit = (sha, branche) => {
|
|
351
|
-
const l = git('ls-tree', '--name-only', `${sha}:${DOSSIER_DES_FLUX}`);
|
|
352
|
-
const noms =
|
|
353
|
-
l.status === 0 ? l.stdout.split('\n').filter(n => EXTENSIONS_DES_FLUX.test(n)) : [];
|
|
354
|
-
const fichiers = noms.map(n => {
|
|
355
|
-
const chemin = `${DOSSIER_DES_FLUX}/${n}`;
|
|
356
|
-
const f = git('show', `${sha}:${chemin}`);
|
|
357
|
-
return { chemin, texte: f.status === 0 ? f.stdout : null };
|
|
358
|
-
});
|
|
359
|
-
return fluxDeLaBranche(fichiers, branche);
|
|
360
|
-
};
|
|
361
|
-
|
|
362
|
-
// The CI of the commit <sha> pushed to <branche>: none, the ticket is told so in one line; green,
|
|
363
|
-
// the ticket stays closed; red, it reopens; not read, the ticket is told why.
|
|
364
|
-
const lireCI = (entree, sha, branche) => {
|
|
365
|
-
const court = sha.slice(0, 7);
|
|
366
|
-
if (fluxDuCommit(sha, branche).length === 0) {
|
|
367
|
-
const texte = `Aucune CI pour origin/${branche} : aucun flux de ${DOSSIER_DES_FLUX} de ${court} ne se lance sur la branche ${branche}, la file n'en attend pas.`;
|
|
368
|
-
commenter(entree.ticket, texte);
|
|
369
|
-
dire(`✓ ${texte}`);
|
|
370
|
-
return;
|
|
371
|
-
}
|
|
372
|
-
const gh = (args, options = {}) =>
|
|
373
|
-
spawnSync('gh', args, {
|
|
374
|
-
cwd: racine,
|
|
375
|
-
encoding: 'utf8',
|
|
376
|
-
maxBuffer: 64 * 1024 * 1024,
|
|
377
|
-
...options,
|
|
378
|
-
});
|
|
379
|
-
const nonLue = raison => {
|
|
380
|
-
commenter(entree.ticket, `## CI non lue\n\nLa CI de ${court} n'a pas été lue : ${raison}`);
|
|
381
|
-
dire(`⚠ CI de ${court} non lue : ${raison}`);
|
|
382
|
-
};
|
|
383
|
-
const recherche = delai('GRILLHOUSE_CI_RECHERCHE_MS', RECHERCHE_CI_MS);
|
|
384
|
-
const debut = Date.now();
|
|
385
|
-
let passage = null;
|
|
386
|
-
for (;;) {
|
|
387
|
-
const r = gh(['run', 'list', '--commit', sha, '--json', 'databaseId,status,conclusion']);
|
|
388
|
-
if (r.error) return nonLue(`gh ne se lance pas (${r.error.code ?? r.error.message}).`);
|
|
389
|
-
if (r.status !== 0) return nonLue(`gh run list refuse :\n${`${r.stderr}${r.stdout}`.trim()}`);
|
|
390
|
-
let passages = [];
|
|
391
|
-
try {
|
|
392
|
-
passages = JSON.parse(r.stdout || '[]');
|
|
393
|
-
} catch {
|
|
394
|
-
return nonLue(`gh run list rend une sortie illisible :\n${r.stdout.trim()}`);
|
|
395
|
-
}
|
|
396
|
-
passage = passages.find(x => x?.databaseId);
|
|
397
|
-
const reste = recherche - (Date.now() - debut);
|
|
398
|
-
if (passage || reste <= 0) break;
|
|
399
|
-
attendreUnPeu(Math.min(10_000, reste));
|
|
400
|
-
}
|
|
401
|
-
if (!passage) {
|
|
402
|
-
return nonLue(`aucun passage de la CI pour ce commit en ${Math.round(recherche / 1000)} s.`);
|
|
403
|
-
}
|
|
404
|
-
const id = String(passage.databaseId);
|
|
405
|
-
const attente = delai('GRILLHOUSE_CI_ATTENTE_MS', ATTENTE_CI_MS);
|
|
406
|
-
const pas = delai('GRILLHOUSE_CI_PAS_MS', PAS_CI_MS);
|
|
407
|
-
const limite = Date.now() + attente;
|
|
408
|
-
let vue = null;
|
|
409
|
-
for (;;) {
|
|
410
|
-
const v = gh(['run', 'view', id, '--json', 'status,conclusion,jobs'], {
|
|
411
|
-
timeout: 60_000,
|
|
412
|
-
killSignal: 'SIGKILL',
|
|
413
|
-
});
|
|
414
|
-
if (v.error) return nonLue(`gh ne se lance pas (${v.error.code ?? v.error.message}).`);
|
|
415
|
-
if (v.status !== 0) return nonLue(`gh run view refuse :\n${`${v.stderr}${v.stdout}`.trim()}`);
|
|
416
|
-
try {
|
|
417
|
-
vue = JSON.parse(v.stdout || '{}');
|
|
418
|
-
} catch {
|
|
419
|
-
return nonLue(`gh run view rend une sortie illisible :\n${v.stdout.trim()}`);
|
|
420
|
-
}
|
|
421
|
-
ecrireLesEtapes(avancement, vue);
|
|
422
|
-
if (vue?.status === 'completed') break;
|
|
423
|
-
const reste = limite - Date.now();
|
|
424
|
-
if (reste <= 0) {
|
|
425
|
-
return nonLue(`le passage ${id} n'a pas fini en ${Math.round(attente / 60_000)} min.`);
|
|
426
|
-
}
|
|
427
|
-
attendreUnPeu(Math.min(pas, reste));
|
|
428
|
-
}
|
|
429
|
-
if (vue.conclusion === 'success') {
|
|
430
|
-
dire(`✓ CI de ${court} verte (passage ${id})`);
|
|
431
|
-
return;
|
|
432
|
-
}
|
|
433
|
-
const url = gh(['run', 'view', id, '--json', 'url', '--jq', '.url']).stdout?.trim() || id;
|
|
434
|
-
const journal = `${gh(['run', 'view', id, '--log-failed']).stdout ?? ''}`
|
|
435
|
-
.trim()
|
|
436
|
-
.split('\n')
|
|
437
|
-
.slice(-60)
|
|
438
|
-
.join('\n');
|
|
439
|
-
bd('reopen', entree.ticket);
|
|
440
|
-
commenter(
|
|
441
|
-
entree.ticket,
|
|
442
|
-
`## CI rouge\n\nLa CI de ${court} sur ${principale} est rouge : ${url}\n\nLa fin de gh run view ${id} --log-failed :\n\n${journal}\n\nLe ticket est rouvert : sa correction entre sous son numéro.`
|
|
443
|
-
);
|
|
444
|
-
dire(`✗ CI de ${court} rouge (passage ${id}) : ${entree.ticket} rouvert`);
|
|
445
|
-
};
|
|
446
|
-
|
|
447
539
|
// One branch of the queue, against the main of the moment.
|
|
448
540
|
const traiter = entree => {
|
|
449
541
|
const tip = git('rev-parse', '--verify', '-q', `refs/heads/${entree.branche}`).stdout.trim();
|
package/scripts/jointure.d.ts
CHANGED
|
@@ -68,6 +68,25 @@ export interface FichierEngendre {
|
|
|
68
68
|
* does not write. */
|
|
69
69
|
export type ClasseDeTest = { joue: boolean; test: boolean; matiere: boolean } | null;
|
|
70
70
|
|
|
71
|
+
/** What the testwriter writes of the manifests, as the author of a test of Bazel declares the deps
|
|
72
|
+
* of its target: the part of a component's manifest that declares what its tests depend on, and
|
|
73
|
+
* the lock files of the versions. */
|
|
74
|
+
export interface Manifestes {
|
|
75
|
+
/** The lock files of the versions, from the root: the testwriter writes them, and the envelope
|
|
76
|
+
* opens them to him. */
|
|
77
|
+
verrous: string[];
|
|
78
|
+
/** The parts of a file of a component at `chemin` (absolute, or from `racine`) that change from
|
|
79
|
+
* `avant` (null: no file) to `apres` out of the part of its tests, each named, empty for none:
|
|
80
|
+
* of its manifest, the part that declares what its tests depend on; for cargo, of a file of code
|
|
81
|
+
* of `src/`, its test module. Null for a file the module does not judge. */
|
|
82
|
+
horsDesTests(
|
|
83
|
+
chemin: string,
|
|
84
|
+
racine: string,
|
|
85
|
+
avant: string | null,
|
|
86
|
+
apres: string
|
|
87
|
+
): string[] | null;
|
|
88
|
+
}
|
|
89
|
+
|
|
71
90
|
/** The readers, by the code, of the elements a ticket names (composants-affectes). */
|
|
72
91
|
export interface Lecteurs {
|
|
73
92
|
elements: {
|
|
@@ -185,7 +204,8 @@ export interface Langage {
|
|
|
185
204
|
* the update installs each one missing or at another version (`miseAJour.installation`). */
|
|
186
205
|
binaires: Record<string, string>;
|
|
187
206
|
/** The directories the language's tools write in a project, by name: the source files leave them
|
|
188
|
-
* out,
|
|
207
|
+
* out, the update writes them in the project's `.gitignore`, and the removal of the finished
|
|
208
|
+
* copies removes them from a kept copy whose ticket is closed (scripts/copies-finies.mjs). */
|
|
189
209
|
ignorer: string[];
|
|
190
210
|
/** Where a run of the language's tools writes, which the envelope opens to a session. */
|
|
191
211
|
sorties: {
|
|
@@ -222,6 +242,7 @@ export interface Langage {
|
|
|
222
242
|
): { tester: Commande; verifier: Commande; typer: Commande } & Record<string, Commande>;
|
|
223
243
|
verdict(dossier: string): { rapports: RapportDeTest[]; taches: TacheJouee[] };
|
|
224
244
|
estUnTest(chemin: string, racine: string): ClasseDeTest;
|
|
245
|
+
manifestes: Manifestes;
|
|
225
246
|
fichiersEngendres(racine: string): FichierEngendre[];
|
|
226
247
|
gardes(racine: string): string[][];
|
|
227
248
|
migrations: Migration[];
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
// node clippy.mjs in the root of the workspace; 0 green, 1 a finding refused
|
|
6
6
|
//
|
|
7
7
|
// - It runs `cargo clippy --all-targets --message-format=json -- -D warnings`: every target, the
|
|
8
|
-
// tests of `tests/` included, which clippy reads only with `--all-targets`; every warning denied
|
|
8
|
+
// tests of `tests/` included, which clippy reads only with `--all-targets`; every warning denied;
|
|
9
|
+
// rustc wrapped by sccache, as every command of the module that compiles (./sccache.mjs); a
|
|
10
|
+
// PATH without sccache refuses before cargo runs, the line naming `npx grillhouse maj`.
|
|
9
11
|
// - Each diagnostic of the compiler that carries a code is a finding: its file, the primary span's
|
|
10
12
|
// from the root, its line, its message the compiler's. A lint (`clippy::needless_return`, a lint
|
|
11
13
|
// of rustc such as `unused_variables`) is its rule, which the debt keys; an error of compilation
|
|
@@ -20,6 +22,7 @@ import { spawnSync } from 'node:child_process';
|
|
|
20
22
|
import path from 'node:path';
|
|
21
23
|
import { pathToFileURL } from 'node:url';
|
|
22
24
|
import { MODE, trancher } from '../../dette.mjs';
|
|
25
|
+
import { avecSccache, sccacheAbsent } from './sccache.mjs';
|
|
23
26
|
|
|
24
27
|
export const GARDE = 'clippy';
|
|
25
28
|
export const ARGS = ['clippy', '--all-targets', '--message-format=json', '--', '-D', 'warnings'];
|
|
@@ -76,9 +79,14 @@ export function constatsDeClippy(sortie, racine) {
|
|
|
76
79
|
* @param {{ env?: NodeJS.ProcessEnv }} [o] the environment (the results directory, the debt's mode)
|
|
77
80
|
*/
|
|
78
81
|
export function commande(racine, { env = process.env } = {}) {
|
|
82
|
+
const absent = sccacheAbsent(racine, env);
|
|
83
|
+
if (absent) {
|
|
84
|
+
process.stderr.write(`${absent}\n`);
|
|
85
|
+
return 1;
|
|
86
|
+
}
|
|
79
87
|
const r = spawnSync('cargo', ARGS, {
|
|
80
88
|
cwd: racine,
|
|
81
|
-
env,
|
|
89
|
+
env: avecSccache(racine, env),
|
|
82
90
|
encoding: 'utf8',
|
|
83
91
|
maxBuffer: 256 * 1024 * 1024,
|
|
84
92
|
});
|
|
@@ -44,6 +44,10 @@
|
|
|
44
44
|
// directory or file with the crate `tempfile` (`TempDir`, `NamedTempFile`), removed when dropped,
|
|
45
45
|
// a failed test included, never a path built by hand under `std::env::temp_dir()`.
|
|
46
46
|
// - `typer`: `cargo check --all-targets`. `preparer`: `cargo fetch --locked`.
|
|
47
|
+
// - Cargo runs with rustc wrapped by sccache, its cache common to the copies of the machine
|
|
48
|
+
// (./sccache.mjs), in a copy as in an agent's envelope (grillhouse-cyr). `tester`, `verifier`
|
|
49
|
+
// and `typer` refuse, before any run of cargo, a PATH without sccache, in one line that names it
|
|
50
|
+
// and `npx grillhouse maj`, which installs it (code 2).
|
|
47
51
|
// - Nextest reads the frame's profile `grillhouse` (./nextest.toml, a tool's configuration under
|
|
48
52
|
// the project's own, `--tool-config-file`), whose JUnit report lands at
|
|
49
53
|
// `<target>/nextest/grillhouse/junit.xml`.
|
|
@@ -87,6 +91,7 @@ import {
|
|
|
87
91
|
retirerALInterruption,
|
|
88
92
|
} from '../../services-du-noyau.mjs';
|
|
89
93
|
import { composantDans, crates, joueDesTests, metadonnees } from './composants.mjs';
|
|
94
|
+
import { avecSccache, sccacheAbsent } from './sccache.mjs';
|
|
90
95
|
import { touchesDesFichiers } from './touches.mjs';
|
|
91
96
|
import { JUNIT, TACHES } from './verdict.mjs';
|
|
92
97
|
|
|
@@ -99,6 +104,8 @@ const RACINE = '//';
|
|
|
99
104
|
const VERROU = 'Cargo.lock';
|
|
100
105
|
// The commands that play the exact versions of the repository, refused without its Cargo.lock.
|
|
101
106
|
const VERROUILLEES = ['tester', 'verifier', 'preparer'];
|
|
107
|
+
// The commands that compile, refused without sccache on the PATH (./sccache.mjs).
|
|
108
|
+
const COMPILENT = ['tester', 'verifier', 'typer'];
|
|
102
109
|
|
|
103
110
|
/** The guards of structure of the module, in the order they play: each its name, its script beside
|
|
104
111
|
* this one, and its arguments as a guard. */
|
|
@@ -140,6 +147,8 @@ function passe(racine, env) {
|
|
|
140
147
|
const id = `${Date.now()}-${process.pid}`;
|
|
141
148
|
const taches = [];
|
|
142
149
|
const cibles = {};
|
|
150
|
+
// Cargo compiles through sccache (./sccache.mjs).
|
|
151
|
+
const compilation = avecSccache(racine, env);
|
|
143
152
|
const ecrire = () => {
|
|
144
153
|
if (!dossier) {
|
|
145
154
|
return;
|
|
@@ -179,14 +188,18 @@ function passe(racine, env) {
|
|
|
179
188
|
mkdirSync(path.dirname(journal), { recursive: true });
|
|
180
189
|
const fd = openSync(journal, 'w');
|
|
181
190
|
try {
|
|
182
|
-
r = spawnSync('cargo', args, {
|
|
191
|
+
r = spawnSync('cargo', args, {
|
|
192
|
+
cwd: racine,
|
|
193
|
+
env: compilation,
|
|
194
|
+
stdio: ['inherit', fd, fd],
|
|
195
|
+
});
|
|
183
196
|
} finally {
|
|
184
197
|
closeSync(fd);
|
|
185
198
|
}
|
|
186
199
|
process.stderr.write(readFileSync(journal, 'utf8'));
|
|
187
200
|
t.journal = path.relative(racine, journal);
|
|
188
201
|
} else {
|
|
189
|
-
r = spawnSync('cargo', args, { cwd: racine, env, stdio: 'inherit' });
|
|
202
|
+
r = spawnSync('cargo', args, { cwd: racine, env: compilation, stdio: 'inherit' });
|
|
190
203
|
}
|
|
191
204
|
t.code = r.error ? 127 : (r.status ?? 128 + (constants.signals[r.signal] ?? 0));
|
|
192
205
|
if (junit && dossier && existsSync(junit)) {
|
|
@@ -277,7 +290,7 @@ function choisir(racine, tous, chemins) {
|
|
|
277
290
|
continue;
|
|
278
291
|
}
|
|
279
292
|
if (!joueDesTests(racine, c)) {
|
|
280
|
-
refus.push(`${chemin} : ${c.nom} n'a
|
|
293
|
+
refus.push(`${chemin} : ${c.nom} n'a aucun test, ni dossier tests/, ni tests.rs sous src/`);
|
|
281
294
|
continue;
|
|
282
295
|
}
|
|
283
296
|
const cible = crate.cibles.find(t => t.kind.includes('test') && t.src === abs);
|
|
@@ -369,7 +382,9 @@ export function verrouNonVersionne(racine) {
|
|
|
369
382
|
* @param {{ racine?: string, env?: NodeJS.ProcessEnv }} [o]
|
|
370
383
|
*/
|
|
371
384
|
export function lancer(nom, args, { racine = process.cwd(), env = process.env } = {}) {
|
|
372
|
-
const refus =
|
|
385
|
+
const refus =
|
|
386
|
+
(VERROUILLEES.includes(nom) ? verrouNonVersionne(racine) : null) ??
|
|
387
|
+
(COMPILENT.includes(nom) ? sccacheAbsent(racine, env) : null);
|
|
373
388
|
if (refus) {
|
|
374
389
|
process.stderr.write(`${refus}\n`);
|
|
375
390
|
return 2;
|