forked from faasm/faasm
-
Notifications
You must be signed in to change notification settings - Fork 0
410 lines (399 loc) · 13.9 KB
/
tests.yml
File metadata and controls
410 lines (399 loc) · 13.9 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
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
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
name: Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
types: [opened, synchronize, reopened, ready_for_review]
defaults:
run:
working-directory: /usr/local/code/faasm
shell: bash
jobs:
formatting:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
container:
image: faasm/cli:0.8.14
steps:
# Get the code
- name: "Fetch ref"
run: git fetch origin ${GITHUB_REF}:ci-branch
- name: "Check out branch"
run: git checkout --force ci-branch
- name: "Update submodules"
run: git submodule update
- name: "Update python deps"
run: |
source venv/bin/activate
pip3 install -r faasmcli/requirements.txt
# Formatting checks
- name: "Python formatting check"
run: |
source venv/bin/activate
./bin/check_python.sh
- name: "Run C/C++ formatting"
run: ./bin/run_clang_format.sh
- name: "Check C/C++ formatting changes"
run: git diff --exit-code
docs:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
container:
image: faasm/cli:0.8.14
steps:
- name: "Fetch ref"
run: git fetch origin ${GITHUB_REF}:ci-branch
- name: "Check out branch"
run: git checkout --force ci-branch
- name: "Build docs"
run: ./bin/inv_wrapper.sh docs
cpp-funcs:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
container:
image: faasm/cpp-sysroot:0.1.6
defaults:
run:
working-directory: /__w/faasm/faasm/clients/cpp
steps:
- name: "Checkout code"
uses: actions/checkout@v2
- name: "CPP submodule"
run: git submodule update --init clients/cpp
working-directory: /__w/faasm/faasm
- name: "Build C++ functions"
run: inv func.local
- name: "Build libfake"
run: inv libfake
- name: "Upload cpp wasm"
uses: actions/upload-artifact@v2
with:
name: cpp-wasm
path: /usr/local/faasm/wasm
- name: "Upload fake lib wasm"
uses: actions/upload-artifact@v2
with:
name: libfake-wasm
path: /usr/local/faasm/runtime_root/lib/fake
py-funcs:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
container:
image: faasm/cpython:0.1.1
defaults:
run:
working-directory: /__w/faasm/faasm/clients/python
steps:
- name: "Checkout code"
uses: actions/checkout@v2
- name: "Python submodule"
run: git submodule update --init clients/python
working-directory: /__w/faasm/faasm
- name: "Build CPython function"
run: inv func
- name: "Put Python functions in place"
run: inv func.upload-all --local
- name: "Upload python wasm"
uses: actions/upload-artifact@v2
with:
name: py-wasm
path: /usr/local/faasm/wasm/python
- name: "Upload python functions"
uses: actions/upload-artifact@v2
with:
name: py-funcs
path: /usr/local/faasm/shared
conan-cache:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
container:
image: faasm/cli:0.8.14
steps:
- name: "Conan cache"
uses: faasm/conan-cache-action@v1
with:
directory: /usr/local/code/faasm
- name: "Build dev dependencies to be shared by all runs"
run: ./bin/inv_wrapper.sh dev.cmake --build Debug
tests:
if: github.event.pull_request.draft == false
needs: [cpp-funcs, py-funcs, conan-cache]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# 08/06/2022 - Disable Thread sanitiser build as it exhausts all the
# memory available in GHA runners
sanitiser: [None, Address, Undefined, Leak]
env:
CGROUP_MODE: off
HOST_TYPE: ci
LOG_LEVEL: info
NETNS_MODE: off
REDIS_QUEUE_HOST: redis
REDIS_STATE_HOST: redis
ASAN_OPTIONS: "halt_on_error=1"
LSAN_OPTIONS: "suppressions=/usr/local/code/faasm/leak-sanitizer-ignorelist.txt"
UBSAN_OPTIONS: "print_stacktrace=1:halt_on_error=1"
container:
image: faasm/cli:0.8.14
services:
redis:
image: faasm/redis:0.8.14
ports:
- 6379:6379
minio:
image: faasm/minio:0.8.14
env:
MINIO_ROOT_USER: minio
MINIO_ROOT_PASSWORD: minio123
ports:
- 9000:9000
steps:
- name: "Conan cache"
uses: faasm/conan-cache-action@v1
with:
directory: /usr/local/code/faasm
- name: "Update faabric submodule"
run: git submodule update faabric
- name: "Ping redis"
run: redis-cli -h redis ping
- name: "Ping minio"
run: curl -f http://minio:9000/minio/health/live
# Download wasm generated by previous steps
- name: "Download CPP wasm"
uses: actions/download-artifact@v2
with:
name: cpp-wasm
path: /usr/local/faasm/wasm
- name: "Download libfake wasm"
uses: actions/download-artifact@v2
with:
name: libfake-wasm
path: /usr/local/faasm/runtime_root/lib/fake
- name: "Download Python wasm"
uses: actions/download-artifact@v2
with:
name: py-wasm
path: /usr/local/faasm/wasm/python
- name: "Download Python funcs"
uses: actions/download-artifact@v2
with:
name: py-funcs
path: /usr/local/faasm/shared
# Cache contains architecture-specific machine code
- name: "CPU info"
run: cat /proc/cpuinfo
- name: "Get CPU model name"
run: echo "CPU_MODEL=$(./bin/print_cpu.sh)" >> $GITHUB_ENV
- name: "Print CPU model"
run: echo "${{ env.CPU_MODEL}}"
- name: "Configure machine code cache"
uses: actions/cache@v2
with:
path: /usr/local/faasm/object
key: ${{ env.CPU_MODEL }}-machine-code-${{ secrets.CACHE_VERSION }}
# Codegen build without sanitisers
- name: "Build codegen - CMake"
run: ./bin/inv_wrapper.sh dev.cmake --build Debug --sanitiser None
- name: "Build codegen - Codegen Func"
run: ./bin/inv_wrapper.sh dev.cc codegen_func
- name: "Build codegen - Codegen Shared Obj"
run: ./bin/inv_wrapper.sh dev.cc codegen_shared_obj
# Environment set-up
- name: "Run codegen"
run: ./bin/inv_wrapper.sh codegen.local
- name: "Run python codegen"
run: ./bin/inv_wrapper.sh python.codegen
- name: "Clear existing pyc files"
run: ./bin/inv_wrapper.sh python.clear-runtime-pyc
# Code build (Debug required for tests)
- name: "Build dev tools"
run: ./bin/inv_wrapper.sh dev.tools --build Debug --sanitiser ${{ matrix.sanitiser }}
# Test run
- name: "Run the tests"
run: /build/faasm/bin/tests
sgx-tests:
if: github.event.pull_request.draft == false
needs: [cpp-funcs, py-funcs, conan-cache]
runs-on: ubuntu-latest
strategy:
fail-fast: false
env:
CGROUP_MODE: off
HOST_TYPE: ci
LOG_LEVEL: info
NETNS_MODE: off
REDIS_QUEUE_HOST: redis
REDIS_STATE_HOST: redis
container:
image: faasm/cli-sgx-sim:0.8.14
services:
redis:
image: faasm/redis:0.8.14
ports:
- 6379:6379
minio:
image: faasm/minio:0.8.14
env:
MINIO_ROOT_USER: minio
MINIO_ROOT_PASSWORD: minio123
ports:
- 9000:9000
steps:
- name: "Conan cache"
uses: faasm/conan-cache-action@v1
with:
directory: /usr/local/code/faasm
- name: "Update faabric submodule"
run: git submodule update faabric
- name: "Ping redis"
run: redis-cli -h redis ping
- name: "Ping minio"
run: curl -f http://minio:9000/minio/health/live
# Download wasm generated by previous steps
- name: "Download CPP wasm"
uses: actions/download-artifact@v2
with:
name: cpp-wasm
path: /usr/local/faasm/wasm
- name: "Download libfake wasm"
uses: actions/download-artifact@v2
with:
name: libfake-wasm
path: /usr/local/faasm/runtime_root/lib/fake
- name: "Download Python wasm"
uses: actions/download-artifact@v2
with:
name: py-wasm
path: /usr/local/faasm/wasm/python
- name: "Download Python funcs"
uses: actions/download-artifact@v2
with:
name: py-funcs
path: /usr/local/faasm/shared
# Cache contains architecture-specific machine code
- name: "CPU info"
run: cat /proc/cpuinfo
- name: "Get CPU model name"
run: echo "CPU_MODEL=$(./bin/print_cpu.sh)" >> $GITHUB_ENV
- name: "Print CPU model"
run: echo "${{ env.CPU_MODEL}}"
- name: "Configure machine code cache"
uses: actions/cache@v2
with:
path: /usr/local/faasm/object
key: ${{ env.CPU_MODEL }}-machine-code-${{ secrets.CACHE_VERSION }}
# Codegen build without sanitisers
- name: "Build codegen - CMake"
run: ./bin/inv_wrapper.sh dev.cmake --build Debug
- name: "Build codegen - Codegen Func"
run: ./bin/inv_wrapper.sh dev.cc codegen_func
- name: "Build codegen - Codegen Shared Obj"
run: ./bin/inv_wrapper.sh dev.cc codegen_shared_obj
# Environment set-up
- name: "Run codegen"
run: ./bin/inv_wrapper.sh codegen.local
- name: "Run python codegen"
run: ./bin/inv_wrapper.sh python.codegen
- name: "Clear existing pyc files"
run: ./bin/inv_wrapper.sh python.clear-runtime-pyc
# Code build (Debug required for tests)
- name: "Build dev tools"
run: ./bin/inv_wrapper.sh dev.tools --build Debug --sgx Simulation
# Test run
- name: "Run the tests"
run: /build/faasm/bin/tests
dist-tests:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ github.workspace }}
env:
CONAN_CACHE_MOUNT_SOURCE: ~/.conan
steps:
- name: "Check out code"
uses: actions/checkout@v2
- name: "Conan cache"
uses: faasm/conan-cache-action@v1
with:
directory: ${{ github.workspace }}
- name: "Update faabric submodule"
run: git submodule update --init faabric
- name: "Update cpp client submodule"
run: git submodule update --init clients/cpp
# Cache contains architecture-specific machine code
- name: "Get CPU model name"
run: echo "CPU_MODEL=$(./bin/print_cpu.sh)" >> $GITHUB_ENV
- name: "Print CPU model"
run: echo "${{ env.CPU_MODEL}}"
- name: "Configure S3 cache"
uses: actions/cache@v2
with:
path: ./dev/minio/data/faasm
key: ${{ env.CPU_MODEL }}-s3-data-${{ secrets.CACHE_VERSION }}
- name: "Build tests"
run: ./deploy/dist-test/build.sh
- name: "Build and upload functions for tests"
run: ./deploy/dist-test/upload.sh
- name: "Run tests"
run: ./deploy/dist-test/run.sh
quick-start:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ github.workspace }}
env:
PYTHON_CODEGEN: "on"
steps:
- name: "Check out code"
uses: actions/checkout@v2
- name: "Submodules"
run: git submodule update --init
# Cache contains architecture-specific machine code
- name: "Get CPU model name"
run: echo "CPU_MODEL=$(./bin/print_cpu.sh)" >> $GITHUB_ENV
- name: "Print CPU model"
run: echo "${{ env.CPU_MODEL}}"
- name: "Configure S3 cache"
uses: actions/cache@v2
with:
path: ./dev/minio/data/faasm
key: ${{ env.CPU_MODEL }}-s3-data-${{ secrets.CACHE_VERSION }}
# Setup
- name: "Start docker compose"
run: docker compose up -d --scale worker=2 nginx
# This can fail when the container isn't ready, so we want to retry
- name: "Wait for upload server to be available"
run: |
(echo "Attempt 1" && docker compose exec -T upload /usr/local/code/faasm/deploy/local/wait_for_upload.sh localhost 8002) || \
(sleep 30s && echo "Attempt 2" && docker compose exec -T upload /usr/local/code/faasm/deploy/local/wait_for_upload.sh localhost 8002) || \
(sleep 30s && echo "Attempt 3" && docker compose exec -T upload /usr/local/code/faasm/deploy/local/wait_for_upload.sh localhost 8002) || \
(echo "Wait for upload failed after retries" && docker compose logs upload && exit 1)
# Function upload
- name: "Build and upload cpp function"
run: docker compose run -T cpp inv func demo hello func.upload demo hello
- name: "Build and upload python function"
run: docker compose run -T python inv func func.upload func.uploadpy hello
# Function invocation
- name: "Invoke cpp function"
run: docker compose run -T cpp inv func.invoke demo hello | tee output_1.log
- name: "Invoke python hello function"
run: docker compose run -T python inv func.invoke python hello
# Re-invocation of same function with different code after flush
- name: "Flush workers"
run: docker compose run -T cpp inv func.flush
- name: "Build echo function and upload in place of hello function"
run: ./deploy/local/replace_hello_with_echo.sh
- name: "Invoke cpp function"
run: docker compose run -T cpp inv func.invoke demo hello | tee output_2.log
- name: "Check both outputs are different"
run: (cmp output_1.log output_2.log && exit 1 || exit 0)
# Print logs and finish
- name: "docker compose logs"
run: docker compose logs
- name: "Stop docker compose"
run: docker compose down