Skip to content

Commit 02292e7

Browse files
Improve CI jobs (pointfreeco#3357)
* Improve CI jobs. * wip * wip * exclude * more exclude * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * try out caching * fix yml * fix makefile syntax * cache key * wip * fix * wip * wip * boop * wip * wip * wip * wip * wip * wip * wip * boop * wip * wip * wip * wip * wip * wip * wip * wip * fix visionos tests * wip * wip * wip * wip * wip * wip * boop * wip * boop * Update ci.yml * Update Makefile * Update Makefile * clean up --------- Co-authored-by: Stephen Celis <[email protected]>
1 parent e036737 commit 02292e7

File tree

6 files changed

+130
-70
lines changed

6 files changed

+130
-70
lines changed

.github/package.xcworkspace/xcshareddata/swiftpm/Package.resolved

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"originHash" : "a84dfeef15185f26bd546eb430da9b0b1f23f5a08c6ac0f99b345a8de1564068",
32
"pins" : [
43
{
54
"identity" : "combine-schedulers",
@@ -164,5 +163,5 @@
164163
}
165164
}
166165
],
167-
"version" : 3
166+
"version" : 2
168167
}

.github/workflows/ci.yml

+69-44
Original file line numberDiff line numberDiff line change
@@ -14,68 +14,93 @@ concurrency:
1414
cancel-in-progress: true
1515

1616
jobs:
17-
library-swift-latest:
18-
name: Library
17+
xcodebuild:
18+
name: xcodebuild
1919
runs-on: macos-14
2020
strategy:
2121
matrix:
22-
xcode:
23-
- 15.4
24-
- 16_beta_6
25-
config:
26-
- debug
27-
- release
22+
command: [test, '']
23+
platform: [iOS, macOS, tvOS, watchOS, visionOS, macCatalyst]
24+
xcode: [15.2, 15.4, 16_beta_6]
25+
exclude:
26+
- {xcode: 15.2, command: test}
27+
- {xcode: 15.4, command: ''}
28+
- {xcode: 15.2, platform: macCatalyst}
29+
- {xcode: 15.2, platform: tvOS}
30+
- {xcode: 15.2, platform: visionOS}
31+
- {xcode: 15.2, platform: watchOS}
32+
- {xcode: 16_beta_6, command: ''}
33+
- {xcode: 16_beta_6, platform: macCatalyst}
34+
- {xcode: 16_beta_6, platform: tvOS}
35+
- {xcode: 16_beta_6, platform: visionOS}
36+
- {xcode: 16_beta_6, platform: watchOS}
37+
include:
38+
- {xcode: 15.2, skip_release: 1}
2839
steps:
2940
- uses: actions/checkout@v4
3041
- name: Select Xcode ${{ matrix.xcode }}
3142
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
32-
- name: Build ${{ matrix.config }}
33-
run: make CONFIG=${{ matrix.config }} build-all-platforms
34-
- name: Run ${{ matrix.config }} tests
35-
if: matrix.xcode == '15.4'
36-
run: make CONFIG=${{ matrix.config }} test-library
43+
- name: Cache derived data
44+
uses: actions/cache@v3
45+
with:
46+
path: |
47+
~/.derivedData
48+
key: |
49+
deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.command }}-${{ hashFiles('**/Sources/**/*.swift', '**/Tests/**/*.swift') }}
50+
restore-keys: |
51+
deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.command }}-
52+
- name: Set IgnoreFileSystemDeviceInodeChanges flag
53+
run: defaults write com.apple.dt.XCBuild IgnoreFileSystemDeviceInodeChanges -bool YES
54+
- name: Update mtime for incremental builds
55+
uses: chetan/git-restore-mtime-action@v2
56+
- name: Debug
57+
run: make COMMAND="${{ matrix.command }}" CONFIG=Debug PLATFORM="${{ matrix.platform }}" xcodebuild
58+
- name: Release
59+
if: matrix.skip_release != '1'
60+
run: make COMMAND="${{ matrix.command }}" CONFIG=Release PLATFORM="${{ matrix.platform }}" xcodebuild
3761

38-
# library-evolution:
39-
# name: Library (evolution)
40-
# runs-on: macos-14
41-
# steps:
42-
# - uses: actions/checkout@v4
43-
# - name: Select Xcode 15.4
44-
# run: sudo xcode-select -s /Applications/Xcode_15.4.app
45-
# - name: Build for library evolution
46-
# run: make build-for-library-evolution
47-
48-
library-compatibility:
49-
name: Library (Swift 5.9)
50-
runs-on: macos-14
51-
strategy:
52-
matrix:
53-
config:
54-
- debug
55-
- release
56-
steps:
57-
- uses: actions/checkout@v4
58-
- name: Select Xcode 15.2
59-
run: sudo xcode-select -s /Applications/Xcode_15.2.app
60-
- name: Build ${{ matrix.config }}
61-
run: swift build -c ${{ matrix.config }}
62-
63-
benchmarks:
64-
name: Benchmarks
62+
library-evolution:
63+
name: Library (evolution)
6564
runs-on: macos-14
6665
steps:
6766
- uses: actions/checkout@v4
6867
- name: Select Xcode 15.4
6968
run: sudo xcode-select -s /Applications/Xcode_15.4.app
70-
- name: Run benchmark
71-
run: make benchmark
69+
- name: Build for library evolution
70+
run: make build-for-library-evolution
7271

