CI: share iOS port build across iOS workflows via reusable workflow#4837
Merged
shai-almog merged 1 commit intomasterfrom May 1, 2026
Merged
CI: share iOS port build across iOS workflows via reusable workflow#4837shai-almog merged 1 commit intomasterfrom
shai-almog merged 1 commit intomasterfrom
Conversation
Contributor
|
Developer Guide build artifacts are available for download from this workflow run:
Developer Guide quality checks: |
Contributor
✅ Continuous Quality ReportTest & Coverage
Static Analysis
Generated automatically by the PR CI workflow. |
Contributor
Cloudflare Preview
|
Contributor
✅ ByteCodeTranslator Quality ReportTest & Coverage
Benchmark Results
Static Analysis
Generated automatically by the PR CI workflow. |
Collaborator
|
Compared 85 screenshots: 85 matched. Benchmark Results
Build and Run Timing
Detailed Performance Metrics
|
Introduces a reusable workflow .github/workflows/_build-ios-port.yml (workflow_call) that runs scripts/setup-workspace.sh and scripts/build-ios-port.sh once per workflow run. The three iOS workflows (scripts-ios.yml, scripts-ios-native.yml, ios-packaging.yml) now have two jobs each: a build-port job that calls the reusable workflow, and the existing test job which "needs: build-port" and restores the populated caches. A new "cn1-built" cache stores the built CN1 + iOS port artifacts (~/.m2/repository/com/codenameone, Themes, Ports/iOSPort/nativeSources) keyed on a composite hash of: - CN1 / iOS port / VM Java/native source files - All pom.xml files - setup-workspace.sh / build-ios-port.sh / build-native-themes.sh / the reusable workflow itself There are no restore-keys on this cache (exact match only) so a stale artifact set never satisfies a different source state. On cache hit the build-port job skips both setup-workspace and build-ios-port and finishes in ~1-2 min instead of ~30 min. Cross-workflow benefit: the cn1-built cache is keyed only on the composite source hash, so the first iOS workflow that runs on a PR populates it and the other two skip their builds. On the same PR this typically saves ~2x ~30 min macOS minutes. Within ios-packaging.yml the matrix entries are now 3 small jobs that just restore caches and run build-ios-app + tests, replacing the prior 3 full duplicate pipelines. Also fixes a self-trigger bug in parparvm-tests.yml: changes to the workflow file itself didn't trigger a CI run because the paths filter omitted .github/workflows/parparvm-tests.yml. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
13c6c34 to
c349fb0
Compare
liannacasper
pushed a commit
that referenced
this pull request
May 1, 2026
…llow-up) #4837 (d119e5b) split the iOS port build into a reusable workflow whose output is consumed by build-ios via the cn1-built cache. build-ios-metal was still running setup-workspace.sh + build-ios-port.sh inline, costing ~12 minutes of redundant work per PR even though the source SHA matches what build-port already cached. Add the same cache-restore steps build-ios uses: - needs: build-port so the cache is populated before the Metal job starts - Compute CN1 source hash + setup-workspace hash (same formulas as the reusable workflow + build-ios) - Cache codenameone-tools, Maven repository, cn1-binaries, CocoaPods/gems - Restore the cn1-built bundle (~/.m2/repository/com/codenameone, Themes, Ports/iOSPort/nativeSources) with fail-on-cache-miss so a missed cache surfaces immediately rather than re-running the full build Drops Setup workspace + Build iOS port from the Metal job (the cache restore covers both). Timeout reduced from 60 to 45 minutes since the remaining work is the sample-app build + Metal UI test run, both of which fit under 30 minutes already. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The biggest remaining iOS performance gap from the original audit: the iOS port is built from scratch in every iOS workflow on every PR (5 builds across
scripts-ios.yml,scripts-ios-native.yml, andios-packaging.yml's 3-row matrix). This PR makes that build run at most once per workflow run, and shares the result across workflows when source hasn't changed.How
A new reusable workflow
.github/workflows/_build-ios-port.yml(workflow_call) runs setup-workspace + build-ios-port. Each of the 3 iOS workflows now has 2 jobs:The test job just restores the populated caches and runs
build-ios-app.sh+ tests. It usesactions/cache/restore@v4withfail-on-cache-miss: trueso a missing cache is a clear error, not silent regression.The cache that does the heavy lifting
A new
cn1-builtcache stores the built CN1 + iOS port artifacts:~/.m2/repository/com/codenameoneThemes/Ports/iOSPort/nativeSources/Keyed on a composite hash of:
CodenameOne/src,Ports/iOSPort,vm/JavaAPI,vm/ByteCodeTranslator,Themes/pom.xmlsetup-workspace.sh,build-ios-port.sh,build-native-themes.sh, and the reusable workflow itselfNo
restore-keys— exact match only. A stale artifact set never satisfies a different source state.The cn1-built cache is restored after the broader
~/.m2/repositorycache so it overwrites any stalecom/codenameone/subtree pulled in by the POM-keyed m2 cache.On cache hit,
build-portskips bothsetup-workspaceandbuild-ios-portand the job finishes in ~1–2 min instead of ~30 min. The 3 test jobs then restore the cache and run.Cross-workflow benefit (the M6 part)
The
cn1-built-${runner.os}-${source-hash}cache key is identical across all 3 iOS workflows. When scripts-ios.yml runs first on a PR and populates the cache, ios-packaging.yml and scripts-ios-native.yml later in the same PR cache-hit and skip their entire iOS port rebuild.A PR that doesn't touch CN1 / iOS port source at all will hit the cache from master's last successful run.
Expected savings
Rough timings:
So the warm-cache path (the common case for typical PRs) goes from ~37 min wall-clock to ~12 min, and three iOS workflows on the same PR collectively go from ~3 × 33 min to ~33 + 12 + 12 min.
Bonus: parparvm-tests.yml self-trigger bug
parparvm-tests.yml'spaths:filter didn't include itself, so my changes to that workflow in #4836 never actually triggered the workflow's own validation. Fixed by adding.github/workflows/parparvm-tests.ymlto itspaths:list.Risks / things to watch
fail-on-cache-miss: trueon the test jobs. If the cn1-built cache somehow doesn't survive the build-port → test-job handoff (e.g., GitHub cache eviction in the seconds between jobs), the test jobs fail loudly. This is intentional — silent fall-through could mask a problem.concurrency:group (mac-ios-port-${{ github.workflow }}-${{ github.ref_name }}) so a new push cancels the in-flight build-port too.Test plan
yaml.safe_load).build-portdoes the full build, test jobs find the cn1-built cache and skip ahead tobuild-ios-app.sh..github/workflows/parparvm-tests.yml, which is now in the paths filter).Out of scope (kept as future work)
pr.yml.push:triggers on test-only workflows.🤖 Generated with Claude Code