-
Notifications
You must be signed in to change notification settings - Fork 13
348 lines (335 loc) · 12.2 KB
/
build.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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
#
# Copyright Avast Software. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
name: "wallet-sdk ci"
env:
GO_VERSION: '1.22.4'
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
SemanticPullRequest:
name: Semantic Pull Request Check
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
with:
requireScope: true
scopes: |
sdk
app
deps
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Checks:
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Run checks
run: |
echo $PATH
go env
echo ${{ github.workspace }}
make checks
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
UnitTest:
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Run unit test
run: make unit-test
- name: Upload coverage to Codecov
run: |
bash <(curl https://codecov.io/bash)
env:
CODECOV_UPLOAD_TOKEN: ${{ secrets.CODECOV_UPLOAD_TOKEN }}
SDKIntegrationTest:
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Run Integration tests
run: |
echo '127.0.0.1 file-server.trustbloc.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 did-resolver.trustbloc.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 vc-rest-echo.trustbloc.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 api-gateway.trustbloc.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 cognito-mock.trustbloc.local' | sudo tee -a /etc/hosts
make integration-test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BuildMockLoginConsentServer:
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Build docker images for test server
run: |
docker build -f ./images/mocks/loginconsent/Dockerfile --no-cache -t wallet-sdk/mock-login-consent:latest \
--build-arg GO_VER=1.22 \
--build-arg ALPINE_VER=3.18 .
- name: Save docker image as tar
run: |
docker save --output /tmp/mock-login-consent.tar wallet-sdk/mock-login-consent
- name: Upload image to artifact
uses: actions/upload-artifact@v4
with:
name: mock-login-consent
path: /tmp/mock-login-consent.tar
BuildMockSampleWebhookServer:
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Build docker images for test server
run: |
docker build -f ./images/mocks/webhook/Dockerfile --no-cache -t wallet-sdk/sample-webhook:latest \
--build-arg GO_VER=1.22 \
--build-arg ALPINE_VER=3.18 .
- name: Save docker image as tar
run: |
docker save --output /tmp/mock-sample-webhook.tar wallet-sdk/sample-webhook
- name: Upload image to artifact
uses: actions/upload-artifact@v4
with:
name: mock-sample-webhook
path: /tmp/mock-sample-webhook.tar
BuilMockTrustRegistryServer:
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Build docker images for test server
run: |
docker build -f ./images/mocks/trustregistry/Dockerfile --no-cache -t wallet-sdk/mock-trust-registry:latest \
--build-arg GO_VER=1.22 \
--build-arg ALPINE_VER=3.18 .
- name: Save docker image as tar
run: |
docker save --output /tmp/mock-trust-registry.tar wallet-sdk/mock-trust-registry
- name: Upload image to artifact
uses: actions/upload-artifact@v4
with:
name: mock-trust-registry
path: /tmp/mock-trust-registry.tar
BuilMockAttestationServer:
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Build docker images for test server
run: |
docker build -f ./images/mocks/attestation/Dockerfile --no-cache -t wallet-sdk/mock-attestation:latest \
--build-arg GO_VER=1.22 \
--build-arg ALPINE_VER=3.18 .
- name: Save docker image as tar
run: |
docker save --output /tmp/mock-attestation.tar wallet-sdk/mock-attestation
- name: Upload image to artifact
uses: actions/upload-artifact@v4
with:
name: mock-attestation
path: /tmp/mock-attestation.tar
iOSFlutterIntegrationTest:
runs-on: macos-13
needs: [ BuildMockLoginConsentServer, BuilMockTrustRegistryServer, BuilMockAttestationServer, BuildMockSampleWebhookServer ]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Generate and copy iOS Binding
run: |
echo $PATH
echo ${{ github.workspace }}
echo ${GOPATH}
echo ${GOROOT}
export PATH=$PATH:$GOPATH/bin
echo $PATH
go install golang.org/x/mobile/cmd/gomobile@latest
gomobile init
NEW_VERSION=testVer GIT_REV=testRev BUILD_TIME=testTime make generate-ios-bindings copy-ios-bindings
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOPATH: /Users/runner/work/wallet-sdk/go
- name: Setup hosts
run: |
echo '127.0.0.1 file-server.trustbloc.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 did-resolver.trustbloc.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 vc-rest-echo.trustbloc.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 api-gateway.trustbloc.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 cognito-mock.trustbloc.local' | sudo tee -a /etc/hosts
- name: Install and start docker
uses: douglascamata/setup-docker-macos-action@8d5fa43892aed7eee4effcdea113fd53e4d4bf83
with:
upgrade-qemu: false
lima: v0.22.0
colima: v0.7.3
- name: Download artifacts (Docker images) from previous workflows
uses: actions/download-artifact@v4
- name: Load mock-login-consent server
run: |
docker load --input mock-login-consent/mock-login-consent.tar
- name: Load mock test registry server
run: |
docker load --input mock-trust-registry/mock-trust-registry.tar
- name: Load mock attestation server
run: |
docker load --input mock-attestation/mock-attestation.tar
- name: Load mock-sample-webhook server
run: |
docker load --input mock-sample-webhook/mock-sample-webhook.tar
- name: Generate test cli and keys
run: |
make build-integration-cli generate-test-keys
- name: Setup env for integration test
run: |
make start-integration-env-flutter
- name: Setup Flutter SDK
uses: flutter-actions/setup-flutter@v2
with:
channel: stable
version: 3.19.5
- name: Install flutter app dependencies
run: make install-flutter-dependencies
- name: Run iOS Simulator
uses: futureware-tech/simulator-action@v3
with:
model: 'iPhone 14'
- name: Remove AppIcon contents file (Simulator build fails with this file)
run: |
rm -rf demo/app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
rm -rf demo/app/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
- name: Run tests on Simulator
run: make integration-test-flutter integration-test-ios
- name: Docker container status output
if: always()
run: |
docker images
docker ps -a
AndroidFlutterIntegrationTest:
runs-on: macos-13
needs: [ BuildMockLoginConsentServer, BuilMockTrustRegistryServer, BuilMockAttestationServer, BuildMockSampleWebhookServer ]
steps:
- name: checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Generate and copy Android Binding
run: |
echo $PATH
echo ${{ github.workspace }}
echo ${GOPATH}
echo ${GOROOT}
export PATH=$PATH:$GOPATH/bin
echo $PATH
go install golang.org/x/mobile/cmd/gomobile@latest
gomobile init
NEW_VERSION=testVer GIT_REV=testRev BUILD_TIME=testTime make generate-android-bindings copy-android-bindings
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOPATH: /Users/runner/work/wallet-sdk/go
- name: Setup hosts
run: |
echo '127.0.0.1 file-server.trustbloc.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 did-resolver.trustbloc.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 vc-rest-echo.trustbloc.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 api-gateway.trustbloc.local' | sudo tee -a /etc/hosts
echo '127.0.0.1 cognito-mock.trustbloc.local' | sudo tee -a /etc/hosts
- name: Install and start docker
uses: douglascamata/setup-docker-macos-action@8d5fa43892aed7eee4effcdea113fd53e4d4bf83
with:
upgrade-qemu: false
lima: v0.22.0
colima: v0.7.3
- name: Download artifacts (Docker images) from previous workflows
uses: actions/download-artifact@v4
- name: Load mock-login-consent server
run: |
docker load --input mock-login-consent/mock-login-consent.tar
- name: Load mock test registry server
run: |
docker load --input mock-trust-registry/mock-trust-registry.tar
- name: Load mock attestation server
run: |
docker load --input mock-attestation/mock-attestation.tar
- name: Load mock-sample-webhook server
run: |
docker load --input mock-sample-webhook/mock-sample-webhook.tar
- name: Generate test cli and keys
run: |
make build-integration-cli generate-test-keys
- name: Setup env for integration test
run: |
make start-integration-env-flutter
- name: Gradle cache
uses: gradle/gradle-build-action@v3
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '21'
- name: Setup Flutter SDK
uses: flutter-actions/setup-flutter@v2
with:
channel: stable
version: 3.19.5
- name: Install flutter app dependencies
run: make install-flutter-dependencies
- name: Build APK in Debug mode
run: |
cd demo/app
flutter build apk --debug
- name: Run flutter and android tests on Emulator
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 32
arch: x86_64
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: adb reverse tcp:8075 tcp:8075 && adb reverse tcp:8072 tcp:8072 && adb reverse tcp:9229 tcp:9229 && adb reverse tcp:8097 tcp:8097 && make integration-test-flutter integration-test-android
- name: Docker container status output
if: always()
run: |
docker images
docker ps -a