Skip to content

Commit 6aab388

Browse files
authored
Improve CI (#173)
1 parent da13f67 commit 6aab388

File tree

5 files changed

+88
-45
lines changed

5 files changed

+88
-45
lines changed

.github/workflows/main.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ on:
77
- 'docs/**'
88
- '**/*.md'
99
concurrency:
10-
group: main-${{ github.ref }}
11-
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
10+
group: main_${{ github.ref }}
11+
cancel_in_progress: ${{ github.ref != 'refs/heads/master' }}
1212
jobs:
13-
warm-up-release-app-cache:
13+
warm_up_release_app_cache:
1414
runs-on: macos-26
1515
timeout-minutes: 60
1616
steps:
@@ -31,7 +31,7 @@ jobs:
3131
uses: actions/cache@v4
3232
with:
3333
path: local-server/node_modules
34-
key: ${{ runner.os }}-npm-modules-${{ hashFiles('local-server/yarn.lock') }}
34+
key: ${{ runner.os }}_npm_modules_${{ hashFiles('local-server/yarn.lock') }}
3535
- name: Install node dependencies
3636
run: cd local-server && yarn install && yarn build && yarn copy-to-app
3737
# See https://github.com/actions/runner-images/issues/10722#issuecomment-2387952421
@@ -55,4 +55,4 @@ jobs:
5555
uses: actions/cache/save@v4
5656
with:
5757
path: app/build/derived_data
58-
key: ${{ runner.os }}-app-derived-data-main
58+
key: ${{ runner.os }}_app_derived_data_main

.github/workflows/pr.yml

Lines changed: 78 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@ on:
77
- 'docs/**'
88
- '**/*.md'
99
concurrency:
10-
group: integration-tests-${{ github.ref }}
11-
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
10+
group: integration_tests_${{ github.ref }}
11+
cancel_in_progress: ${{ github.ref != 'refs/heads/master' }}
1212
jobs:
13-
detect-app-changes:
13+
detect_changes:
1414
runs-on: ubuntu-latest
1515
outputs:
1616
app: ${{ steps.filter.outputs.app }}
17+
xcode_config: ${{ steps.filter.outputs.xcode_config }}
18+
app_tools: ${{ steps.filter.outputs.app_tools }}
19+
local_server: ${{ steps.filter.outputs.local_server }}
1720
steps:
1821
- uses: actions/checkout@v4
1922
- uses: dorny/paths-filter@v3
@@ -22,11 +25,18 @@ jobs:
2225
filters: |
2326
app:
2427
- 'app/**'
25-
build-release-app:
28+
xcode_config:
29+
- 'app/**/*.xcconfig'
30+
- 'app/**/*.xcodeproj/**'
31+
app_tools:
32+
- 'app/tools/**'
33+
local_server:
34+
- 'local-server/**'
35+
build_release_app:
2636
runs-on: macos-26
2737
timeout-minutes: 60
28-
needs: detect-app-changes
29-
if: ${{ needs.detect-app-changes.outputs.app == 'true' }}
38+
needs: detect_changes
39+
if: ${{ needs.detect_changes.outputs.app == 'true' }}
3040
steps:
3141
- name: MacOS version
3242
run: sw_vers
@@ -45,7 +55,7 @@ jobs:
4555
uses: actions/cache@v4
4656
with:
4757
path: local-server/node_modules
48-
key: ${{ runner.os }}-npm-modules-${{ hashFiles('local-server/yarn.lock') }}
58+
key: ${{ runner.os }}_npm_modules_${{ hashFiles('local-server/yarn.lock') }}
4959
- name: Install node dependencies
5060
run: cd local-server && yarn install && yarn build && yarn copy-to-app
5161
# See https://github.com/actions/runner-images/issues/10722#issuecomment-2387952421
@@ -55,15 +65,17 @@ jobs:
5565
username: oauth2
5666
password: ${{ secrets.GITHUB_TOKEN }}
5767
- name: Load derived data & SPM cache
58-
uses: actions/cache/restore@v4
68+
uses: actions/cache@v4
5969
with:
6070
path:
6171
app/build/derived_data
6272
app/modules/.build
6373
~/Library/Caches/org.swift.swiftpm
6474
~/Library/org.swift.swiftpm
6575
~/Library/Developer/Xcode/DerivedData/**/SourcePackages/
66-
key: ${{ runner.os }}-app-derived-data-main
76+
key: ${{ runner.os }}_app_derived_data_${{ hashFiles('app/modules/Package.swift', 'app/modules/Package.resolved') }}
77+
restore-keys: |
78+
${{ runner.os }}_app_derived_data_
6779
- name: Install fastlane dependencies
6880
run: |
6981
cd app/fastlane && gem install bundler && bundle install
@@ -87,11 +99,11 @@ jobs:
8799
exit 1
88100
fi
89101
90-
test-swift:
102+
test_swift_app:
91103
runs-on: macos-26
92104
timeout-minutes: 60
93-
needs: detect-app-changes
94-
if: ${{ needs.detect-app-changes.outputs.app == 'true' }}
105+
needs: detect_changes
106+
if: ${{ needs.detect_changes.outputs.app == 'true' }}
95107
steps:
96108
- name: MacOS version
97109
run: sw_vers
@@ -110,7 +122,7 @@ jobs:
110122
uses: actions/cache@v4
111123
with:
112124
path: local-server/node_modules
113-
key: ${{ runner.os }}-npm-modules-${{ hashFiles('local-server/yarn.lock') }}
125+
key: ${{ runner.os }}_npm_modules_${{ hashFiles('local-server/yarn.lock') }}
114126
- name: Install dependencies
115127
run: cd local-server && yarn install && yarn build && yarn copy-to-app
116128
- name: Load SPM cache
@@ -121,23 +133,50 @@ jobs:
121133
~/Library/Caches/org.swift.swiftpm
122134
~/Library/org.swift.swiftpm
123135
~/Library/Developer/Xcode/DerivedData/**/SourcePackages/
124-
key: ${{ runner.os }}-spm-app-modules-${{ hashFiles('app/modules/Package.swift') }}
136+
key: ${{ runner.os }}_spm_app_modules_${{ hashFiles('app/modules/Package.swift', 'app/modules/Package.resolved') }}
125137
restore-keys: |
126-
${{ runner.os }}-spm-app-modules-
127-
- name: Run tests
138+
${{ runner.os }}_spm_app_modules_
139+
- name: Run app module tests
128140
run: ./cmd.sh test:swift
129141

130-
lint-swift:
142+
test_app_tools:
143+
runs-on: macos-26
144+
timeout-minutes: 60
145+
needs: detect_changes
146+
if: ${{ needs.detect_changes.outputs.app_tools == 'true' }}
147+
steps:
148+
- name: MacOS version
149+
run: sw_vers
150+
- uses: actions/checkout@v4
151+
- uses: gsabran/setup-swift@main
152+
with:
153+
swift-version: "6.2"
154+
soft-fail-version-check: true
155+
- name: Load SPM cache
156+
uses: actions/cache@v4
157+
with:
158+
path:
159+
app/tools/dependencies/.build
160+
~/Library/Caches/org.swift.swiftpm
161+
~/Library/org.swift.swiftpm
162+
~/Library/Developer/Xcode/DerivedData/**/SourcePackages/
163+
key: ${{ runner.os }}_spm_dependencies_tool_${{ hashFiles('app/tools/dependencies/Package.swift') }}
164+
restore-keys: |
165+
${{ runner.os }}_spm_dependencies_tool_
166+
- name: Run app tools tests
167+
run: cd app/tools/dependencies && swift test
168+
169+
lint_swift:
131170
runs-on: macos-26
132171
timeout-minutes: 60
133-
needs: detect-app-changes
134-
if: ${{ needs.detect-app-changes.outputs.app == 'true' }}
172+
needs: detect_changes
173+
if: ${{ needs.detect_changes.outputs.app == 'true' }}
135174
steps:
136175
- name: MacOS version
137176
run: sw_vers
138177
- uses: actions/checkout@v4
139178
- name: Set up Homebrew
140-
id: set-up-homebrew
179+
id: set_up_homebrew
141180
uses: Homebrew/actions/setup-homebrew@master
142181
- name: Install swiftformat
143182
run: brew install swiftformat
@@ -146,11 +185,11 @@ jobs:
146185
- name: Verify that `cmd lint:swift` did not change outputs (if it did, please re-run it and re-commit!)
147186
run: git diff --exit-code
148187

149-
sync-app-dependencies:
188+
sync_app_dependencies:
150189
runs-on: macos-26
151190
timeout-minutes: 60
152-
needs: detect-app-changes
153-
if: ${{ needs.detect-app-changes.outputs.app == 'true' }}
191+
needs: detect_changes
192+
if: ${{ needs.detect_changes.outputs.app == 'true' }}
154193
steps:
155194
- name: MacOS version
156195
run: sw_vers
@@ -160,23 +199,25 @@ jobs:
160199
swift-version: "6.2"
161200
soft-fail-version-check: true
162201
- name: Set up Homebrew
163-
id: set-up-homebrew
202+
id: set_up_homebrew
164203
uses: Homebrew/actions/setup-homebrew@master
165204
- name: Install swiftformat
166205
run: brew install swiftformat
167206
- name: Cache dependencies binary
168207
uses: actions/cache@v4
169208
with:
170209
path: app/tools/dependencies/tmp/bin
171-
key: ${{ runner.os }}-spm-tools-${{ hashFiles('app/tools/dependencies/**') }}
210+
key: ${{ runner.os }}_spm_tools_${{ hashFiles('app/tools/dependencies/**') }}
172211
- name: Run sync dependencies
173212
run: ./cmd.sh sync:dependencies
174213
- name: Verify that `cmd sync:dependencies` did not change outputs (if it did, please re-run it and re-commit!)
175214
run: git diff --exit-code
176215

177-
test-node:
216+
test_node:
178217
runs-on: macos-26
179218
timeout-minutes: 60
219+
needs: detect_changes
220+
if: ${{ needs.detect_changes.outputs.local_server == 'true' }}
180221
steps:
181222
- name: MacOS version
182223
run: sw_vers
@@ -188,7 +229,7 @@ jobs:
188229
uses: actions/cache@v4
189230
with:
190231
path: local-server/node_modules
191-
key: ${{ runner.os }}-npm-modules-${{ hashFiles('local-server/yarn.lock') }}
232+
key: ${{ runner.os }}_npm_modules_${{ hashFiles('local-server/yarn.lock') }}
192233
- name: Install dependencies
193234
run: cd local-server && yarn install
194235
- name: Run tests
@@ -197,6 +238,8 @@ jobs:
197238
tsc:
198239
runs-on: macos-26
199240
timeout-minutes: 60
241+
needs: detect_changes
242+
if: ${{ needs.detect_changes.outputs.local_server == 'true' }}
200243
steps:
201244
- name: MacOS version
202245
run: sw_vers
@@ -208,15 +251,17 @@ jobs:
208251
uses: actions/cache@v4
209252
with:
210253
path: local-server/node_modules
211-
key: ${{ runner.os }}-npm-modules-${{ hashFiles('local-server/yarn.lock') }}
254+
key: ${{ runner.os }}_npm_modules_${{ hashFiles('local-server/yarn.lock') }}
212255
- name: Install dependencies
213256
run: cd local-server && yarn install
214257
- name: Run tests
215258
run: cd local-server && yarn tsc
216259

217-
lint-node:
260+
lint_node:
218261
runs-on: macos-26
219262
timeout-minutes: 60
263+
needs: detect_changes
264+
if: ${{ needs.detect_changes.outputs.local_server == 'true' }}
220265
steps:
221266
- name: MacOS version
222267
run: sw_vers
@@ -228,23 +273,23 @@ jobs:
228273
uses: actions/cache@v4
229274
with:
230275
path: local-server/node_modules
231-
key: ${{ runner.os }}-npm-modules-${{ hashFiles('local-server/yarn.lock') }}
276+
key: ${{ runner.os }}_npm_modules_${{ hashFiles('local-server/yarn.lock') }}
232277
- name: Install dependencies
233278
run: cd local-server && yarn install
234279
- name: Run linter
235280
run: ./cmd.sh lint:ts
236281
- name: Verify that `cmd lint:ts` did not change outputs (if it did, please re-run it and re-commit!)
237282
run: git diff --exit-code
238283

239-
lint-shell:
284+
lint_shell:
240285
runs-on: macos-26
241286
timeout-minutes: 60
242287
steps:
243288
- name: MacOS version
244289
run: sw_vers
245290
- uses: actions/checkout@v4
246291
- name: Set up Homebrew
247-
id: set-up-homebrew
292+
id: set_up_homebrew
248293
uses: Homebrew/actions/setup-homebrew@master
249294
- name: Install shfmt
250295
run: brew install shfmt
@@ -253,7 +298,7 @@ jobs:
253298
- name: Verify that `cmd lint:shell` did not change outputs (if it did, please re-run it and re-commit!)
254299
run: git diff --exit-code
255300

256-
lint-ruby:
301+
lint_ruby:
257302
runs-on: macos-26
258303
timeout-minutes: 60
259304
steps:

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ on:
44
workflow_dispatch:
55
permissions:
66
contents: write
7-
pull-requests: write
7+
pull_requests: write
88
jobs:
9-
distribute-app:
9+
distribute_app:
1010
runs-on: macos-26
1111
timeout-minutes: 60
1212
steps:
1313
- uses: actions/checkout@v4
1414
- name: MacOS version
1515
run: sw_vers
1616
- name: Set up Homebrew
17-
id: set-up-homebrew
17+
id: set_up_homebrew
1818
uses: Homebrew/actions/setup-homebrew@master
1919
- uses: gsabran/setup-swift@main
2020
with:
@@ -44,7 +44,7 @@ jobs:
4444
uses: actions/cache/restore@v4
4545
with:
4646
path: app/build/derived_data
47-
key: ${{ runner.os }}-app-derived-data-main
47+
key: ${{ runner.os }}_app_derived_data_main
4848
- name: Publish release
4949
run: cd app/fastlane && bundle exec fastlane mac distribute_release
5050
env:

app/fastlane/Fastfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ platform :mac do
8383
setup_ci if ENV["CI"]
8484

8585
build_path = File.absolute_path("../build")
86-
sh("rm -rf #{build_path}")
8786

8887
# Resolve package dependencies first. This is to work around an issue where CI would freeze.
8988
sh("xcodebuild -resolvePackageDependencies -scheme command -project ../command.xcodeproj -configuration Release -derivedDataPath #{build_path}/derived_data -onlyUsePackageVersionsFromResolvedFile -parallelizeTargets")

cmd.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,7 @@ test_swift_command() {
161161
cd "$(dirname $package_swift)" && swift test -Xswiftc -suppress-warnings --quiet --no-parallel "${parsed_args[@]}"
162162
else
163163
# run all tests
164-
cd "$(git rev-parse --show-toplevel)/app/modules" && swift test -Xswiftc -suppress-warnings --quiet --no-parallel "${parsed_args[@]}" || exit 1
165-
cd "$(git rev-parse --show-toplevel)/app/tools/dependencies" && swift test "${parsed_args[@]}" || exit 1
164+
cd "$(git rev-parse --show-toplevel)/app/modules" && swift test -Xswiftc -suppress-warnings --quiet --no-parallel "${parsed_args[@]}"
166165
fi
167166
}
168167

0 commit comments

Comments
 (0)