@moku-labs/ci 1.3.0 → 1.4.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
CHANGED
|
@@ -24,6 +24,7 @@ everything else lives here, once. Not a build tool and not a framework — it ca
|
|
|
24
24
|
[Workflows](#workflows) ·
|
|
25
25
|
[Project checks](#project-checks) ·
|
|
26
26
|
[PR previews](#pr-previews) ·
|
|
27
|
+
[Demos](#demos) ·
|
|
27
28
|
[CLI](#cli) ·
|
|
28
29
|
[The contract](#the-contract) ·
|
|
29
30
|
[Versioning](#versioning) ·
|
|
@@ -157,6 +158,40 @@ bun add https://pkg.pr.new/@moku-labs/core@42 # 42 = PR number, a commit sha w
|
|
|
157
158
|
| A preview URL never reaches `main`: the `lint` job and `doctor` both refuse it. | `package-ci.yml`, `preview-deps` |
|
|
158
159
|
| `preview` is not a required check. Turn it off with `with: { preview: false }`. | caller `ci.yml` |
|
|
159
160
|
|
|
161
|
+
## Demos
|
|
162
|
+
|
|
163
|
+
`demos.yml` runs the moku demos (`moku-labs/demos`) against what a pull request builds, so an
|
|
164
|
+
engine or editor change that breaks a real game fails on its own PR.
|
|
165
|
+
|
|
166
|
+
```yaml
|
|
167
|
+
demos:
|
|
168
|
+
needs: ci
|
|
169
|
+
if: github.event_name == 'pull_request'
|
|
170
|
+
uses: moku-labs/ci/.github/workflows/demos.yml@v1
|
|
171
|
+
with:
|
|
172
|
+
game: https://pkg.pr.new/@moku-labs/game@${{ github.event.pull_request.head.sha }}
|
|
173
|
+
tier: ${{ contains(github.event.pull_request.labels.*.name, 'demos:full') && 'full' || 'fast' }}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
| Input | Default | Meaning |
|
|
177
|
+
|---|---|---|
|
|
178
|
+
| `game`, `editor` | `""` | A version, a pkg.pr.new URL, or empty for each demo's own pin |
|
|
179
|
+
| `tier` | `fast` | `fast`: `bun run test` on ubuntu. `full`: plus `test:visual` on macos-latest and `test:editor` |
|
|
180
|
+
| `demos_ref` | `main` | demos branch when no paired branch exists |
|
|
181
|
+
| `paired_ref` | PR branch | demos branch with this name wins, for an intended break |
|
|
182
|
+
| `only` | `[]` | JSON array of demo folders; empty = all |
|
|
183
|
+
|
|
184
|
+
| Rule | Where |
|
|
185
|
+
|---|---|
|
|
186
|
+
| A demo is a folder whose `package.json` has `"moku": { "demo": true }`. | demos repo |
|
|
187
|
+
| The workflow only calls the demo's scripts with `--engine` / `--editor`; the demo's runner picks the package, as it does locally. | demo runner |
|
|
188
|
+
| A tracked file with `/Users/`, `/home/…` or `?? "../` fails the run. Paths are parameters. | `discover` |
|
|
189
|
+
| Checks to require: `demos / fast`; `demos / full` reports only on the full tier. | rulesets |
|
|
190
|
+
| Pixels run on macOS: on Linux runners WebGPU loses its device. | `visual-run` |
|
|
191
|
+
|
|
192
|
+
Examples: `examples/package/ci-with-demos.yml` (label `demos:full`) and
|
|
193
|
+
`examples/package/demos-comment.yml` (PR comment `/demos full`).
|
|
194
|
+
|
|
160
195
|
## CLI
|
|
161
196
|
|
|
162
197
|
| Command | When | What it does |
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
# ci.yml of a package whose PRs must run the moku demos (the engine, the editor).
|
|
4
|
+
# Same thin caller as ci.yml, plus a `demos` job after the preview is published.
|
|
5
|
+
# Required checks: "ci / lint", "ci / types", "ci / test", "ci / build" and "demos / fast".
|
|
6
|
+
# The label `demos:full` on the PR adds pixels (macOS) and editor scenarios: "demos / full".
|
|
7
|
+
on:
|
|
8
|
+
push:
|
|
9
|
+
branches: [main]
|
|
10
|
+
pull_request:
|
|
11
|
+
types: [opened, synchronize, reopened, labeled]
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
ci:
|
|
18
|
+
uses: moku-labs/ci/.github/workflows/package-ci.yml@v1
|
|
19
|
+
|
|
20
|
+
demos:
|
|
21
|
+
needs: ci
|
|
22
|
+
if: github.event_name == 'pull_request'
|
|
23
|
+
uses: moku-labs/ci/.github/workflows/demos.yml@v1
|
|
24
|
+
with:
|
|
25
|
+
# The preview job of `ci` published this commit; a full sha resolves on pkg.pr.new.
|
|
26
|
+
# In the editor's repo, pass `editor:` instead of `game:`.
|
|
27
|
+
game: https://pkg.pr.new/@moku-labs/game@${{ github.event.pull_request.head.sha }}
|
|
28
|
+
tier: ${{ contains(github.event.pull_request.labels.*.name, 'demos:full') && 'full' || 'fast' }}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: Demos on comment
|
|
2
|
+
|
|
3
|
+
# A PR comment `/demos full` runs the full demos tier against the PR's preview, without a label.
|
|
4
|
+
# Only members and collaborators can trigger it.
|
|
5
|
+
on:
|
|
6
|
+
issue_comment:
|
|
7
|
+
types: [created]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
head:
|
|
14
|
+
if: >-
|
|
15
|
+
github.event.issue.pull_request &&
|
|
16
|
+
startsWith(github.event.comment.body, '/demos full') &&
|
|
17
|
+
contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
permissions:
|
|
20
|
+
pull-requests: read
|
|
21
|
+
outputs:
|
|
22
|
+
sha: ${{ steps.pr.outputs.sha }}
|
|
23
|
+
ref: ${{ steps.pr.outputs.ref }}
|
|
24
|
+
steps:
|
|
25
|
+
- id: pr
|
|
26
|
+
env:
|
|
27
|
+
GH_TOKEN: ${{ github.token }}
|
|
28
|
+
PR: ${{ github.event.issue.number }}
|
|
29
|
+
REPO: ${{ github.repository }}
|
|
30
|
+
run: |
|
|
31
|
+
set -euo pipefail
|
|
32
|
+
gh api "repos/$REPO/pulls/$PR" --jq '"sha=\(.head.sha)\nref=\(.head.ref)"' >> "$GITHUB_OUTPUT"
|
|
33
|
+
|
|
34
|
+
demos:
|
|
35
|
+
needs: head
|
|
36
|
+
uses: moku-labs/ci/.github/workflows/demos.yml@v1
|
|
37
|
+
with:
|
|
38
|
+
game: https://pkg.pr.new/@moku-labs/game@${{ needs.head.outputs.sha }}
|
|
39
|
+
# issue_comment has no head_ref: name the branch to pair with explicitly.
|
|
40
|
+
paired_ref: ${{ needs.head.outputs.ref }}
|
|
41
|
+
tier: full
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moku-labs/ci",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Central CI and release for the moku family: reusable workflows, caller examples and the moku-release CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@biomejs/biome": "2.4.16",
|
|
35
|
-
"@moku-labs/common": "0.3.
|
|
35
|
+
"@moku-labs/common": "0.3.3",
|
|
36
36
|
"@types/bun": "1.3.14",
|
|
37
37
|
"@vitest/coverage-istanbul": "4.0.18",
|
|
38
38
|
"eslint": "9.39.3",
|