From d82b2a680aae01287c9b1a39f67d1744eca343dd Mon Sep 17 00:00:00 2001 From: "beplus-agent-claude[bot]" <300068699+beplus-agent-claude[bot]@users.noreply.github.com> Date: Sat, 21 Nov 2026 09:51:43 +0000 Subject: [PATCH 1/2] docs(library-ci): tests in library-ci, `tests: true` (v2.18.0) Co-Authored-By: Igor Lamos --- README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/README.md b/README.md index 1fdd1a4..a0c4421 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,34 @@ nothing: a repository states what it already did. `scripts/verify-callers.mjs` checked that, resolving each caller against the shared workflow and comparing the enabled steps to the file it replaced. +#### Tests in library-ci + +`library-ci.yml` builds every project (`rush rebuild`) and, with **`tests: true`** +(since v2.18.0), runs the repository's bulk `test` command after it: +`rush test --verbose`, over every project, as the build is (the job's PR gate +selects no projects, so there is no impacted set to narrow to). A repository whose +`common/config/rush/command-line.json` has no bulk `test` command gets a notice +and a line in the job summary saying no tests ran, and the step passes. Until +v2.18.0 the step only echoed "Tests will be added in the future", so a library +without a `test` job of its own ran its tests on developers' machines only. + +It is off by default, because the libraries that already had a bulk `test` run it +in a `test` job of their own (actions, ai, i18n, kb, mind, flows, workbench, …), +several against a Postgres or Neo4j service that this job does not start. Turn it +on in a library that has no such job: + +```yaml + uses: beplus/setup-beplus/.github/workflows/library-ci.yml@v2 + with: + packages: | + packages/core/api-core + tests: true +``` + +A project without a `test` script is skipped only if the command says +`"ignoreMissingScript": true`; give a project that needs tools the runner lacks +(the Smithy CLI, say) no `test` script, or a separate one. + #### One version per commit, built once, promoted A library publishes the way cli_v2 releases the CLI. A version is cut once, on dev, From 8b218cf4f50436c56332ed0a204dbbb64c1840d7 Mon Sep 17 00:00:00 2001 From: "beplus-agent-claude[bot]" <300068699+beplus-agent-claude[bot]@users.noreply.github.com> Date: Sat, 21 Nov 2026 09:51:44 +0000 Subject: [PATCH 2/2] feat(library-ci): `tests: true` runs the repository's bulk `test` command The "Run tests (when available)" step only echoed "Tests will be added in the future", so a library without a test job of its own (beplus/api) built and change-verified in CI but ran its tests on developers' machines only. With `tests: true` the step runs `rush test --verbose` after the build, over every project as `rush rebuild` is (the job's gate selects no projects). A repository with no bulk `test` in command-line.json gets a notice and a summary line, and the step passes. Off by default: the libraries that already have a bulk `test` run it in their own `test` job, several against Postgres or Neo4j, which this job does not start. The step stays in place, so verify-callers sees every caller's steps unchanged. Co-Authored-By: Igor Lamos --- .github/workflows/library-ci.yml | 46 +++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/.github/workflows/library-ci.yml b/.github/workflows/library-ci.yml index ed8c284..9db0313 100644 --- a/.github/workflows/library-ci.yml +++ b/.github/workflows/library-ci.yml @@ -69,6 +69,18 @@ on: required: false type: boolean default: false + tests: + description: >- + Run the repository's bulk `test` command (`rush test --verbose`) after the + build. Off by default: every library that had a bulk `test` when this was + added (actions, ai, i18n, kb, mind, flows, …) already runs it in a `test` job + of its own, several against a Postgres or Neo4j service this job does not + start, so turning it on for them would run their suites twice, or without + their database. On, with no bulk `test` in command-line.json, the step says + so and skips. + required: false + type: boolean + default: false pr-gate: description: >- The PR gate (pr-gate/, PR-GATE.md): a draft runs nothing, and only the top PR @@ -210,11 +222,39 @@ jobs: - name: Build packages run: node ./common/scripts/install-run-rush.js rebuild --verbose + # Always present, so a caller's enabled steps stay those of the file it replaced + # (scripts/verify-callers.mjs); `tests` decides inside. Over every project, as the + # build above is: this job's gate selects no projects, so there is no impacted set. - name: Run tests (when available) + env: + BE_TESTS: ${{ inputs.tests }} run: | - # Add this when you have tests - # node ./common/scripts/install-run-rush.js test --verbose - echo "Tests will be added in the future" + if [ "$BE_TESTS" != "true" ]; then + echo "Tests are off for this repository (library-ci.yml's \`tests\` input); its own workflow runs them, or none does." + exit 0 + fi + + # Is there a bulk `test` command? command-line.json is JSONC, read as the version + # policy check below reads rush.json. + TEST_KIND=$(node -e " + const fs = require('fs'); + const file = 'common/config/rush/command-line.json'; + if (!fs.existsSync(file)) { console.log('none'); process.exit(0); } + const keepStrings = (match) => (match[0] === '\x22' ? match : ''); + const text = fs.readFileSync(file, 'utf8') + .replace(/\x22(?:[^\x22\x5c]|\x5c.)*\x22|\/\/[^\n]*|\/\*[\s\S]*?\*\//g, keepStrings) + .replace(/\x22(?:[^\x22\x5c]|\x5c.)*\x22|,(?=\s*[}\]])/g, keepStrings); + const test = (JSON.parse(text).commands || []).find((c) => c.name === 'test'); + console.log(test ? test.commandKind : 'none'); + ") + + if [ "$TEST_KIND" != "bulk" ]; then + echo "::notice title=No tests run::\`tests: true\`, but common/config/rush/command-line.json defines no bulk \`test\` command (found: $TEST_KIND). Add one, with a \`test\` script in each project that has tests." + echo "⚠️ \`tests: true\`, but there is no bulk \`test\` command in \`common/config/rush/command-line.json\`: no tests ran." >> $GITHUB_STEP_SUMMARY + exit 0 + fi + + node ./common/scripts/install-run-rush.js test --verbose - name: Check bundle size if: inputs.bundle-size-check