@rightkit/ci 0.2.45 → 0.2.49
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 +57 -3
- package/checkout.test.mjs +1 -0
- package/guard-coverage.test.mjs +1 -0
- package/manifest.mjs +539 -27
- package/manifest.schema.json +101 -6
- package/manifest.test.mjs +48 -0
- package/package.json +1 -1
- package/render.test.mjs +362 -27
- package/supersede.mjs +127 -0
- package/supersede.test.mjs +84 -0
- package/swift-check.test.mjs +95 -0
- package/templates/ci.yml +4 -4
- package/templates/profiles/rust-hybrid/ci.yml +4 -4
- package/templates/profiles/rust-hybrid/release-candidate.yml +2 -1
- package/templates/profiles/rust-hybrid/sign-existing.yml +36 -0
- package/templates/swift-check.yml +85 -0
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Public-repository-only GitHub Actions workflow layer for Right Suite products. T
|
|
|
12
12
|
## Commands
|
|
13
13
|
|
|
14
14
|
- `right-git install <repo> --lanes ci,...` writes `.rightgit.json` and renders workflows.
|
|
15
|
-
- Lanes: `ci`, `qualification`, `package-smoke`, `release-candidate`, `publish-npm`, `publish-package-managers`, `regenerate`. The `regenerate` lane is manual-only: it runs `regenerate.script`, checks the result, and opens a pull request from a `right-git/regenerate-<run>` branch; it never writes to the default branch.
|
|
15
|
+
- Lanes: `ci`, `qualification`, `package-smoke`, `release-candidate`, `publish-npm`, `publish-package-managers`, `regenerate`, `swift-check`. The `regenerate` lane is manual-only: it runs `regenerate.script`, checks the result, and opens a pull request from a `right-git/regenerate-<run>` branch; it never writes to the default branch.
|
|
16
16
|
- `right-git sync` re-renders installed workflows from the manifest.
|
|
17
17
|
- `right-git drift --all` checks installed workflows against templates and re-checks visibility. When the manifest declares the `regenerate` lane, drift also warns (never fails) if the repository's "Allow GitHub Actions to create and approve pull requests" setting is off. It reads `gh api repos/{owner}/{repo}/actions/permissions/workflow` and prints a note instead when gh is unavailable.
|
|
18
18
|
- `right-git adopt` maps an existing repository's workflows onto lanes for review. With `--out <dir>` it writes the candidate templates to that directory.
|
|
@@ -95,21 +95,44 @@ Both keys are opt-in; unset, the rendered `ci.yml` is byte-identical.
|
|
|
95
95
|
- `windows: "unsigned"` needs `windowsGlob` and a `windows-*` runner in the ci gate; matched files upload as `dev-windows-<sha>`.
|
|
96
96
|
- The `dev-mac-sign` job uses the `release` environment, so that environment's protection rules (required reviewers, branch policy) apply. The job only exists for pushes to the default branch.
|
|
97
97
|
- Install a mac dev build with `right-release install-app --dev --zip <file>` (Developer ID-signed, not notarized).
|
|
98
|
+
- `devArtifact.macSignManifest` (with `macPayloadMetadata`) replaces `codesign --deep` on the `.app` with `right-release sign-dev-artifact`: each file in the repository-relative sign manifest (`{ "schema": 1, "entries": [{ "file": "Legion.app/Contents/MacOS/legion", "identifier": "com.example.legion" }] }`, paths relative to the extracted archive, nested code before its bundle) is signed with its fixed identifier, the archive's payload metadata (`macPayloadMetadata`, relative to the archive root) is verified before and refreshed after signing, and `sign-evidence.json` is uploaded beside the zip. The job then also checks out the repo and installs dependencies, so `@rightkit/release` 0.2.172 or later must be a dependency. Requires `mac: "sign"`; not combinable with `macEntitlements` (put per-file entitlements in the manifest) or `mac: "notarize"`. Unset keeps the `--deep` lane.
|
|
98
99
|
- `devArtifact.parallel: true` moves each platform's build into its own job, `dev-artifact-mac` or `dev-artifact-windows`. Each runs beside the QA gate job instead of after it, needs only the private-repo guard, and compiles the dev app with `devArtifact.buildScript` (a package script name; required with `parallel`, rejected without it) before staging it. Parallel jobs run on their own platform runners, so they do not need `ciAllOs`. `mac: "sign"` still waits for the gate: `dev-mac-sign` needs `ci` and `dev-artifact-mac`. The trade-off: unsigned uploads no longer wait for the gate, so a failing gate can still leave `dev-windows-<sha>` or `dev-mac-unsigned-<sha>` behind. Unset or `false` keeps the staging inside the gate job.
|
|
99
100
|
- The `~/Library/Developer/Xcode/DerivedData` cache helps only builds that use Xcode's default derived data location. A gate that passes its own `-derivedDataPath` writes outside that directory and gets nothing from the cache; use the default location, or cache the custom path in the gate.
|
|
100
101
|
|
|
102
|
+
## Sign an existing artifact (rust-hybrid, `sign-existing` lane)
|
|
103
|
+
|
|
104
|
+
For a public repository whose signing must run on protected CI, but whose artifact was already built and qualified by an earlier run. The lane never rebuilds, never uses `--release` and never notarizes.
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"lanes": ["ci", "sign-existing"],
|
|
109
|
+
"signExisting": {
|
|
110
|
+
"macSignManifest": "build/dev-sign.json",
|
|
111
|
+
"macPayloadMetadata": "payload.json",
|
|
112
|
+
"environment": "release"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
- `macSignManifest` (repository-relative) and `macPayloadMetadata` (relative to the extracted artifact, and outside every signed bundle: `right-release sign-dev-artifact` refuses metadata inside a signed `.app`, because refreshing it after signing would break that signature) are the same as for `devArtifact.macSignManifest`; `environment` is optional and defaults to the signing environment (`release`). `matrix.os` needs a macOS runner; the first one is used.
|
|
118
|
+
- `signExisting.macPayloadMetadataSource` (optional, repository-relative, for example `dist/dev-macos/payload.json`) makes the unsigned dev packaging step put the payload metadata inside the inner zip. The step stages the `.app` (wrapper layout kept, copied with `ditto`) and that file together and zips them, so the file sits at the inner-zip root under the file name `macPayloadMetadata`, which must then be a bare name such as `payload.json`; the step fails if the file is missing. This applies to every macOS unsigned packaging step (`devArtifact.mac` `sign`, `notarize` or `unsigned`, in the gate job or the parallel `dev-artifact-mac` job). Unset, the step is the single `ditto -c -k --keepParent` line and the render is byte-identical. The app generates the file itself; Legion writes it with `fileEvidence` from `@rightkit/release/macos-file-evidence.mjs`, so its hashes use the same file and bundle-tree digests that `sign-dev-artifact` verifies.
|
|
119
|
+
- Invoke it from the default branch: `gh workflow run sign-existing.yml -f run_id=39001031529 -f artifact=12089612527 -f source_sha=59f451ae`. `artifact` is a numeric artifact id or an artifact name (all digits means id). `source_sha` is 7 to 40 lowercase hex characters and must be a prefix of the run's full head sha.
|
|
120
|
+
- The job refuses, before it downloads the artifact or reads a secret, unless the GitHub API shows that the run belongs to this repository, was built from it (not a fork), completed successfully and has a head sha starting with `source_sha`; that exactly one unexpired artifact of that run matches and records the same run, head sha and repository; and that the source commit is an ancestor of the signing revision (the default-branch commit that runs the job, which also supplies the signing code and sign manifest).
|
|
121
|
+
- The artifact must hold one zip (extracted with `ditto`) or a plain file tree. The job signs it with `right-release sign-dev-artifact`, then uploads `signed-<artifact name>-<sha>` containing the signed zip (same layout), `sign-evidence.json` and `source-verification.json`. It uses the same three Developer ID secrets and temporary keychain as `dev-mac-sign`, with `contents: read` and `actions: read` only. Needs `@rightkit/release` 0.2.172 or later as a dependency. Unset, nothing changes.
|
|
122
|
+
|
|
101
123
|
## Cache keys and concurrency (rust-hybrid)
|
|
102
124
|
|
|
103
125
|
Both keys are opt-in; unset, the rendered workflows are byte-identical.
|
|
104
126
|
|
|
105
127
|
- `rustCache.keySuffix` (1 to 64 characters: letters, digits, `.`, `_`, `-`; starts with a letter or digit) renders `key: <lane>-<suffix>` into every Swatinem/rust-cache step: `ci`, `regenerate`, `release-candidate`. Each lane therefore keeps its own cache entry. The dev-artifact jobs use `<lane>-dev-artifact-<platform>-<suffix>`. Swatinem/rust-cache does not re-save a cache on an exact key hit (third-party behavior, not verified in this repository). To rotate the cache, change the suffix, which gives it a new key.
|
|
106
|
-
- `concurrency
|
|
128
|
+
- `concurrency` (requires lane `ci`; both profiles). The rule is one CI run in progress per repository. By default (`mainPushes: "cancel"`) the ci workflow renders a `supersede` job, the only job with `actions: write`, which runs `supersede.mjs`: a newer push to the default branch cancels an older run of the workflow that never started, has a failed job, or is younger than `graceFraction` (default 0.7) of the median duration of the last `medianWindow` (default 10) successful runs. An older run past that point is left to finish, and the new run's `ci` job waits for it through a job-level group with `cancel-in-progress: false`. PR runs still cancel superseded runs.
|
|
129
|
+
- `concurrency.mainPushes: "queue"` is the opt-out: default-branch pushes each run to completion, no `supersede` job is rendered, and a non-empty single-line `concurrency.reason` is required (the manifest is invalid without one). The reason is rendered as a YAML comment above the `concurrency` block. `graceFraction` and `medianWindow` are not allowed with `queue`. The publish workflow never cancels.
|
|
107
130
|
|
|
108
131
|
```json
|
|
109
132
|
{
|
|
110
133
|
"profile": "rust-hybrid",
|
|
111
134
|
"rustCache": { "workspaces": ["engine"], "keySuffix": "2026-10" },
|
|
112
|
-
"concurrency": { "mainPushes": "queue" },
|
|
135
|
+
"concurrency": { "mainPushes": "queue", "reason": "deploys must see every main commit built in turn" },
|
|
113
136
|
"devArtifact": {
|
|
114
137
|
"mac": "unsigned",
|
|
115
138
|
"windows": "unsigned",
|
|
@@ -121,6 +144,10 @@ Both keys are opt-in; unset, the rendered workflows are byte-identical.
|
|
|
121
144
|
}
|
|
122
145
|
```
|
|
123
146
|
|
|
147
|
+
## Dev qualification (rust-hybrid release-candidate)
|
|
148
|
+
|
|
149
|
+
`candidate.devQualification: { "buildScript": "...", "journeyScript": "..." }` adds a `dev-qualification` job beside the QA-free candidate (Orthic-Labs/rightkit#107). `@rightkit/release` refuses `qa-native`, `qa-control`, `dev-native`, `dev-inspect` and `test-mode` in any release tier, so in-app journeys cannot run against the sealed candidate. The job needs `admission`, uses the candidate's target matrix, checks out the same `source_revision`, runs `buildScript` (the dev build, QA surface on) and then `journeyScript`, and uploads its evidence as `<prefix>-<run>-<attempt>-devqual-<platform>-<arch>-<version>-<revision><suffix>` plus a `dev-qualification` stage summary. When set, `windows-sign` and `macos-sign` need it, so a failure blocks signing. Installed qualification of the signed candidate is unchanged. Unset, the workflow is byte-identical. Validation refuses a candidate build or check script whose name mentions a QA surface and a `devQualification.buildScript` equal to `candidate.buildScript`; it cannot see cargo features inside a script.
|
|
150
|
+
|
|
124
151
|
## Private Swift packages (ci, qualification, release-candidate, regenerate lanes)
|
|
125
152
|
|
|
126
153
|
Set `swift.privatePackages` to let a public repository's workflows fetch a private Swift package, for example `example-org/private-swift-package`:
|
|
@@ -176,3 +203,30 @@ pnpm exec right-git drift --all
|
|
|
176
203
|
- The optional `publish-package-managers` lane needs two long-lived tokens in GitHub Actions secrets. Their names and scope are in the package templates, and they are not zero-exposure. Read `docs/rules/github-access.md` in the workspace before enabling it.
|
|
177
204
|
- Manifest fields are charset-checked before they reach workflow YAML.
|
|
178
205
|
- `swift.privatePackages` renders a secret reference into the workflows listed in its section. The `right-git-ci-only` policy in `@rightkit/release` refuses any reference outside the jobs listed under Release policy above.
|
|
206
|
+
|
|
207
|
+
## Native iOS XCTest (`swift-check`)
|
|
208
|
+
|
|
209
|
+
Use `lanes: ["swift-check"]` with default `node` profile for standalone Swift validation. Existing `ci` stays optional for this profile. Configure native tools & paths in `.rightgit.json`:
|
|
210
|
+
|
|
211
|
+
```json
|
|
212
|
+
{
|
|
213
|
+
"swift": {
|
|
214
|
+
"check": {
|
|
215
|
+
"runner": "macos-15",
|
|
216
|
+
"xcodeVersion": "16.4",
|
|
217
|
+
"projectDirectory": "ios",
|
|
218
|
+
"spec": "project.yml",
|
|
219
|
+
"project": "Widgets.xcodeproj",
|
|
220
|
+
"scheme": "Widgets",
|
|
221
|
+
"xcodegenVersion": "2.44.1"
|
|
222
|
+
},
|
|
223
|
+
"privatePackages": [{ "host": "github.com", "secret": "SWIFT_READ_TOKEN" }]
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Versions above illustrate configuration; choose exact versions provisioned on selected hosted runner. Xcode & XcodeGen must already match; missing tools or version drift fail before generation. This lane installs no native tools. `projectDirectory` is repository-relative; spec & project paths are relative to that directory. Scheme names permit letters, digits, `.`, `_` & `-`.
|
|
229
|
+
|
|
230
|
+
Lane checks out without persisted GitHub credentials, installs pinned package-manager dependencies, runs shared ownership scan, verifies native tools, configures shared private-package access, generates project, discovers available iPhone simulator, then runs Debug XCTest with `-scmProvider system` & `CODE_SIGNING_ALLOWED=NO`. Repository must directly depend on published `@rightkit/release` for ownership scan. Credentials remain step-scoped & cleanup always runs before `.xcresult` upload. Fork pull requests fail closed when declared private-package secret is unavailable. Owner provisions a read-only credential limited to required private repositories.
|
|
231
|
+
|
|
232
|
+
Only push to configured default branch & `pull_request` trigger this lane. Workflow requests `contents: read`, pins actions to full commit SHAs & includes public-repository refusal guard. `swift.privatePackages` is optional for public-only dependencies. Omit `swift.check` & lane to preserve existing workflow bytes.
|
package/checkout.test.mjs
CHANGED
|
@@ -11,6 +11,7 @@ const BASE = {
|
|
|
11
11
|
schemaVersion: 1,
|
|
12
12
|
compile: "github-actions-only",
|
|
13
13
|
lanes: [...KNOWN_LANES],
|
|
14
|
+
swift: { check: { runner: "macos-15", xcodeVersion: "16.4", projectDirectory: "ios", spec: "project.yml", project: "Widgets.xcodeproj", scheme: "Widgets", xcodegenVersion: "2.44.1" } },
|
|
14
15
|
matrix: { os: ["ubuntu-latest", "macos-latest", "windows-latest"], node: ["22.13", "24"] },
|
|
15
16
|
packageManager: "pnpm@11.24.0",
|
|
16
17
|
publish: {
|
package/guard-coverage.test.mjs
CHANGED
|
@@ -54,6 +54,7 @@ const FULL_MANIFEST = {
|
|
|
54
54
|
schemaVersion: 1,
|
|
55
55
|
compile: "github-actions-only",
|
|
56
56
|
lanes: [...KNOWN_LANES],
|
|
57
|
+
swift: { check: { runner: "macos-15", xcodeVersion: "16.4", projectDirectory: "ios", spec: "project.yml", project: "Widgets.xcodeproj", scheme: "Widgets", xcodegenVersion: "2.44.1" } },
|
|
57
58
|
regenerate: { script: "regenerate" },
|
|
58
59
|
matrix: { os: ["ubuntu-latest", "macos-latest", "windows-latest"], node: ["22.13", "24"] },
|
|
59
60
|
packageManager: "pnpm@11.24.0",
|