Skip to content

Commit c1130da

Browse files
ALFMOB-362: speed up iOS CI/CD workflow (#73)
* ALFMOB-362: pin scan DerivedData path to build/DerivedData 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> * ALFMOB-362: speed up iOS CI workflow - 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> * ALFMOB-362: whitespace-only commit to test warm-cache CI run 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> * ALFMOB-362: include Xcode project Package.resolved in cache keys 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> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b141b71 commit c1130da

3 files changed

Lines changed: 39 additions & 46 deletions

File tree

.github/workflows/alfie.yml

Lines changed: 37 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
pull_request:
99
branches:
1010
- "main"
11+
paths-ignore:
12+
- "**/*.md"
13+
- "Docs/**"
1114

1215
workflow_dispatch:
1316

@@ -20,15 +23,15 @@ env:
2023
SPM_CLONED_DEPENDENCIES_PATH: "/tmp/SourcePackages"
2124

2225
jobs:
23-
setup:
26+
unit-tests:
2427
runs-on: macos-26
25-
timeout-minutes: 15
28+
timeout-minutes: 30
2629
steps:
2730
- name: Checkout Code
28-
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
31+
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
2932

3033
- name: Cache Homebrew
31-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
34+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
3235
with:
3336
path: |
3437
~/Library/Caches/Homebrew
@@ -37,36 +40,8 @@ jobs:
3740
restore-keys: |
3841
brew-${{ runner.os }}-
3942
40-
- name: Cache Ruby Gems
41-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
42-
with:
43-
path: vendor/bundle
44-
key: gems-${{ runner.os }}-${{ hashFiles('Gemfile', 'Gemfile.lock') }}
45-
restore-keys: |
46-
gems-${{ runner.os }}-${{ hashFiles('Gemfile') }}-
47-
gems-${{ runner.os }}-
48-
49-
- name: Install Homebrew formulas
50-
run: |
51-
brew update
52-
brew bundle install
53-
54-
- name: Install Ruby dependencies
55-
run: |
56-
gem install bundler --no-document
57-
bundle config set --local path 'vendor/bundle'
58-
bundle install --jobs 4 --retry 3
59-
60-
unit-tests:
61-
needs: setup
62-
runs-on: macos-26
63-
timeout-minutes: 30
64-
steps:
65-
- name: Checkout Code
66-
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
67-
6843
- name: Restore Ruby Gems
69-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
44+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
7045
with:
7146
path: vendor/bundle
7247
key: gems-${{ runner.os }}-${{ hashFiles('Gemfile', 'Gemfile.lock') }}
@@ -75,18 +50,25 @@ jobs:
7550
gems-${{ runner.os }}-
7651
7752
- name: Restore Swift Package Manager Cache
78-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
53+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
7954
with:
8055
path: |
8156
~/Library/Caches/org.swift.swiftpm
8257
${{ env.SPM_CLONED_DEPENDENCIES_PATH }}
83-
key: spm-${{ runner.os }}-${{ hashFiles('Alfie/AlfieKit/Package.swift', 'Alfie/AlfieKit/Package.resolved') }}
58+
key: spm-${{ runner.os }}-${{ hashFiles('Alfie/AlfieKit/Package.swift', 'Alfie/AlfieKit/Package.resolved', 'Alfie/Alfie.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved') }}
8459
restore-keys: |
8560
spm-${{ runner.os }}-
8661
62+
- name: Cache Xcode DerivedData
63+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
64+
with:
65+
path: build/DerivedData
66+
key: derived-${{ runner.os }}-${{ hashFiles('Alfie/AlfieKit/Package.resolved', 'Alfie/Alfie.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved') }}
67+
restore-keys: |
68+
derived-${{ runner.os }}-
69+
8770
- name: Install Homebrew formulas
88-
run: |
89-
brew bundle install
71+
run: brew bundle install
9072

9173
- name: Install Ruby dependencies
9274
run: |
@@ -116,8 +98,8 @@ jobs:
11698
BUILD_CONFIGURATION: "Debug"
11799

118100
- name: Upload Test Results
119-
if: always()
120-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
101+
if: failure()
102+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
121103
with:
122104
name: test-results
123105
path: |
@@ -126,16 +108,26 @@ jobs:
126108
retention-days: 7
127109

128110
release:
129-
needs: [setup, unit-tests]
111+
needs: [unit-tests]
130112
runs-on: macos-26
131113
timeout-minutes: 60
132114
if: github.event_name == 'push'
133115
steps:
134116
- name: Checkout Code
135-
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
117+
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
118+
119+
- name: Cache Homebrew
120+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
121+
with:
122+
path: |
123+
~/Library/Caches/Homebrew
124+
/usr/local/Homebrew
125+
key: brew-${{ runner.os }}-${{ hashFiles('Brewfile') }}
126+
restore-keys: |
127+
brew-${{ runner.os }}-
136128
137129
- name: Restore Ruby Gems
138-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
130+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
139131
with:
140132
path: vendor/bundle
141133
key: gems-${{ runner.os }}-${{ hashFiles('Gemfile', 'Gemfile.lock') }}
@@ -144,18 +136,17 @@ jobs:
144136
gems-${{ runner.os }}-
145137
146138
- name: Restore Swift Package Manager Cache
147-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
139+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
148140
with:
149141
path: |
150142
~/Library/Caches/org.swift.swiftpm
151143
${{ env.SPM_CLONED_DEPENDENCIES_PATH }}
152-
key: spm-${{ runner.os }}-${{ hashFiles('Alfie/AlfieKit/Package.swift', 'Alfie/AlfieKit/Package.resolved') }}
144+
key: spm-${{ runner.os }}-${{ hashFiles('Alfie/AlfieKit/Package.swift', 'Alfie/AlfieKit/Package.resolved', 'Alfie/Alfie.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved') }}
153145
restore-keys: |
154146
spm-${{ runner.os }}-
155147
156148
- name: Install Homebrew formulas
157-
run: |
158-
brew bundle install
149+
run: brew bundle install
159150

160151
- name: Configure Bundler
161152
run: |

Alfie/Alfie/AlfieApp.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,4 @@ struct AlfieApp: App {
7171
appDelegate.serviceProvider.deepLinkService.openUrls([url])
7272
}
7373
}
74+

fastlane/.env.default

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ SCAN_TESTPLAN=${TESTPLAN}
4040
SCAN_OUTPUT_DIRECTORY=${ARTIFACTS_PATH}
4141
SCAN_XCARGS=${EXTRA_XCARGS}
4242
SCAN_RESULT_BUNDLE=true
43+
SCAN_DERIVED_DATA_PATH="${ROOT_PATH}/build/DerivedData"
4344

4445
#######################################################################
4546
# match (https://github.com/fastlane/fastlane/blob/master/match/lib/match/options.rb)

0 commit comments

Comments
 (0)