Skip to content

ALFMOB-362: speed up iOS CI/CD workflow#73

Merged
amccall-mindera merged 4 commits into
mainfrom
ALFMOB-362-ios-ci-cache-build
May 20, 2026
Merged

ALFMOB-362: speed up iOS CI/CD workflow#73
amccall-mindera merged 4 commits into
mainfrom
ALFMOB-362-ios-ci-cache-build

Conversation

@amccall-mindera
Copy link
Copy Markdown
Contributor

@amccall-mindera amccall-mindera commented May 20, 2026

Summary

Cuts PR wall time on Alfie CI/CD by caching compiled Swift artefacts in unit-tests and trimming wasted setup/orchestration across the workflow. Target: PR runs under ~6 min on a warm cache (baseline ~10 min).

Jira: ALFMOB-362

Changes

  • Delete setup job. macOS runners are ephemeral; downstream jobs already install brew/bundler themselves, so the job was ~1 min of orchestration for no net benefit.
  • Cache Xcode DerivedData in unit-tests at a repo-local path (build/DerivedData), keyed on Package.resolved with a broad restore-keys fallback. This is the main win — AlfieKit + the full Firebase SDK graph no longer recompile from scratch every PR.
  • Pin scan derived-data path via SCAN_DERIVED_DATA_PATH in fastlane/.env.default so the cache directory is predictable and tightly scoped.
  • Bump GitHub Actions to v5 (actions/checkout, actions/cache, actions/upload-artifact), SHA-pinned. Clears the June 2026 Node 24 deprecation warnings.
  • Drop brew update. Brewfile is two formulas (git-secret, xcbeautify); the pre-installed Homebrew on macos-26 is recent enough.
  • Test-results artefact on failure only. Stops uploading xcresult bundles on green runs.
  • Skip workflow on doc-only PRs via paths-ignore for **/*.md and Docs/**. push: to main is intentionally unfiltered.

Out of scope

  • GYM_CLEAN=true is retained on the release job for build safety. gym wipes the build dir on every invocation, so release cannot benefit from a compiled-output cache; its savings here come only from the removed setup job and brew 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.
  • Parallel testing in scan (parallel-testing-enabled) — left for a follow-up once parallel-safety is confirmed across the test suite.

Test plan

  • First run (cold cache) completes successfully — establish baseline.
  • Second push (e.g. trivial whitespace) shows Run Tests materially faster than the cold run and faster than the ~9m11s reference baseline.
  • PR wall time on the warm-cache run is under ~6 min.
  • unit-tests logs show a cache hit on Cache Xcode DerivedData.
  • No deprecated-action annotations in the run.
  • Push a docs-only commit (e.g. README tweak) on a PR branch and confirm the workflow does not trigger.
  • Green run produces no test-results artefact; failing run still uploads xcresult + junit.
  • Merge to main and confirm release still builds and deploys to TestFlight as before (no regression — this PR doesn't change release behaviour materially).

🤖 Generated with Claude Code

amccall-mindera and others added 2 commits May 20, 2026 22:30
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>
Copilot AI review requested due to automatic review settings May 20, 2026 21:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 setup job and consolidates dependency setup into unit-tests / release.
  • Adds Xcode DerivedData caching for the unit-tests job and pins scan’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 setup job, the workflow no longer installs the Bundler version pinned in Gemfile.lock (BUNDLED WITH 2.6.9). Relying on the runner’s preinstalled Bundler can break bundle install when the image Bundler version drifts. Add an explicit step to install/use the lockfile’s Bundler version before running bundle 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 install is run without first ensuring the Gemfile.lock Bundler 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 before bundle install.
      - name: Configure Bundler
        run: |
          bundle config set --local path 'vendor/bundle'
          bundle install --jobs 4 --retry 3

Comment thread .github/workflows/alfie.yml
Comment thread .github/workflows/alfie.yml Outdated
amccall-mindera and others added 2 commits May 20, 2026 23:00
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>
@amccall-mindera amccall-mindera merged commit c1130da into main May 20, 2026
3 checks passed
@amccall-mindera amccall-mindera deleted the ALFMOB-362-ios-ci-cache-build branch May 20, 2026 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants