-
Notifications
You must be signed in to change notification settings - Fork 0
263 lines (218 loc) · 7.77 KB
/
Copy pathtest.yaml
File metadata and controls
263 lines (218 loc) · 7.77 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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
name: Tests
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
jobs:
lint:
name: swiftlint
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Install SwiftLint
run: brew list swiftlint >/dev/null 2>&1 || brew install swiftlint
- name: Run SwiftLint
run: make lint-ci
test-packages:
name: swift test (Packages)
runs-on: [self-hosted, regular]
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Swift version
run: swift --version
- name: Run package tests
working-directory: Packages
# No xcpretty: it doesn't understand swift-testing's output and
# the non-ASCII record marker () crashes xcpretty 0.4.1 on Ruby 4
# with "invalid byte sequence in US-ASCII", which pipefail turns
# into an exit-1 even when every test passed.
run: swift test
test-xcode:
name: xcodebuild test (RxCode)
runs-on: [self-hosted, regular]
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Install xcpretty
run: gem install xcpretty
- name: Write Firebase config
env:
FIREBASE_MACOS_B64: ${{ secrets.FIREBASE_MACOS_B64 }}
run: ./scripts/ci/write-firebase-config.sh
- name: Run Xcode tests
run: |
set -o pipefail && xcodebuild \
-project RxCode.xcodeproj \
-scheme RxCode \
-configuration Debug \
-destination platform=macOS \
-testPlan UnitTestPlan \
-enableCodeCoverage NO \
CODE_SIGNING_ALLOWED=NO \
test | xcpretty
build-smoke:
name: xcodebuild build (Release)
runs-on: self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Install xcpretty
run: gem install xcpretty
- name: Write Firebase config
env:
FIREBASE_MACOS_B64: ${{ secrets.FIREBASE_MACOS_B64 }}
run: ./scripts/ci/write-firebase-config.sh
- name: Build (no signing)
run: |
set -o pipefail && xcodebuild \
-project RxCode.xcodeproj \
-scheme RxCode \
-configuration Release \
-destination platform=macOS \
CODE_SIGNING_ALLOWED=NO \
build | xcpretty
build-mobile:
name: xcodebuild build (RxCodeMobile)
runs-on: self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Install xcpretty
run: gem install xcpretty
- name: Write Firebase config
env:
FIREBASE_IOS_B64: ${{ secrets.FIREBASE_IOS_B64 }}
run: ./scripts/ci/write-firebase-config.sh
- name: Build mobile app (ad-hoc signing)
run: |
# The iOS app embeds extensions (notification service, widget), so
# CODE_SIGNING_ALLOWED=NO won't link a valid .app. Ad-hoc sign the
# device build instead — no certificate or provisioning profile
# required, just enough to produce a verifiable bundle.
# Release configuration: DEBUG is undefined here, so this also
# catches code wrongly placed outside an `#if DEBUG` guard.
set -o pipefail && xcodebuild \
-project RxCode.xcodeproj \
-scheme RxCodeMobile \
-configuration Release \
-destination 'generic/platform=iOS' \
CODE_SIGN_IDENTITY="-" \
CODE_SIGN_STYLE=Manual \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGNING_ALLOWED=YES \
AD_HOC_CODE_SIGNING_ALLOWED=YES \
build | xcpretty
test-mobile:
name: xcodebuild test (RxCodeMobile UI - ${{ matrix.label }})
runs-on: [self-hosted, ui-tests]
strategy:
fail-fast: false
matrix:
include:
- label: iPhone
device-prefix: iPhone
test-plan: MobileUITestPlan-iPhone
- label: iPad
device-prefix: iPad
test-plan: MobileUITestPlan-iPad
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Install xcpretty
run: gem install xcpretty
- name: Write Firebase config
env:
FIREBASE_IOS_B64: ${{ secrets.FIREBASE_IOS_B64 }}
run: ./scripts/ci/write-firebase-config.sh
- name: Resolve simulator
id: sim
run: |
# Pick the first available simulator matching the device family, so
# the job survives Xcode bumping its bundled simulator models.
UDID=$(xcrun simctl list devices available --json | python3 -c "
import json, sys
devices = json.load(sys.stdin)['devices']
prefix = '${{ matrix.device-prefix }}'
for runtime in devices:
for d in devices[runtime]:
if d['name'].startswith(prefix):
print(d['udid']); sys.exit(0)
")
if [ -z "$UDID" ]; then
echo "No '${{ matrix.device-prefix }}' simulator found. Available devices:"
xcrun simctl list devices available
exit 1
fi
echo "Using ${{ matrix.device-prefix }} simulator $UDID"
echo "udid=$UDID" >> "$GITHUB_OUTPUT"
- name: Prepare simulator
run: |
# Erase first: the app persists pairing in UserDefaults/Keychain, and
# a clean device guarantees the UI-test mock pairing path is taken.
xcrun simctl shutdown "${{ steps.sim.outputs.udid }}" || true
xcrun simctl erase "${{ steps.sim.outputs.udid }}"
xcrun simctl boot "${{ steps.sim.outputs.udid }}"
xcrun simctl bootstatus "${{ steps.sim.outputs.udid }}"
- name: Run UI tests
run: |
set -o pipefail && xcodebuild \
-project RxCode.xcodeproj \
-scheme RxCodeMobile \
-configuration Debug \
-testPlan ${{ matrix.test-plan }} \
-destination "platform=iOS Simulator,id=${{ steps.sim.outputs.udid }}" \
-resultBundlePath "TestResults-${{ matrix.label }}.xcresult" \
-enableCodeCoverage NO \
CODE_SIGNING_ALLOWED=NO \
CODE_SIGNING_REQUIRED=NO \
test | xcpretty
- name: Upload test results
if: always()
uses: actions/upload-artifact@v7
with:
name: mobile-ui-test-results-${{ matrix.label }}
path: TestResults-${{ matrix.label }}.xcresult
retention-days: 14
build-android:
name: gradle build (RxCodeAndroid)
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: "17"
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Write Firebase config
env:
FIREBASE_ANDROID_B64: ${{ secrets.FIREBASE_ANDROID_B64 }}
run: ./scripts/ci/write-firebase-config.sh
- name: Assemble debug APK
working-directory: RxCodeAndroid
run: ./gradlew assembleDebug --stacktrace