@ai-ecoverse/slicc-shared-web 2.10.5 → 2.11.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/README.md +1 -1
- package/harness/file-time.cjs +16 -0
- package/harness/shard.cjs +4 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -70,7 +70,7 @@ The caller cancels superseded runs on pull requests only, so a push to `main` ne
|
|
|
70
70
|
|
|
71
71
|
**Deploy** runs on pull requests only, never in the merge queue, with `id-token: write` for an OIDC-authenticated deploy. The merge queue's tests therefore run without `STAGING_URL`: a test that needs it skips when it's empty. It runs the `deploy` command with every secret the caller passes as an environment variable, except the pipeline's own `AWS_BEARER_TOKEN_BEDROCK`, `SLICC_ISSUES_TOKEN` and `github_token`. The command writes `url=<staging URL>` to `$GITHUB_OUTPUT`; the tests and the reviewers get it as `STAGING_URL`. With `deploy-secrets`, a newline- or space-separated list of secret names, only those of them are exported.
|
|
72
72
|
|
|
73
|
-
**Integration tests** install Chrome for Testing with `slicc-cdp install-browser` (with `--with-deps` where the runner has root or passwordless sudo) (`--version` from the `chrome` input, stable without it), then each runs its share of the files matching `test-glob`. `lint` plans the split once for all `shards`, so the shards can't disagree: it takes the JUnit reports of the latest completed merge queue run of the same workflow (else the latest completed pull request run), and hands each file to the shard with the least time so far, longest first; a file without a timing counts as the average, and without any timings every file counts the same.
|
|
73
|
+
**Integration tests** install Chrome for Testing with `slicc-cdp install-browser` (with `--with-deps` where the runner has root or passwordless sudo) (`--version` from the `chrome` input, stable without it), then each runs its share of the files matching `test-glob`. `lint` plans the split once for all `shards`, so the shards can't disagree: it takes the JUnit reports of the latest completed merge queue run of the same workflow (else the latest completed pull request run), and hands each file to the shard with the least time so far, longest first; a file without a timing counts as the average, and without any timings every file counts the same. A file's time is its own wall time where `shard.cjs` recorded one: it preloads `harness/file-time.cjs` into each test file's own process, which writes the file's wall time to `junit/<shard>-<pid>.times` when it exits, so tests registered through a shared helper still count for the file that ran them. Otherwise it is the sum of the JUnit times of the tests that name the file, and Node names the file that calls `test()`. Each shard runs the repo's own `test` command unchanged: `harness/shard.cjs`, preloaded through `NODE_OPTIONS`, makes the outermost `node --test` run only the shard's files that its own patterns match, writes `junit/<shard>.xml` next to the usual spec output, and then takes itself out of the environment, so a `node --test` that a test starts runs as it would without it. Files a `node --test` call would run that are not in `test-glob` (unit tests, say, whether in the same call or another) run on shard 0 only, so nothing is dropped; when `test-glob` matches nothing, shard 0 runs the command unchanged and the others run nothing. Each call keeps its own JUnit report (`junit/<shard>-<pid>.xml` for all but the last). Each shard uploads `coverage/`, `artifacts/` and `junit/` as `integration-<shard>`. `integration` passes only when every shard did and their JUnit reports add up to at least one test that ran, not skipped, and no failure or error (the placeholder an empty shard runs doesn't count), and every file matching `test-glob` was handed to `node --test` on exactly one shard (`shard.cjs` lists the files it hands over next to its JUnit report, as `junit/<shard>-<pid>.files`, since a test registered through a helper is attributed to the helper); a file that ran on no shard or on two is named as an error, and it prints `integration: PASS <n> tests (<k> skipped) in <m> JUnit reports, <f> of <f> test-glob files on exactly one shard` or `integration: FAIL <why>`; a repo without node tests sets `require-tests: false`. Setting `NODE_OPTIONS` in `test` would replace the pipeline's own, which carry the shard preload and the JUnit reporter, so extra node flags (a bigger heap, say) go in `node-options`. `integration` is therefore the one check to require for the tests, under the caller's job name (`ci / integration`). A suite whose last step reads every test's artifacts, as this repo's `verify.mjs` does, sets `shards: 1`.
|
|
74
74
|
|
|
75
75
|
**Reviewer** runs twice, once with [claude-code-action](https://github.com/anthropics/claude-code-action) and once with [codex-action](https://github.com/openai/codex-action), on the same prompt, whether the tests passed or not. Both run on Amazon Bedrock with the org secret `AWS_BEARER_TOKEN_BEDROCK`, in the region of the org variable `CERT_AWS_REGION` (`us-west-2` without it). Claude uses the model in `CERT_BEDROCK_MODEL` (`global.anthropic.claude-opus-5-5` without it), as the cert reviews do. Codex uses its built-in `amazon-bedrock-runtime` provider (codex-action waits for its OpenAI proxy's `<run id>.json` in `codex-home` whenever it has a prompt, so the job writes a placeholder one) and the model in `CODEX_BEDROCK_MODEL` (`global.openai.gpt-6.1-sol` without it). Models that Bedrock serves only through inference profiles, as Sol 6.1 is, need the runtime provider and the profile's `global.` id; the `amazon-bedrock` provider's endpoint doesn't list them. The job token can only read. Each reviewer gets:
|
|
76
76
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const { appendFileSync } = require('node:fs');
|
|
3
|
+
const { isAbsolute, normalize, relative } = require('node:path');
|
|
4
|
+
|
|
5
|
+
const out = process.env.SLICC_TEST_TIMES;
|
|
6
|
+
delete process.env.SLICC_TEST_TIMES;
|
|
7
|
+
const entry = process.argv[1];
|
|
8
|
+
|
|
9
|
+
if (out && entry) {
|
|
10
|
+
const file = normalize(isAbsolute(entry) ? relative(process.cwd(), entry) : entry);
|
|
11
|
+
process.on('exit', () => {
|
|
12
|
+
try {
|
|
13
|
+
appendFileSync(out, `${JSON.stringify({ file, ms: Math.round(performance.now()) })}\n`);
|
|
14
|
+
} catch {}
|
|
15
|
+
});
|
|
16
|
+
}
|
package/harness/shard.cjs
CHANGED
|
@@ -80,7 +80,10 @@ if (list !== undefined && process.execArgv.includes('--test') && !env.NODE_TEST_
|
|
|
80
80
|
keepReport();
|
|
81
81
|
const chosen = select(process.argv.slice(1));
|
|
82
82
|
record(chosen ?? expand(process.argv.slice(1)));
|
|
83
|
-
|
|
83
|
+
const junit = env.SLICC_TEST_JUNIT;
|
|
84
|
+
const timer = junit ? ` --require ${join(__dirname, 'file-time.cjs')}` : '';
|
|
85
|
+
env.NODE_OPTIONS = `${env.SLICC_TEST_NODE_OPTIONS ?? ''}${timer}`.trim();
|
|
86
|
+
if (junit) env.SLICC_TEST_TIMES = junit.replace(/(\.xml)?$/, `-${process.pid}.times`);
|
|
84
87
|
for (const name of [
|
|
85
88
|
'SLICC_TEST_NODE_OPTIONS',
|
|
86
89
|
'SLICC_TEST_FILES',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-ecoverse/slicc-shared-web",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"description": "Shared Renovate, Biome, TypeScript, lefthook and GitHub Actions configuration, plus the CDP integration-test harness, for SLICC's web repos",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|