Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 50 additions & 2 deletions .github/workflows/app-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@
# 6. `checks`, one command per line, in the project's folder. EVERY check runs,
# even after one has failed, so one failure does not hide another; the job
# fails if any did, each failure is an annotation on the run, and the job
# summary lists every check with its result and time.
# summary lists every check with its result and time. With `uix-check: true`,
# the first check is `uix-check`, the bin of the project's own @beplus/uix:
# the View checks against the repository's guidelines/uix.md and
# uix-ratchet.json.
#
# What stays in the repository is what is the repository's: when it runs, the
# permissions it grants, the concurrency group, and the commands.
Expand Down Expand Up @@ -146,6 +149,19 @@ on:
required: false
type: string
default: ""
uix-check:
description: >-
Run `uix-check`, the bin @beplus/uix ships (0.66.0 and later), as the first
check: in the working directory, so it is the project's own @beplus/uix,
with `--root` at the repository, where it reads the product profile
(guidelines/uix.md) and uix-ratchet.json. It runs the View checks
(uix.view-on-uix, uix.view-definition, uix.filter-coverage,
uix.filter-one-home, uix.single-copy) and fails on a MUST violation or on a
ratchet entry with nothing left to allow, as every other check does. With
`pr-gate`, a change to guidelines/ or uix-ratchet.json runs the checks too.
required: false
type: boolean
default: false
secrets:
BE_NPM_TOKEN:
description: >-
Expand Down Expand Up @@ -255,14 +271,36 @@ jobs:

# Last in `plan`: with a project to weigh it checks out the PR's head with its whole
# history (blobless), which the steps above must not read.
# uix-check reads the repository's guidelines/ and uix-ratchet.json, which no Rush
# project holds: with it on, a change to either runs the checks as well.
- name: What the PR gate weighs
id: weigh
if: inputs.pr-gate
env:
GATE_PATHS: ${{ inputs.gate-paths }}
UIX_CHECK: ${{ inputs.uix-check }}
run: |
set -euo pipefail
paths="$GATE_PATHS"
if [ "$UIX_CHECK" = true ]; then
paths+="${paths:+$'\n'}guidelines/*"$'\n'"uix-ratchet.json"
fi
if [ -n "$paths" ]; then
{
echo "paths<<__PATHS__"
printf '%s\n' "$paths"
echo "__PATHS__"
} >> "$GITHUB_OUTPUT"
fi

- name: PR gate
id: gate
if: inputs.pr-gate
uses: beplus/setup-beplus/pr-gate@v2
with:
stack: top-only
projects: ${{ inputs.gate-paths == '' && inputs.project || '' }}
paths: ${{ inputs.gate-paths }}
paths: ${{ steps.weigh.outputs.paths }}
node-version: ${{ inputs.node-version }}

checks:
Expand Down Expand Up @@ -399,9 +437,19 @@ jobs:
env:
CHECKS: ${{ inputs.checks }}
DIRECTORY: ${{ needs.plan.outputs.directory }}
UIX_CHECK: ${{ inputs.uix-check }}
run: |
# Not -e (GitHub's default for `run`): a failed check is counted, and the next one runs.
set +e -uo pipefail
# The project's own @beplus/uix, by its bin in this folder (never npx: with no bin it
# asks the registry for a package named uix-check), against the profile and ratchet
# at the repository's root. Without the bin the check fails at once, saying why.
if [ "$UIX_CHECK" = true ]; then
if [ ! -x node_modules/.bin/uix-check ]; then
echo "::error title=uix-check::$DIRECTORY has no node_modules/.bin/uix-check: \`uix-check: true\` needs @beplus/uix 0.66.0 or later as a dependency of the project."
fi
CHECKS='node_modules/.bin/uix-check --root "$GITHUB_WORKSPACE"'$'\n'"$CHECKS"
fi
ran=0
failed=0
rows=""
Expand Down
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,34 @@ jobs:
| `github-environment` | none | The environment holding `BE_NPM_TOKEN` (bepluscloud, MRKIT: `dev`) |
| `node-version` | `22.14` | |
| `timeout-minutes` | `40` | The checks job's |
| `uix-check` | `false` | Runs `uix-check` (the bin of `@beplus/uix` 0.66.0+) as the first check; see below |

**`uix-check: true`** runs the View checks of One View in the app's CI:
`uix.view-on-uix`, `uix.view-definition`, `uix.filter-coverage`,
`uix.filter-one-home` and `uix.single-copy`, with every rule the product's
profile adopts.
- It runs the way `npm run check:i18n` runs in a caller's `checks`: one more
check in the list, first, counted and shown in the summary like the others.
- It runs in the working directory, so it is the bin of the project's own
`@beplus/uix` (`node_modules/.bin/uix-check`). Its `--root` is the repository,
where it reads the profile (`guidelines/uix.md`) and `uix-ratchet.json`.
- It fails on a MUST violation and on a ratchet entry with nothing left to
allow, so the ratchet only goes down.
- A project without the bin (no `@beplus/uix`, or one older than 0.66.0) fails
the check at once, with an annotation saying so.
- With `pr-gate`, a change under `guidelines/` or to `uix-ratchet.json` runs
the checks too. No Rush project holds those files, so the project's impact
alone would miss them.

```yaml
with:
project: "@bepluscloud/console"
pr-gate: true
uix-check: true
checks: |
npm run check:i18n
npm run typecheck
```

The check is named `<caller job> / checks` (`console / checks`). It reaches no
database but its own service, reads no connection secret and assumes no AWS
Expand Down