-
Notifications
You must be signed in to change notification settings - Fork 6
268 lines (258 loc) · 10.4 KB
/
build-test-upload.yml
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
264
265
266
267
268
name: Build app
on:
pull_request:
types:
- opened
- synchronize
concurrency:
group: ${{ github.ref }}-tests
cancel-in-progress: true
jobs:
unit-tests-sdk:
runs-on: macos-14-large
timeout-minutes: 20
name: "Unit Tests - SDK"
steps:
- name: Cancel previous jobs
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1
with:
access_token: ${{ github.token }}
- name: Git - Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
ref: ${{ github.ref }}
- name: Run SDK tests
uses: ./.github/actions/sdk-tests
with:
ssh-private-key: ${{ secrets.SSH_KEY }}
known-hosts: ${{ secrets.KNOWN_HOSTS }}
match-password: ${{ secrets.MATCH_PASSWORD }}
match-git-private-key: ${{ secrets.FASTLANE_PASSWORD }}
fastlane-session: ${{ secrets.FASTLANE_SESSION }}
fastlane-password: ${{ secrets.FASTLANE_PASSWORD }}
match-keychain-name: ${{ secrets.MATCH_KEYCHAIN_NAME }}
match-keychain-password: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
sdk-name: sdk
optional-sdk-tests:
name: Optional SDK Tests
runs-on: macos-14-large
strategy:
max-parallel: 3
matrix:
package-swift:
- { name: 'nol-pay', file: 'Package.NolPay.swift' }
- { name: 'klarna', file: Package.Klarna.swift }
- { name: '3DS', file: Package.3DS.swift }
- { name: 'stripe', file: Package.Stripe.swift }
steps:
- name: Cancel previous jobs
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1
with:
access_token: ${{ github.token }}
- name: Git - Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
ref: ${{ github.ref }}
- name: Run SDK tests
uses: ./.github/actions/sdk-tests
with:
ssh-private-key: ${{ secrets.SSH_KEY }}
known-hosts: ${{ secrets.KNOWN_HOSTS }}
match-password: ${{ secrets.MATCH_PASSWORD }}
match-git-private-key: ${{ secrets.FASTLANE_PASSWORD }}
fastlane-session: ${{ secrets.FASTLANE_SESSION }}
fastlane-password: ${{ secrets.FASTLANE_PASSWORD }}
match-keychain-name: ${{ secrets.MATCH_KEYCHAIN_NAME }}
match-keychain-password: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
sdk-name: ${{ matrix.package-swift.name }}
package-swift: ${{ matrix.package-swift.file }}
unit-tests-debug-app:
runs-on: macos-14-large
timeout-minutes: 20
name: "Unit Tests - Debug App"
steps:
- name: Cancel previous jobs
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1
with:
access_token: ${{ github.token }}
- name: Git - Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
ref: ${{ github.ref }}
- name: Run debug app tests
uses: ./.github/actions/sdk-tests
with:
ssh-private-key: ${{ secrets.SSH_KEY }}
known-hosts: ${{ secrets.KNOWN_HOSTS }}
match-password: ${{ secrets.MATCH_PASSWORD }}
match-git-private-key: ${{ secrets.FASTLANE_PASSWORD }}
fastlane-session: ${{ secrets.FASTLANE_SESSION }}
fastlane-password: ${{ secrets.FASTLANE_PASSWORD }}
match-keychain-name: ${{ secrets.MATCH_KEYCHAIN_NAME }}
match-keychain-password: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
fastlane-test-lane: test_debug_app
spm-build:
needs: unit-tests-debug-app
runs-on: macos-14-large
timeout-minutes: 20
name: "Build app with SPM Integration"
steps:
- name: Cancel previous jobs
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1
with:
access_token: ${{ github.token }}
- name: Git - Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
ref: ${{ github.ref }}
- name: Select Xcode Version
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
with:
xcode-version: '15.4'
- name: Install SSH key
uses: shimataro/ssh-key-action@d4fffb50872869abe2d9a9098a6d9c5aa7d16be4 #v2.7.0
with:
key: ${{ secrets.SSH_KEY }}
name: id_rsa_github_actions
known_hosts: ${{ secrets.KNOWN_HOSTS }}
- uses: webfactory/ssh-agent@dc588b651fe13675774614f8e6a936a468676387 # v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_KEY }}
- uses: ruby/setup-ruby@7bae1d00b5db9166f4f0fc47985a3a5702cb58f0 # v1.197.0
with:
ruby-version: "3.2"
bundler-cache: true
- name: Build SPM App
run: |
bundle exec fastlane build_spm
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_GIT_PRIVATE_KEY: ${{ secrets.SSH_KEY }}
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
FASTLANE_SESSION: ${{ secrets.FASTLANE_SESSION }}
MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }}
MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
SOURCE_BRANCH: ${{ github.head_ref }}
sonarcloud:
needs:
- unit-tests-sdk
- optional-sdk-tests
name: SonarCloud
runs-on: macos-13
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: SonarCloud Scan
uses: ./.github/actions/sonar
with:
github-token: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
sonar-token: ${{ secrets.SONAR_TOKEN }}
sonar-host: https://sonarcloud.io.
pull-request-number: ${{ github.event.pull_request.number }}
branch: ${{ github.head_ref }}
base-branch: ${{ github.base_ref }}
pull-request-sha: ${{ github.event.pull_request.head.sha }}
coverage-file-names: sonar-coverage-sdk.xml,sonar-coverage-3DS.xml,sonar-coverage-nol-pay.xml,sonar-coverage-klarna.xml,sonar-coverage-stripe.xml
critical-ui-tests:
if: ${{ !startsWith(github.ref_name, 'release/') }}
needs:
- unit-tests-sdk
- unit-tests-debug-app
runs-on: macos-13-large
timeout-minutes: 45
name: "Run Critical Path UI Tests"
steps:
- name: Cancel previous jobs
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1
with:
access_token: ${{ github.token }}
- name: Git - Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
ref: ${{ github.ref }}
- uses: ruby/setup-ruby@7bae1d00b5db9166f4f0fc47985a3a5702cb58f0 # v1.197.0
with:
ruby-version: "3.2"
bundler-cache: true
- name: Setup node
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 #v4.0.4
with:
node-version: 18.3.0
- name: Pre-boot Simulator
shell: bash
run: |
SIM_UUID=$(xcrun xctrace list devices | grep "iPhone 15 Pro Simulator (17.2)" | head -1 | grep -Eo '[0-9A-Z\\-]{36}')
xcrun simctl boot "${SIM_UUID}"
- name: Test, Build, and Distribute app to Appetize 🚀
shell: bash
env:
SKIP_SIGNING: true
run: |
bundle exec fastlane build_cocoapods
- name: Clone and launch Browserstack tests via Appium 🧪
run: |
git clone -b 'develop' https://project_41483872_bot:[email protected]/primer-io/acceptance/mobile/mobile-appium-tests.git
git show --summary
env:
GITLAB_TEMP_PATH: ${{ secrets.GITLAB_APPIUM_PULL_KEY }}
- name: List simulators
run: |
xcrun simctl list
- name: Run Appium Test
working-directory: mobile-appium-tests
run: |
npm install
date
testType=MOCKED npx wdio config/wdio.ios.gha.conf.js
build-and-upload-to-appetize:
needs:
- unit-tests-sdk
- unit-tests-debug-app
runs-on: macos-13-large
timeout-minutes: 45
name: "Build and upload app to Appetize"
steps:
- name: Cancel previous jobs
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1
with:
access_token: ${{ github.token }}
- name: Git - Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
ref: ${{ github.ref }}
- name: Upload preview to Appetize
id: appetize-upload
uses: ./.github/actions/appetize-build
with:
build_type: 'preview'
github-token: ${{ secrets.GITHUB_TOKEN }}
ssh-private-key: ${{ secrets.SSH_KEY }}
known-hosts: ${{ secrets.KNOWN_HOSTS }}
match-password: ${{ secrets.MATCH_PASSWORD }}
match-git-private-key: ${{ secrets.FASTLANE_PASSWORD }}
fastlane-session: ${{ secrets.FASTLANE_SESSION }}
fastlane-password: ${{ secrets.FASTLANE_PASSWORD }}
match-keychain-name: ${{ secrets.MATCH_KEYCHAIN_NAME }}
match-keychain-password: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
appetize-api-token: ${{ secrets.APPETIZE_API_TOKEN }}
source-branch: ${{ github.head_ref || github.ref_name }}
pr-number: ${{ github.event.pull_request.number }}
slack-channel: ${{ secrets.SLACK_MOBILE_SDK_CHANNEL }}
slack-reporter-token: ${{ secrets.SLACK_REPORTER_BOT_TOKEN }}
github-run-id: ${{ github.run_id }}
- uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e #v3.1.0
if: ${{ success() }}
id: find_comment
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: Appetize link
- uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 #v4.0.0
if: ${{ success() }}
with:
body: |
Appetize link: ${{ env.APPETIZE_APP_URL }}
edit-mode: replace
comment-id: ${{ steps.find_comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
token: ${{ secrets.GITHUB_TOKEN }}