-
Notifications
You must be signed in to change notification settings - Fork 0
194 lines (168 loc) · 5.06 KB
/
test.yml
File metadata and controls
194 lines (168 loc) · 5.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: Test
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test-macos:
name: Test on macOS
runs-on: macos-26
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Show Xcode and Swift version
run: |
xcodebuild -version
swift --version
- name: Cache Swift Package Manager
uses: actions/cache@v4
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Build
run: swift build --build-tests
- name: Run Tests
run: swift test --parallel --enable-code-coverage
- name: Generate Code Coverage
run: |
xcrun llvm-cov export \
.build/debug/FlowPackageTests.xctest/Contents/MacOS/FlowPackageTests \
-instr-profile .build/debug/codecov/default.profdata \
-format="lcov" \
-ignore-filename-regex=".build|Tests" > coverage.lcov
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: coverage.lcov
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-macos
path: .build/debug/*.xctest
test-ios:
name: Test on iOS
runs-on: macos-26
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Show Xcode and Swift version
run: |
xcodebuild -version
swift --version
- name: List available simulators
run: xcrun simctl list devices available
- name: Run Tests on iOS Simulator
run: |
xcodebuild test \
-scheme Flow \
-destination 'platform=iOS Simulator,name=iPhone 16 Pro,OS=18.6' \
-skipPackagePluginValidation \
-skipMacroValidation \
-enableCodeCoverage YES
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-ios
path: .build/debug/*.xctest
# SwiftLint check
swiftlint:
name: SwiftLint
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
- name: SwiftLint
uses: norio-nomura/action-swiftlint@3.2.1
with:
args: --strict
# Build for all platforms
build-platforms:
name: Build ${{ matrix.platform }}
runs-on: macos-26
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
platform:
- iOS
- macOS
- watchOS
- tvOS
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build for ${{ matrix.platform }}
run: |
case "${{ matrix.platform }}" in
iOS)
xcodebuild build \
-scheme Flow \
-destination 'platform=iOS Simulator,name=iPhone 16 Pro,OS=18.6' \
-skipPackagePluginValidation \
-skipMacroValidation
;;
macOS)
xcodebuild build \
-scheme Flow \
-destination 'platform=macOS' \
-skipPackagePluginValidation \
-skipMacroValidation
;;
watchOS)
xcodebuild build \
-scheme Flow \
-destination 'platform=watchOS Simulator,name=Apple Watch Series 10 (46mm),OS=11.5' \
-skipPackagePluginValidation \
-skipMacroValidation
;;
tvOS)
xcodebuild build \
-scheme Flow \
-destination 'platform=tvOS Simulator,name=Apple TV' \
-skipPackagePluginValidation \
-skipMacroValidation
;;
esac
# Status check for required jobs
test-status:
name: Test Status
runs-on: ubuntu-latest
needs: [test-macos, test-ios, swiftlint, build-platforms]
if: always()
steps:
- name: Check test results
run: |
if [[ "${{ needs.test-macos.result }}" != "success" ]]; then
echo "::error::macOS tests failed"
exit 1
fi
if [[ "${{ needs.test-ios.result }}" != "success" ]]; then
echo "::error::iOS tests failed"
exit 1
fi
if [[ "${{ needs.swiftlint.result }}" != "success" ]]; then
echo "::error::SwiftLint check failed"
exit 1
fi
if [[ "${{ needs.build-platforms.result }}" != "success" ]]; then
echo "::error::Platform builds failed"
exit 1
fi
echo "✅ All tests passed!"