GeezerVison is showing github.com — check-remote-config: pre-releases allowed unless require-stable (defe… · openlogix/.github@96519cd
File treeExpand file treeCollapse file tree Open diff view settings actions/check-remote-config tests/check-remote-config
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .github/workflows/actions-test.yaml +9-2Lines changed: 9 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -117,7 +117,7 @@ jobs: | 117 | 117 |
| 118 | 118 | # -- check-remote-config: the checker on every case (with a fake gh that | 119 | 119 | # -- answers from fixture releases), then the action itself, passing on a | 120 | | - # -- good config and failing on a pre-release. | | 120 | + # -- good config and on a pre-release, failing on one with require-stable. | 121 | 121 | test-check-remote-config: | 122 | 122 | runs-on: ubuntu-latest | 123 | 123 | steps: | @@ -141,13 +141,20 @@ jobs: | 141 | 141 | folder: tests/check-remote-config/cases/good/remote-config | 142 | 142 | platforms: darwin-arm64 linux-x86-64 | 143 | 143 |
| 144 | | - - name: Check a config naming a pre-release | | 144 | + - name: Check a config naming a pre-release, allowed by default | | 145 | + uses: ./actions/check-remote-config | | 146 | + with: | | 147 | + folder: tests/check-remote-config/cases/prerelease/remote-config | | 148 | + platforms: darwin-arm64 | | 149 | + | | 150 | + - name: Check it again, requiring stable releases | 145 | 151 | id: prerelease | 146 | 152 | continue-on-error: true | 147 | 153 | uses: ./actions/check-remote-config | 148 | 154 | with: | 149 | 155 | folder: tests/check-remote-config/cases/prerelease/remote-config | 150 | 156 | platforms: darwin-arm64 | | 157 | + require-stable: "true" | 151 | 158 |
| 152 | 159 | - name: Assert that the pre-release was refused | 153 | 160 | uses: ./actions/assert-step-failed | |
Collapse file Copy file name to clipboardExpand all lines: CLAUDE.md +1-1Lines changed: 1 addition & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -29,7 +29,7 @@ Action details: | 29 | 29 | - `actions/release-policy.sh`: the pre-release policy, the one place it's set (`PRERELEASE_KEEP=5`: pre-releases are daily, so each is deleted after about 5 days unless made stable). `publish-pre-release` applies it and states it in every release text. | 30 | 30 | - `check-platform`: `os` is a substring of `uname -o`, `arch` equals `uname -m`, case-insensitive. | 31 | 31 | - `scan-files-for-viruses`: `file-patterns`; each pattern must match a file; ClamAV with `freshclam`, scans inside archives. | 32 | | -- `check-remote-config`: `folder` (default `remote-config`), `platforms` (what `${PLATFORM}` stands for, required), `owner` (default `openlogix`). Needs a checkout. Checks every `<product>/config-NNN.jsonc` (`check_remote_config.py`, jsonschema in a venv): file names, JSONC, the schema in `schemas/`, and per dependency that its release exists and is stable, its file exists for each platform, and the release's `SHA256SUMS` lists it; on `main` and pull requests into `main`, repos must be in `owner`. Reports every problem as an annotation, then fails. Reads releases with `gh api repos/<repo>/releases/tags/<tag>` and `gh release download <tag> -R <repo> -p SHA256SUMS -O -` (the tests' fake `gh` answers exactly these). A component's own checks (its tests with the named releases, the dependencies its source expects) stay in its repo. | | 32 | +- `check-remote-config`: `folder` (default `remote-config`), `platforms` (what `${PLATFORM}` stands for, required), `owner` (default `openlogix`), `require-stable` (default `false`: pre-releases are allowed while Open Logix is in development). Needs a checkout. Checks every `<product>/config-NNN.jsonc` (`check_remote_config.py`, jsonschema in a venv): file names, JSONC, the schema in `schemas/`, and per dependency that its release exists (not a draft; stable, with `require-stable`), its file exists for each platform, and the release's `SHA256SUMS` lists it; on `main` and pull requests into `main`, repos must be in `owner`. Reports every problem as an annotation, then fails. Reads releases with `gh api repos/<repo>/releases/tags/<tag>` and `gh release download <tag> -R <repo> -p SHA256SUMS -O -` (the tests' fake `gh` answers exactly these). A component's own checks (its tests with the named releases, the dependencies its source expects) stay in its repo. | 33 | 33 | - `assert-step-failed`: `outcome`, `error-message`; for testing expected failures. | 34 | 34 | - `.github/workflows/publish-docs.yaml`: a reusable workflow (`workflow_call`) that builds a repo's MkDocs site with `--strict` and deploys it to its GitHub Pages. Callers keep the triggers, the Pages permissions and the `pages` concurrency group, and call `openlogix/.github/.github/workflows/publish-docs.yaml@main`. | 35 | 35 |
| |
Collapse file Copy file name to clipboardExpand all lines: README.md +1-1Lines changed: 1 addition & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -40,7 +40,7 @@ Composite actions in [actions/](actions), and one reusable workflow, used from t | 40 | 40 | | `publish-pre-release` | A release workflow's end: checksums, the standard release text, the day's pre-release made again from scratch, and the cleanup | | 41 | 41 | | `check-platform` | Fails unless the runner has the given OS and architecture | | 42 | 42 | | `scan-files-for-viruses` | Scans files, including inside archives, with ClamAV | | 43 | | -| `check-remote-config` | Checks a repo's remote configs (`remote-config/<product>/config-NNN.jsonc`): the schema, and that every named release is stable and has its files | | | 43 | +| `check-remote-config` | Checks a repo's remote configs (`remote-config/<product>/config-NNN.jsonc`): the schema, and that every named release exists and has its files | | 44 | 44 | | `assert-step-failed` | Fails unless an earlier step failed, for testing expected failures | | 45 | 45 | | [`publish-docs.yaml`](.github/workflows/publish-docs.yaml) (reusable workflow) | Builds a repo's MkDocs site and deploys it to its GitHub Pages | | 46 | 46 |
| |
Collapse file Copy file name to clipboardExpand all lines: actions/check-remote-config/action.yaml +9-2Lines changed: 9 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -3,7 +3,8 @@ description: >- | 3 | 3 | Checks a repo's remote configs, remote-config/<product>/config-NNN.jsonc | 4 | 4 | (Remote updates, in the website repo's CLAUDE.md): file names, JSONC, the | 5 | 5 | schema (schemas/logix-remote-config-v1.json in this repo), and for every | 6 | | - dependency that its release exists and is stable, that its file exists for | | 6 | + dependency that its release exists (and is stable, with require-stable), | | 7 | + that its file exists for | 7 | 8 | each platform and that the release's SHA256SUMS lists it. On main, and on | 8 | 9 | pull requests into main, repos must be in the owner. Reports every problem, | 9 | 10 | then fails if there were any. Needs a checkout and GH_TOKEN. | @@ -19,6 +20,10 @@ inputs: | 19 | 20 | description: "The only owner repos may have on main and on pull requests into main." | 20 | 21 | required: false | 21 | 22 | default: openlogix | | 23 | + require-stable: | | 24 | + description: "'true' to refuse pre-releases. Off while Open Logix is in development (Remote updates, in the website repo's CLAUDE.md)." | | 25 | + required: false | | 26 | + default: "false" | 22 | 27 | runs: | 23 | 28 | using: "composite" | 24 | 29 | steps: | | 35 | 40 | FOLDER: ${{ inputs.folder }} | 36 | 41 | PLATFORMS: ${{ inputs.platforms }} | 37 | 42 | OWNER: ${{ inputs.owner }} | | 43 | + REQUIRE_STABLE: ${{ inputs.require-stable }} | 38 | 44 | GH_TOKEN: ${{ env.GH_TOKEN || github.token }} | 39 | 45 | run: | | 40 | 46 | set -euo pipefail | | 47 | 53 | --folder "$FOLDER" \ | 48 | 54 | --schema "${{ github.action_path }}/../../schemas/logix-remote-config-v1.json" \ | 49 | 55 | --platforms "$PLATFORMS" \ | 50 | | - --owner "$owner" | | 56 | + --owner "$owner" \ | | 57 | + $([[ "$REQUIRE_STABLE" == "true" ]] && echo --require-stable) |
Collapse file Copy file name to clipboardExpand all lines: actions/check-remote-config/check_remote_config.py +14-7Lines changed: 14 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 2 | 2 |
| 3 | 3 | For each file: its name, its JSONC syntax, the schema (logix-remote-config-v1, | 4 | 4 | in this repo's schemas/), and for each dependency: its repo's owner (when | 5 | | ---owner is given), that its release exists and is stable (not a pre-release | 6 | | -or a draft), that its file exists for every platform, and that the release's | | 5 | +--owner is given), that its release exists (and, with --require-stable, is | | 6 | +stable: not a pre-release; never a draft), that its file exists for every platform, and that the release's | 7 | 7 | SHA256SUMS lists it. Every problem is reported, as a GitHub annotation, and | 8 | 8 | the exit status is 1 if there were any. | 9 | 9 |
| @@ -65,7 +65,9 @@ def gh(*args: str) -> tuple[int, str]: | 65 | 65 | return r.returncode, r.stdout if r.returncode == 0 else r.stderr | 66 | 66 |
| 67 | 67 |
| 68 | | -def check_dependency(name: str, dep: dict, platforms: list[str], owner: str) -> list[str]: | | 68 | +def check_dependency( | | 69 | + name: str, dep: dict, platforms: list[str], owner: str, require_stable: bool | | 70 | +) -> list[str]: | 69 | 71 | repo, tag, template = dep["repo"], dep["release"], dep["file"] | 70 | 72 | errors = [] | 71 | 73 | if owner and repo.split("/")[0] != owner: | @@ -74,7 +76,9 @@ def check_dependency(name: str, dep: dict, platforms: list[str], owner: str) -> | 74 | 76 | if status != 0: | 75 | 77 | return errors + [f"{name}: no release {tag} in {repo} ({out.strip()})"] | 76 | 78 | release = json.loads(out) | 77 | | - if release.get("prerelease") or release.get("draft"): | | 79 | + if release.get("draft"): | | 80 | + errors.append(f"{name}: {repo} {tag} is a draft") | | 81 | + if require_stable and release.get("prerelease"): | 78 | 82 | errors.append(f"{name}: {repo} {tag} is a pre-release; name only stable releases") | 79 | 83 | assets = {a["name"] for a in release.get("assets", [])} | 80 | 84 | files = sorted( | @@ -98,7 +102,9 @@ def check_dependency(name: str, dep: dict, platforms: list[str], owner: str) -> | 98 | 102 | return errors | 99 | 103 |
| 100 | 104 |
| 101 | | -def check_file(path: Path, schema: dict, platforms: list[str], owner: str) -> list[str]: | | 105 | +def check_file( | | 106 | + path: Path, schema: dict, platforms: list[str], owner: str, require_stable: bool | | 107 | +) -> list[str]: | 102 | 108 | try: | 103 | 109 | config = json.loads(strip_comments(path.read_text(encoding="utf-8"))) | 104 | 110 | except (ValueError, UnicodeDecodeError) as e: | @@ -113,7 +119,7 @@ def check_file(path: Path, schema: dict, platforms: list[str], owner: str) -> li | 113 | 119 | errors = [] | 114 | 120 | for name, dep in config.items(): | 115 | 121 | if name != "$schema": | 116 | | - errors += check_dependency(name, dep, platforms, owner) | | 122 | + errors += check_dependency(name, dep, platforms, owner, require_stable) | 117 | 123 | return errors | 118 | 124 |
| 119 | 125 |
| @@ -123,6 +129,7 @@ def main() -> int: | 123 | 129 | ap.add_argument("--schema", required=True, help="logix-remote-config-v1.json") | 124 | 130 | ap.add_argument("--platforms", required=True, help="space-separated, such as darwin-arm64") | 125 | 131 | ap.add_argument("--owner", default="", help="the only owner repos may have; empty for any") | | 132 | + ap.add_argument("--require-stable", action="store_true", help="refuse pre-releases") | 126 | 133 | args = ap.parse_args() | 127 | 134 | folder = Path(args.folder) | 128 | 135 | schema = json.loads(Path(args.schema).read_text(encoding="utf-8")) | @@ -154,7 +161,7 @@ def report(where: Path, message: str) -> None: | 154 | 161 | if not files: | 155 | 162 | report(folder, "no remote config files") | 156 | 163 | for f in files: | 157 | | - errors = check_file(f, schema, platforms, args.owner) | | 164 | + errors = check_file(f, schema, platforms, args.owner, args.require_stable) | 158 | 165 | for e in errors: | 159 | 166 | report(f, e) | 160 | 167 | if not errors: | |
Collapse file Copy file name to clipboardExpand all lines: schemas/logix-remote-config-v1.json +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 2 | 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", | 3 | 3 | "$id": "https://www.openlogix.org/schemas/logix-remote-config-v1.json", | 4 | 4 | "title": "Open Logix remote config", | 5 | | - "description": "What one Open Logix component uses: one entry per direct dependency, naming a stable GitHub release and its file. A component reads remote-config/<product>/config-NNN.jsonc from its own repo, by the config version it hard-codes (Remote updates, in the website repo's CLAUDE.md). The file is JSONC: comments say why each entry changed.", | | 5 | + "description": "What one Open Logix component uses: one entry per direct dependency, naming a GitHub release and its file. A component reads remote-config/<product>/config-NNN.jsonc from its own repo, by the config version it hard-codes (Remote updates, in the website repo's CLAUDE.md). The file is JSONC: comments say why each entry changed.", | 6 | 6 | "type": "object", | 7 | 7 | "required": ["$schema"], | 8 | 8 | "properties": { | | 27 | 27 | "pattern": "^[A-Za-z0-9][A-Za-z0-9-]*/[A-Za-z0-9._-]+$" | 28 | 28 | }, | 29 | 29 | "release": { | 30 | | - "description": "The release tag, yyyy-mm-dd. It must be a stable release (not a pre-release).", | | 30 | + "description": "The release tag, yyyy-mm-dd. Pre-releases are allowed while Open Logix is in development; stable releases will be required later.", | 31 | 31 | "type": "string", | 32 | 32 | "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$" | 33 | 33 | }, | |
Collapse file Copy file name to clipboardExpand all lines: tests/check-remote-config/run.sh +6-3Lines changed: 6 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -8,13 +8,15 @@ repo="$here/../.." | 8 | 8 | export PATH="$here/fake-gh:$PATH" FAKE_GH_RELEASES="$here/releases" | 9 | 9 | failures=0 | 10 | 10 |
| 11 | | -# expect <case> <owner> <0 or 1> [<text the output must contain>] | | 11 | +# expect <case> <owner> <0 or 1> [<text the output must contain>]; with | | 12 | +# STABLE=1 set, pre-releases are refused. | 12 | 13 | expect() { | 13 | 14 | local out status | 14 | 15 | out="$(python3 "$repo/actions/check-remote-config/check_remote_config.py" \ | 15 | 16 | --folder "$here/cases/$1/remote-config" \ | 16 | 17 | --schema "$repo/schemas/logix-remote-config-v1.json" \ | 17 | | - --platforms "darwin-arm64 linux-x86-64" --owner "$2" 2>&1)" | | 18 | + --platforms "darwin-arm64 linux-x86-64" --owner "$2" \ | | 19 | + ${STABLE:+--require-stable} 2>&1)" | 18 | 20 | status=$? | 19 | 21 | if [[ $status -ne $3 || ( -n "${4:-}" && "$out" != *"$4"* ) ]]; then | 20 | 22 | echo "FAIL: $1 (owner '$2'): expected exit $3${4:+ and \"$4\"}, got $status:" | @@ -26,7 +28,8 @@ expect() { | 26 | 28 | } | 27 | 29 |
| 28 | 30 | expect good openlogix 0 "config-001.jsonc: ok" | 29 | | -expect prerelease openlogix 1 "is a pre-release" | | 31 | +expect prerelease openlogix 0 "config-001.jsonc: ok" | | 32 | +STABLE=1 expect prerelease openlogix 1 "is a pre-release" | 30 | 33 | expect no-release openlogix 1 "no release 2026-11-30 in openlogix/logix-catalog" | 31 | 34 | expect no-file openlogix 1 "has no file logix-catalog-linux-x86-64-20261124.tgz" | 32 | 35 | expect not-in-sums openlogix 1 "SHA256SUMS doesn't list logix-catalog-20261126.tgz" | |
|