7372
examples:
7473
name: Examples
7574
runs-on: macos-14
7675
steps:
7776
- uses: actions/checkout@v4
77+
- name: Cache derived data
78+
uses: actions/cache@v3
79+
with:
80+
path: ~/.derivedData
81+
key: |
82+
deriveddata-examples-${{ hashFiles('**/Sources/**/*.swift', '**/Tests/**/*.swift', '**/Examples/**/*.swift') }}
83+
restore-keys: |
84+
deriveddata-examples-
7885
- name: Select Xcode 15.4
7986
run: sudo xcode-select -s /Applications/Xcode_15.4.app
80-
- name: Run tests
81-
run: make test-examples
87+
- name: Set IgnoreFileSystemDeviceInodeChanges flag
88+
run: defaults write com.apple.dt.XCBuild IgnoreFileSystemDeviceInodeChanges -bool YES
89+
- name: Update mtime for incremental builds
90+
uses: chetan/git-restore-mtime-action@v2
91+
- name: CaseStudies (SwiftUI)
92+
run: make SCHEME="CaseStudies (SwiftUI)" test-example
93+
- name: CaseStudies (UIKit)
94+
run: make SCHEME="CaseStudies (UIKit)" test-example
95+
- name: Search
96+
run: make SCHEME="Search" test-example
97+
- name: SyncUps
98+
run: make SCHEME="SyncUps" test-example
99+
- name: SpeechRecognition
100+
run: make SCHEME="SpeechRecognition" test-example
101+
- name: TicTacToe
102+
run: make SCHEME="TicTacToe" test-example
103+
- name: Todos
104+
run: make SCHEME="Todos" test-example
105+
- name: VoiceMemos
106+
run: make SCHEME="VoiceMemos" test-example

ComposableArchitecture.xcworkspace/xcshareddata/swiftpm/Package.resolved

