ALFMOB-362: speed up iOS CI/CD workflow#73
Merged
Conversation
Lets CI cache compiled Swift artefacts under a repo-local path keyed on Package.resolved. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Delete the setup job; downstream jobs install brew/bundler themselves - Cache repo-local build/DerivedData in unit-tests keyed on Package.resolved, so AlfieKit + Firebase SPM compile artefacts survive between PR runs - Bump actions/checkout, actions/cache, actions/upload-artifact to v5 (clears June 2026 Node 24 deprecation warnings) - Drop 'brew update'; rely on the runner's pre-installed Homebrew - Upload test-results artefact on failure only - Skip workflow on doc-only PRs (paths-ignore for *.md and Docs/) Release job retains GYM_CLEAN=true and does not cache DerivedData; its win is only from removing setup + brew update overhead. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR optimizes the Alfie CI/CD GitHub Actions workflow by removing redundant orchestration and adding caching aimed at reducing CI wall time for pull requests, primarily by reusing compiled Xcode outputs between runs.
Changes:
- Removes the dedicated
setupjob and consolidates dependency setup intounit-tests/release. - Adds Xcode DerivedData caching for the
unit-testsjob and pinsscan’s derived data path to a predictable repo-local directory. - Updates GitHub Actions dependencies (checkout/cache/upload-artifact) to v5 (SHA-pinned) and reduces artifact uploading to failure-only for test results.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
fastlane/.env.default |
Pins scan DerivedData output directory to build/DerivedData to align with CI caching. |
.github/workflows/alfie.yml |
Restructures jobs, updates action versions, adds DerivedData caching, and refines workflow triggers/artifact upload behavior. |
Comments suppressed due to low confidence (2)
.github/workflows/alfie.yml:76
- After removing the
setupjob, the workflow no longer installs the Bundler version pinned inGemfile.lock(BUNDLED WITH 2.6.9). Relying on the runner’s preinstalled Bundler can breakbundle installwhen the image Bundler version drifts. Add an explicit step to install/use the lockfile’s Bundler version before runningbundle install.
- name: Install Ruby dependencies
run: |
bundle config set --local path 'vendor/bundle'
bundle install --jobs 4 --retry 3
.github/workflows/alfie.yml:154
- Same Bundler concern in the release job:
bundle installis run without first ensuring theGemfile.lockBundler version (2.6.9) is installed/used. This can cause release deployments to fail depending on the runner image. Install/use the pinned Bundler version beforebundle install.
- name: Configure Bundler
run: |
bundle config set --local path 'vendor/bundle'
bundle install --jobs 4 --retry 3
Trailing newline in AlfieApp.swift — invalidates nothing the cache keys on (Package.resolved unchanged), so unit-tests should hit the DerivedData cache restored from the previous run. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The Xcode project has its own SwiftPM lockfile at Alfie/Alfie.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved which is separate from AlfieKit/Package.resolved. Without it in the cache key, changes to project-level SwiftPM dependencies would not invalidate the SPM or DerivedData caches, risking stale artefacts. 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
Cuts PR wall time on
Alfie CI/CDby caching compiled Swift artefacts inunit-testsand trimming wasted setup/orchestration across the workflow. Target: PR runs under ~6 min on a warm cache (baseline ~10 min).Jira: ALFMOB-362
Changes
setupjob. macOS runners are ephemeral; downstream jobs already install brew/bundler themselves, so the job was ~1 min of orchestration for no net benefit.unit-testsat a repo-local path (build/DerivedData), keyed onPackage.resolvedwith a broadrestore-keysfallback. This is the main win — AlfieKit + the full Firebase SDK graph no longer recompile from scratch every PR.SCAN_DERIVED_DATA_PATHinfastlane/.env.defaultso the cache directory is predictable and tightly scoped.actions/checkout,actions/cache,actions/upload-artifact), SHA-pinned. Clears the June 2026 Node 24 deprecation warnings.brew update. Brewfile is two formulas (git-secret,xcbeautify); the pre-installed Homebrew onmacos-26is recent enough.paths-ignorefor**/*.mdandDocs/**.push:tomainis intentionally unfiltered.Out of scope
GYM_CLEAN=trueis retained on thereleasejob for build safety.gymwipes the build dir on every invocation, soreleasecannot benefit from a compiled-output cache; its savings here come only from the removedsetupjob andbrew update. The original ticket bullet "release no longer recompiles the full SPM graph when Package.resolved is unchanged" will not be met as-is — flagging for the reporter to renegotiate or split.scan(parallel-testing-enabled) — left for a follow-up once parallel-safety is confirmed across the test suite.Test plan
Run Testsmaterially faster than the cold run and faster than the ~9m11s reference baseline.unit-testslogs show a cache hit onCache Xcode DerivedData.test-resultsartefact; failing run still uploads xcresult + junit.mainand confirmreleasestill builds and deploys to TestFlight as before (no regression — this PR doesn't change release behaviour materially).🤖 Generated with Claude Code