GeezerVison is showing github.com — list-config-channels: a product's channels, for a test matrix · openlogix/.github@af5d688
File treeExpand file treeCollapse file tree Open diff view settings actions/list-config-channels
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .github/workflows/actions-test.yaml +46Lines changed: 46 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 92 | 92 | [ ! -e _build-info ] | 93 | 93 |
| 94 | 94 | # -- Test action check-platform | | 95 | + # -- list-config-channels: one channel per config file, sorted, without | | 96 | + # -- channels.jsonc, from the newest version folder; fails without one. | | 97 | + test-list-config-channels: | | 98 | + runs-on: ubuntu-latest | | 99 | + | | 100 | + steps: | | 101 | + - name: Checkout this repo | | 102 | + uses: actions/checkout@v7 | | 103 | + | | 104 | + - name: Make fixture configs | | 105 | + run: | | | 106 | + mkdir -p fixture/logix-x/001 fixture/logix-x/002 fixture/logix-y/001 | | 107 | + touch fixture/logix-x/001/channels.jsonc fixture/logix-x/001/prod.jsonc | | 108 | + touch fixture/logix-x/002/channels.jsonc fixture/logix-x/002/prod.jsonc fixture/logix-x/002/dev.jsonc | | 109 | + touch fixture/logix-y/001/channels.jsonc | | 110 | +
| | 111 | + - name: List the newest version folder's channels | | 112 | + id: list | | 113 | + uses: ./actions/list-config-channels | | 114 | + with: | | 115 | + folder: fixture | | 116 | + product: logix-x | | 117 | + | | 118 | + - name: Check them | | 119 | + env: | | 120 | + CHANNELS: ${{ steps.list.outputs.channels }} | | 121 | + VERSION: ${{ steps.list.outputs.version-folder }} | | 122 | + run: | | | 123 | + [[ "$CHANNELS" == '["dev","prod"]' ]] || { echo "::error::channels: $CHANNELS"; exit 1; } | | 124 | + [[ "$VERSION" == fixture/logix-x/002 ]] || { echo "::error::version folder: $VERSION"; exit 1; } | | 125 | +
| | 126 | + # NOTE: Having this step failing is the expected and normal behavior. | | 127 | + - name: List a folder with no config file | | 128 | + id: no-config | | 129 | + continue-on-error: true | | 130 | + uses: ./actions/list-config-channels | | 131 | + with: | | 132 | + folder: fixture | | 133 | + product: logix-y | | 134 | + | | 135 | + - name: Assert that previous step failed | | 136 | + uses: ./actions/assert-step-failed | | 137 | + with: | | 138 | + outcome: ${{ steps.no-config.outcome }} | | 139 | + error-message: "Listing a version folder without config files did not fail" | | 140 | + | 95 | 141 | test-check-platform: | 96 | 142 | runs-on: ubuntu-latest | 97 | 143 |
| |
Collapse file Copy file name to clipboardExpand all lines: CLAUDE.md +1Lines changed: 1 addition & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -71,6 +71,7 @@ Action details: | 71 | 71 | - `check-platform`: `os` is a substring of `uname -o`, `arch` equals `uname -m`, case-insensitive. | 72 | 72 | - `scan-files-for-viruses`: `file-patterns`; each pattern must match a file; ClamAV with `freshclam`, scans inside archives. | 73 | 73 | - `check-remote-config`: `folder` (default `remote-config`), `platforms` (what `${PLATFORM}` stands for, required), `owner` (default `openlogix`). Needs a checkout. Checks every version folder `<product>/<NNN>/` (`check_remote_config.py`, jsonschema in a venv; the layout and rules are the website repo's `CLAUDE.md`, Remote updates): only `channels.jsonc` and `<channel>.jsonc` files there; `channels.jsonc` against `schemas/logix-channels-v1.json` (no `dev` key, tags only), each release on at most one channel, every `prod` release an existing stable release of this repo (`--repo`, the workflow's repo); a config file only for `prod`, `dev` or a channel of `channels.jsonc`; `prod.jsonc` when there are prod releases, else at least `prod.jsonc` or `dev.jsonc`. Each config file: JSONC, `schemas/logix-remote-config-v1.json`, and per dependency that its release exists (not a draft; stable in `prod.jsonc`), 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. | | 74 | +- `list-config-channels`: `product` (its folder in `remote-config`), `folder` (default `remote-config`). Needs a checkout. Outputs `channels`, a JSON array of the newest version folder's channels, one per config file (not `channels.jsonc`), sorted, such as `["prod"]`, for a test matrix (`channel: ${{ fromJSON(needs.channels.outputs.channels) }}`), and `version-folder`; fails without a version folder or a config file. Logix Engine's and Logix IDE's `test.yaml` use it. | 74 | 75 | - `assert-step-failed`: `outcome`, `error-message`; for testing expected failures. | 75 | 76 | - `.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`. | 76 | 77 |
| |
Collapse file Copy file name to clipboard +54Lines changed: 54 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +name: "List Config Channels" | | 2 | +description: >- | | 3 | + Lists the channels a product's tests run on: one per config file in its | | 4 | + newest remote config version folder, remote-config/<product>/<NNN>/ | | 5 | + (prod.jsonc, dev.jsonc and so on; not channels.jsonc), as a JSON array | | 6 | + for a job matrix, such as ["dev","prod"] (Remote updates, Channels, in the | | 7 | + website repo's CLAUDE.md: tests run once per config file). Fails without a | | 8 | + version folder or a config file. Needs a checkout. | | 9 | +inputs: | | 10 | + product: | | 11 | + description: "The product's package name, its folder in remote-config, such as logix-engine." | | 12 | + required: true | | 13 | + folder: | | 14 | + description: "The remote-config folder, relative to the workspace." | | 15 | + required: false | | 16 | + default: remote-config | | 17 | +outputs: | | 18 | + channels: | | 19 | + description: "The channels, as a JSON array sorted by name, such as [\"dev\",\"prod\"]." | | 20 | + value: ${{ steps.list.outputs.channels }} | | 21 | + version-folder: | | 22 | + description: "The newest version folder, such as remote-config/logix-engine/001." | | 23 | + value: ${{ steps.list.outputs.version-folder }} | | 24 | +runs: | | 25 | + using: "composite" | | 26 | + steps: | | 27 | + - name: List the channels | | 28 | + id: list | | 29 | + shell: bash | | 30 | + env: | | 31 | + FOLDER: ${{ inputs.folder }} | | 32 | + PRODUCT: ${{ inputs.product }} | | 33 | + run: | | | 34 | + set -euo pipefail | | 35 | + version="$(find "$FOLDER/$PRODUCT" -mindepth 1 -maxdepth 1 -type d -name '[0-9][0-9][0-9]' 2>/dev/null | sort | tail -1)" | | 36 | + if [[ -z "$version" ]]; then | | 37 | + echo "::error::No version folder in $FOLDER/$PRODUCT (such as $FOLDER/$PRODUCT/001)." | | 38 | + exit 1 | | 39 | + fi | | 40 | + channels=() | | 41 | + for f in "$version"/*.jsonc; do | | 42 | + [[ -e "$f" ]] || continue | | 43 | + name="$(basename "$f" .jsonc)" | | 44 | + [[ "$name" == channels ]] && continue | | 45 | + channels+=("$name") | | 46 | + done | | 47 | + if [[ ${#channels[@]} -eq 0 ]]; then | | 48 | + echo "::error::No config file in $version (such as prod.jsonc)." | | 49 | + exit 1 | | 50 | + fi | | 51 | + json="$(printf '%s\n' "${channels[@]}" | sort | python3 -c 'import json, sys; print(json.dumps(sys.stdin.read().split(), separators=(",", ":")))')" | | 52 | + echo "Channels in $version: $json" | | 53 | + echo "channels=$json" >> "$GITHUB_OUTPUT" | | 54 | + echo "version-folder=$version" >> "$GITHUB_OUTPUT" |
|