+5-5
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
"kind" : "remoteSourceControl",
3333
"location" : "https://github.com/pointfreeco/swift-case-paths",
3434
"state" : {
35-
"revision" : "71344dd930fde41e8f3adafe260adcbb2fc2a3dc",
36-
"version" : "1.5.4"
35+
"revision" : "642e6aab8e03e5f992d9c83e38c5be98cfad5078",
36+
"version" : "1.5.5"
3737
}
3838
},
3939
{
@@ -86,8 +86,8 @@
8686
"kind" : "remoteSourceControl",
8787
"location" : "https://github.com/swiftlang/swift-docc-plugin",
8888
"state" : {
89-
"revision" : "0510d9160330025fb5823f7845c26af3cd56a405",
90-
"version" : "1.4.1"
89+
"revision" : "2eb22993b3dfd0c0d32729b357c8dabb6cd44680",
90+
"version" : "1.4.2"
9191
}
9292
},
9393
{
@@ -150,7 +150,7 @@
150150
"location" : "https://github.com/swiftlang/swift-syntax",
151151
"state" : {
152152
"revision" : "515f79b522918f83483068d99c68daeb5116342d",
153-
"version" : "600.0.0-prerelease-2024-08-20"
153+
"version" : "600.0.0-prerelease-2024-09-04"
154154
}
155155
},
156156
{

Makefile

+51-19
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
CONFIG = debug
2+
PLATFORM = iOS
23
PLATFORM_IOS = iOS Simulator,id=$(call udid_for,iOS 17.5,iPhone \d\+ Pro [^M])
34
PLATFORM_MACOS = macOS
45
PLATFORM_MAC_CATALYST = macOS,variant=Mac Catalyst
@@ -14,25 +15,57 @@ test-all: test-examples
1415
$(MAKE) CONFIG=debug test-library
1516
$(MAKE) CONFIG=release test-library
1617

17-
build-all-platforms:
18-
for platform in "iOS" "macOS" "macOS,variant=Mac Catalyst" "tvOS" "visionOS" "watchOS"; do \
19-
xcodebuild \
18+
xcodebuild:
19+
if test "$(PLATFORM)" = "iOS"; \
20+
then xcodebuild $(COMMAND) \
2021
-skipMacroValidation \
2122
-configuration $(CONFIG) \
2223
-workspace .github/package.xcworkspace \
2324
-scheme ComposableArchitecture \
24-
-destination generic/platform="$$platform" || exit 1; \
25-
done;
26-
27-
test-library:
28-
for platform in "$(PLATFORM_IOS)" "$(PLATFORM_MACOS)"; do \
29-
xcodebuild test \
25+
-destination platform="$(PLATFORM_IOS)" \
26+
-derivedDataPath ~/.derivedData/$(CONFIG); \
27+
elif test "$(PLATFORM)" = "macOS"; \
28+
then xcodebuild $(COMMAND) \
29+
-skipMacroValidation \
30+
-configuration $(CONFIG) \
31+
-workspace .github/package.xcworkspace \
32+
-scheme ComposableArchitecture \
33+
-destination platform="$(PLATFORM_MACOS)" \
34+
-derivedDataPath ~/.derivedData/$(CONFIG); \
35+
elif test "$(PLATFORM)" = "tvOS"; \
36+
then xcodebuild $(COMMAND) \
37+
-skipMacroValidation \
38+
-configuration $(CONFIG) \
39+
-workspace .github/package.xcworkspace \
40+
-scheme ComposableArchitecture \
41+
-destination platform="$(PLATFORM_TVOS)" \
42+
-derivedDataPath ~/.derivedData/$(CONFIG); \
43+
elif test "$(PLATFORM)" = "watchOS"; \
44+
then xcodebuild $(COMMAND) \
45+
-skipMacroValidation \
46+
-configuration $(CONFIG) \
47+
-workspace .github/package.xcworkspace \
48+
-scheme ComposableArchitecture \
49+
-destination platform="$(PLATFORM_WATCHOS)" \
50+
-derivedDataPath ~/.derivedData/$(CONFIG); \
51+
elif test "$(PLATFORM)" = "visionOS"; \
52+
then xcodebuild $(COMMAND) \
53+
-skipMacroValidation \
54+
-configuration $(CONFIG) \
55+
-workspace .github/package.xcworkspace \
56+
-scheme ComposableArchitecture \
57+
-destination platform="$(PLATFORM_VISIONOS)" \
58+
-derivedDataPath ~/.derivedData/$(CONFIG); \
59+
elif test "$(PLATFORM)" = "macCatalyst"; \
60+
then xcodebuild $(COMMAND) \
3061
-skipMacroValidation \
3162
-configuration $(CONFIG) \
3263
-workspace .github/package.xcworkspace \
3364
-scheme ComposableArchitecture \
34-
-destination platform="$$platform" || exit 1; \
35-
done;
65+
-destination platform="$(PLATFORM_MAC_CATALYST)" \
66+
-derivedDataPath ~/.derivedData/$(CONFIG); \
67+
else exit 1; \
68+
fi;
3669

3770
build-for-library-evolution:
3871
swift build \
@@ -54,19 +87,18 @@ test-docs:
5487
|| (echo "xcodebuild docbuild failed:\n\n$(DOC_WARNINGS)" | tr '\1' '\n' \
5588
&& exit 1)
5689

57-
test-examples:
58-
for scheme in "CaseStudies (SwiftUI)" "CaseStudies (UIKit)" Search SyncUps SpeechRecognition TicTacToe Todos VoiceMemos; do \
59-
xcodebuild test \
60-
-skipMacroValidation \
61-
-scheme "$$scheme" \
62-
-destination platform="$(PLATFORM_IOS)" || exit 1; \
63-
done
90+
test-example:
91+
xcodebuild test \
92+
-skipMacroValidation \
93+
-scheme "$(SCHEME)" \
94+
-destination platform="$(PLATFORM_IOS)" \
95+
-derivedDataPath ~/.derivedData
6496

6597
test-integration:
6698
xcodebuild test \
6799
-skipMacroValidation \
68100
-scheme "Integration" \
69-
-destination platform="$(PLATFORM_IOS)" || exit 1;
101+
-destination platform="$(PLATFORM_IOS)"
70102

71103
benchmark:
72104
swift run --configuration release \

Tests/ComposableArchitectureTests/Reducers/PresentationReducerTests.swift

+2
Original file line numberDiff line numberDiff line change
@@ -2617,6 +2617,7 @@ final class PresentationReducerTests: BaseTCATestCase {
26172617
}
26182618
}
26192619

2620+
#if !os(visionOS)
26202621
@Reducer
26212622
struct TestEphemeralBindingDismissalFeature {
26222623
@ObservableState
@@ -2647,6 +2648,7 @@ final class PresentationReducerTests: BaseTCATestCase {
26472648
$store.scope(state: \.alert, action: \.alert).wrappedValue = nil
26482649
XCTAssertNil(store.alert)
26492650
}
2651+
#endif
26502652
}
26512653

26522654
@Reducer

Tests/ComposableArchitectureTests/StoreTests.swift

+2
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,7 @@ final class StoreTests: BaseTCATestCase {
10881088
var body: some ReducerOf<Self> { EmptyReducer() }
10891089
}
10901090

1091+
#if !os(visionOS)
10911092
@MainActor
10921093
func testInvalidatedStoreScope() async throws {
10931094
@Perception.Bindable var store = Store(
@@ -1107,6 +1108,7 @@ final class StoreTests: BaseTCATestCase {
11071108
store.send(.child(.dismiss))
11081109
grandchildStoreBinding.wrappedValue = nil
11091110
}
1111+
#endif
11101112

11111113
@MainActor
11121114
func testSurroundingDependencies() {

0 commit comments

Comments
 (0)