Continuous Integration, GYM Exercises, and Publishing
This page documents the three systems that guard and ship zikzak_inappwebview: the GitHub Actions merge gate, the GYM operator-forging exercises that prove the plugin works before a human or agent touches it, and the lockstep publishing toolchain that pushes all packages to pub.dev. Together they answer three questions in sequence — does the code hold up, can an operator actually wield it, and is it safe to release — and each stage feeds the next. This is an explanation-and-how-to page aimed at intermediate developers who need to reason about why a check exists and how to run the release without tripping a guard.
The Delivery Pipeline at a Glance
Section titled “The Delivery Pipeline at a Glance”The three systems are deliberately decoupled but ordered. CI is the merge gate that runs on every pull request; GYM is the pre-implementation and pre-release proof that the plugin’s public surface behaves; publishing is the manual, human-supervised release that only runs after both are green. The diagram below shows how a change flows from a pull request to a live pub.dev version, and where each system intervenes.
flowchart LR A[Pull Request] --> B{CI Workflow} B -->|analyze / test / build| C[Merge to master] C --> D[GYM gate] D -->|warmup reps + exercises| E{Gate open?} E -->|closed| D E -->|open| F[prepare_for_publish.sh] F --> G[publish.sh lockstep] G --> H[push_to_master.sh tag] H --> I[(pub.dev)]The critical design property is that CI never publishes and publishing never bypasses CI. CI is a pure verification gate wired to pull_request and push on master, with in-progress runs cancelled per ref so a stale run never blocks a fresh commit. Publishing is a separate, script-driven flow that a human (or a supervised agent) invokes explicitly, and it re-runs the same flutter analyze --no-fatal-infos gate that CI uses so a release can never ship something the merge gate would have rejected.
Sources: ci.yml, publish.sh
Continuous Integration: The Merge Gate
Section titled “Continuous Integration: The Merge Gate”The CI workflow is a single file that fans out into seven jobs, each targeting a different failure mode that a pure Dart test run cannot catch. The matrix jobs (analyze, test) cover the pure-Dart packages cheaply, while the build-* jobs exist specifically because Dart tests cannot compile the native plugins — the Swift and C++ sources are only type-checked by a real platform build through a consuming app.
| Job | Runner / Matrix | What it proves | Why it exists |
|---|---|---|---|
build-linux |
ubuntu-24.04 + ubuntu-24.04-arm, debian:sid pinned by digest |
WPE WebKit native navigation, cookies, JS; compiled ctest |
Dart tests can’t compile the Linux plugin or exercise WPE’s network/bridge |
analyze |
8 packages | flutter analyze --no-fatal-infos is clean |
Errors/warnings fail; style infos tolerated per-package |
test |
7 packages (excludes web) |
flutter test passes |
Pure-Dart behavioral coverage |
test-web |
ubuntu-latest |
flutter test --platform chrome |
Web package needs a browser platform |
resolve-floor |
Flutter 3.50.0 (declared floor) |
A minimal consumer resolves on the oldest supported Flutter | Transitive constraints can silently raise the real floor (#393) |
build-ios |
macos-15 (Swift 6) |
flutter build ios --release --no-codesign compiles this checkout |
Only a real iOS build type-checks the Swift; catches SDK override breaks |
build-macos |
macos-15 |
flutter build macos --debug compiles this checkout |
macOS tests are source-contract scans that pass on non-compiling Swift |
The two build-* jobs share a subtle but essential guard: the example app resolves platform packages from pub.dev by default, so each job writes a pubspec_overrides.yaml pointing the platform packages at the local checkout, then asserts the lockfile actually resolved from path — otherwise a typo’d override would silently compile the published package and pass forever. The build-ios job additionally asserts the runner’s Swift toolchain matches the #if compiler(>=6.0) arm it exists to compile, and documents an explicit coverage gap: with macOS 14 images retired, only the Swift 6 arm is compiled in CI while the pre-Swift-6 #else arm is kept for Xcode 15 consumers but no longer exercised.
Sources: ci.yml, ci.yml, ci.yml
Running the Gate Locally Without Duplicating It
Section titled “Running the Gate Locally Without Duplicating It”Private repositories with no GitHub Actions budget get a red check that runs no steps — noise, not signal. scripts/local_ci.sh solves this by parsing .github/workflows/* at run time rather than maintaining a second copy of the gate. It selects the workflow matching the simulated event (default pull_request), expands the matrix as a cross product, and executes jobs and steps in order, so editing the workflow changes the local run with zero drift.
The script is honest about what it cannot reproduce and says so instead of guessing: sudo apt-get install becomes a local presence probe, ${{ secrets.* }}/uses: actions are skipped with a printed reason, and container: jobs run on the host. Its embedded Python includes a small indentation-based YAML reader that covers exactly the shape Actions files use and raises on anything it cannot parse. Exit status is 0 only when every executed step passes.
Sources: local_ci.sh
GYM Exercises: Forging the Operator
Section titled “GYM Exercises: Forging the Operator”The GYM system is a training ground and a gate. Its premise is that software should be something an operator must wield, not just use, so it forces a warmup phase (reflex-building reps) before any graded exercise, and opens a gate only when every rep is grown and every exercise passed. A mis-fire — an unexpected outcome rather than a clean failure — is recorded as a DROP CARD rather than silently swallowed.
flowchart TD S[Start run] --> W[Phase 1: Warmup reps] W -->|each rep verify| G{All reps grown?} G -->|no| X[Gate stays closed] G -->|yes| E[Phase 2: Graded exercises] E -->|wait for .submitted| V{All exercises pass?} V -->|yes| O[Write gate: open, exit 0] V -->|no| X X[Write gate: closed, exit 1]Two Consumers, One Paradigm
Section titled “Two Consumers, One Paradigm”A precise distinction matters here: the repo carries two GYM artifacts that share the paradigm but have different runners. The package-level zikzak_inappwebview/.gym/gym.yaml is a declarative artifact consumed by the external miki runner (gym.mjs), and it mirrors the shape established in the sibling zuraffa repo. The .specify/extensions/gym/ directory is a Spec Kit extension with its own gym-runner.mjs that loads .mjs modules exporting verify(ctx) and evaluate(sandbox). The package .gym uses declarative command:/verifyCommand: fields graded by exit code; the extension runner uses imperative module exports. Both implement the same warmup→exercise→gate contract.
The Package Curriculum
Section titled “The Package Curriculum”The zikzak_inappwebview gym defines three mandatory warmup reps and one graded exercise, all runnable headlessly with no emulator, device, or network. The reps escalate from dependency resolution to compilation to a live bridge round-trip, and the exercise proves the full message contract an operator actually codes against.
| ID | Phase | Command | Proves |
|---|---|---|---|
01-deps |
Warmup | dart run .gym/warmup/01-deps.dart |
flutter pub get resolves the federated graph; package_config.json references the root and a platform package |
02-build |
Warmup | dart run .gym/warmup/02-build.dart |
dart analyze lib/ reports zero errors (the plugin compiles) |
03-bridge-smoke |
Warmup | flutter test .gym/warmup/03-bridge-smoke_test.dart |
One evaluateJavascript round-trips through the public JavaScriptController facade on a faked platform |
js-bridge-round-trip |
Exercise | flutter test .gym/exercises/js_bridge_round_trip_test.dart |
Boot controller → register handler → window.zikzak_inappwebview.callHandler(...) → args cross unchanged, return value JSON-encodes back, handler removable |
The warmup reps are defensive about setup: 01-deps distinguishes a missing Flutter SDK (a setup error, exit with a clear message) from a genuine resolution failure, and flags a missing package_config.json as a mis-fire warranting a drop card. The exercise is a genuine dev task, not a re-skinned unit test — it drives the bridge through the same faked-platform pattern the repo’s own tests use, dispatching callHandler exactly the way the native Android/iOS bridges do.
Sources: gym.yaml, 01-deps.dart, js_bridge_round_trip_test.dart
The Extension Runner and the Gate
Section titled “The Extension Runner and the Gate”The Spec Kit extension registers five commands (speckit.gym.{init,run,warmup,gate,drop}) and an optional before_implement hook bound to speckit.gym.gate, so a host can block real work until the gate is open. The runner degrades gracefully: an empty curriculum treats the gate as open, a thrown verify/evaluate is a failure with the error reported, and a missing Node prints a clear requirement and exits non-zero. The gym.sh dispatcher locates Node and routes to gym-runner.mjs (or drop.mjs for drop cards). Sandbox and drop-card stores (.sandbox/, .drops/) are git-ignored and wiped between runs.
Sources: extension.yml, gym-runner.mjs, gym.sh, .gitignore
Publishing: The Lockstep Release
Section titled “Publishing: The Lockstep Release”Publishing is the most failure-prone stage because it mutates version numbers across a federated monorepo and pushes immutable artifacts to pub.dev. The governing rule is a HARD lockstep: every published package — including the Windows fork and OHOS — carries the exact same version as tool/versions.dart → packageVersion, and the only package allowed to differ is zikzak_inappwebview_module, which is publish_to: none. The single source of truth is tool/versions.dart, from which dart run tool/update_readmes.dart derives every README install snippet.
flowchart TD V[Edit tool/versions.dart] --> R[dart run tool/update_readmes.dart] R --> C[Update umbrella + root CHANGELOG] C --> F{Windows fork changed?} F -->|yes| FW[publish_windows_fork.sh] F -->|no| P[prepare_for_publish.sh X.Y.Z] FW --> P P --> PB[publish.sh: 8 packages in order] PB --> M[push_to_master.sh: merge + tag] M --> D[Restore dev setup by hand]The Script Chain
Section titled “The Script Chain”Each script owns one phase and refuses to proceed when a precondition is unmet. prepare_for_publish.sh creates a publish-X.Y.Z branch, refuses to run if any git-sourced dependency_overrides would be silently stripped, bumps versions across the 8 core packages, converts path: dependencies to caret constraints, and deletes the entire dependency_overrides section. publish.sh walks the packages in dependency order, and for each one checks pub.dev for an existing version, verifies every internal dependency is resolvable (retrying 30×30s for propagation), runs flutter pub get, dart format lib/, flutter analyze --no-fatal-infos, a dry-run, then flutter pub publish -f.
| Script | Phase | Key behavior |
|---|---|---|
publish_windows_fork.sh |
Pre-publish (fork) | Dry-run then publish the fork; refuses to republish an existing pub.dev version |
prepare_for_publish.sh <version> |
Prepare | Branch, guard against git overrides, bump 8 versions, path→versioned, strip overrides, changelogs, commit |
publish.sh |
Publish | 8 packages in dependency order; per-package pub.dev check, dep resolution retry, format, analyze, dry-run, publish, git tag |
push_to_master.sh |
Post-publish | Merge publish branch to master, create/push tag, delete branch |
restore_dev_setup.sh |
Restore | Rewrites path: deps — do not finish with this (emits invalid_dependency) |
revert_publish_changes.sh |
Revert | Discard publish changes, checkout target branch, restore dev |
Publish Order and the Propagation Tax
Section titled “Publish Order and the Propagation Tax”Order is not cosmetic: the fork must be live before the Windows facade resolves it, and platform_interface before any platform package. The full order is fork → platform_interface → android → ios → web → macos → windows → linux → umbrella zikzak_inappwebview → ohos last. Because pub.dev takes up to ~10 minutes to propagate each new version before dependents can resolve it, and nine packages publish sequentially, publish.sh needs a 20-minute timeout (timeout_ms: 1200000). Two operational hazards are documented inline: restore_dev_setup.sh writes path: under dependencies: which makes every publishable package emit invalid_dependency (a red CI build) — restore by hand with dependency_overrides: blocks instead; and HTTPS_PROXY breaks pub only inside an opencode session, so run pub-touching scripts with env -u HTTPS_PROXY -u https_proxy there and nowhere else.
Sources: PUBLISH.md, PUBLISH.md, versions.dart, prepare_for_publish.sh, publish.sh, publish_windows_fork.sh
Where the Grep Gate Fits
Section titled “Where the Grep Gate Fits”One more structural guard belongs to this delivery story: scripts/grep_gate.sh is the automated enforcement of the two-tier core/module split (spec 003, FR-006). It fails if any intelligence-layer identifier (WebViewPool, CassetteEngine, RecipePort, …) appears in the plugin core, with a carve-out for raw capture-event plumbing, and it also fails if the module imports platform_interface directly. This gate protects the architectural boundary that the Two-Tier Core/Module Split and the Grep Gate page describes in depth, and it is the kind of structural invariant that belongs beside CI rather than in it.
Sources: grep_gate.sh
Recommended Reading Progression
Section titled “Recommended Reading Progression”Having traced how changes are verified, forged, and shipped, continue with the practices that feed this pipeline: Testing Strategy and Per-Package Commands for the test surfaces CI and GYM both draw on, and Spec-Kit Specification and TDD Workflow for how specs and TDD produce the tasks that GYM exercises are carved from. For the architecture the grep gate protects, see Two-Tier Core/Module Split and the Grep Gate; for the version-generation machinery that publishing depends on, see Zorphy Entity Model Layer and Code Generation.