-
Notifications
You must be signed in to change notification settings - Fork 25
484 lines (420 loc) · 17.3 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
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
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
name: Build
on:
push:
branches:
- main
- "test/*"
pull_request:
types: [assigned, opened, synchronize, reopened, labeled]
paths:
- ".github/workflows/build.yml"
# C++
- "CMakeLists.txt"
- "contracts/**"
- "external/CMakeLists.txt"
- "libraries/**"
- "native/**"
- "programs/**"
- "wasm/**"
# box, webapp
- ".eslintignore"
- ".eslintrc.js"
- ".prettierrc.json"
- "lerna.json"
- "package.json"
- "packages/common/**"
- "tsconfig.build.json"
- "tsconfig.json"
- "yarn.lock"
# box
- "docker/eden-box.Dockerfile"
- "packages/box/**"
# webapp
- "docker/eden-webapp.Dockerfile"
- "packages/webapp/**"
jobs:
build-cpp:
name: Build C++
runs-on: ubuntu-latest
container: ghcr.io/gofractally/eden-builder:latest
steps:
- name: ✅ Checkout code
uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
src:
- ".github/workflows/build.yml"
- "CMakeLists.txt"
- "contracts/**"
- "external/CMakeLists.txt"
- "libraries/**"
- "native/**"
- "programs/**"
- "wasm/**"
- name: Prepare ccache timestamp
if: steps.filter.outputs.src == 'true'
id: ccache_cache_timestamp
shell: cmake -P {0}
run: |
string(TIMESTAMP current_date "%Y-%m-%d-%H-%M-%S" UTC)
message("::set-output name=timestamp::${current_date}")
- name: show_cache
if: steps.filter.outputs.src == 'true'
id: show_cache
run: |
echo "${{ runner.os }}-ccache_whole-${{ steps.ccache_cache_timestamp.outputs.timestamp }}"
echo "${{ runner.os }}-product_cache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}"
- name: ccache cache files
if: steps.filter.outputs.src == 'true'
uses: actions/[email protected]
with:
path: .ccache
key: ${{ runner.os }}-ccache_whole-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: |
${{ runner.os }}-ccache_whole-
- name: product cache files
uses: actions/[email protected]
with:
path: product_cache
key: ${{ runner.os }}-product_cache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: |
${{ runner.os }}-product_cache-
- name: 🛠 Build
if: steps.filter.outputs.src == 'true'
run: |
set -e
export CCACHE_DIR=${GITHUB_WORKSPACE}/.ccache
export CCACHE_CONFIGPATH=${GITHUB_WORKSPACE}/.github/ccache.conf
echo =====
pwd
echo ${GITHUB_WORKSPACE}
echo =====
ccache -s
echo =====
git submodule update --init --recursive
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DSKIP_TS=Yes -DEDEN_ATOMIC_ASSETS_ACCOUNT=atomicassets -DEDEN_ATOMIC_MARKET_ACCOUNT=atomicmarket -DEDEN_SCHEMA_NAME=members ..
make -j$(nproc)
tar czf clsdk-ubuntu-20-04.tar.gz clsdk
rm -rf ../product_cache
mkdir -p ../product_cache/clsdk/contracts
cp clsdk-ubuntu-20-04.tar.gz ../product_cache
cp atomicassets.abi ../product_cache
cp atomicassets.wasm ../product_cache
cp atomicmarket.abi ../product_cache
cp atomicmarket.wasm ../product_cache
cp clsdk/contracts/bios.wasm ../product_cache/clsdk/contracts/bios.wasm
cp boot.wasm ../product_cache
cp eden-micro-chain.wasm ../product_cache
cp eden.abi ../product_cache
cp eden.wasm ../product_cache
cp run-elections.wasm ../product_cache
cp run-genesis.wasm ../product_cache
cp run-complete-elections.wasm ../product_cache
cp token.abi ../product_cache
cp token.wasm ../product_cache
echo =====
ls -la ${GITHUB_WORKSPACE}
echo =====
ccache -s
echo =====
- name: 🧪 Run tests with CTest
if: steps.filter.outputs.src == 'true'
run: cd build && ctest -j$(nproc) -V
- name: 📃 Upload ccache.log
if: steps.filter.outputs.src == 'true'
uses: actions/upload-artifact@v2
with:
name: ccache_log
path: |
ccache.log
- name: 📃 Upload clsdk
uses: actions/upload-artifact@v2
with:
name: clsdk
path: |
product_cache/clsdk-ubuntu-20-04.tar.gz
- name: 📃 Upload Eden Smart Contract
uses: actions/upload-artifact@v2
with:
name: Eden Smart Contract
path: |
product_cache/eden.abi
product_cache/eden.wasm
product_cache/eden-micro-chain.wasm
- name: 📃 Upload Ephemeral Eden Chains Runners
uses: actions/upload-artifact@v2
with:
name: Ephemeral Eden Chains Runners
path: |
product_cache/atomicassets.abi
product_cache/atomicassets.wasm
product_cache/atomicmarket.abi
product_cache/atomicmarket.wasm
product_cache/clsdk/contracts/bios.wasm
product_cache/boot.wasm
product_cache/eden.abi
product_cache/eden.wasm
product_cache/token.abi
product_cache/token.wasm
product_cache/run-genesis.wasm
product_cache/run-elections.wasm
product_cache/run-complete-elections.wasm
build-micro-chain:
name: Build Micro Chain
runs-on: ubuntu-latest
container: ghcr.io/gofractally/eden-builder:latest
steps:
- name: ✅ Checkout code
uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
shell: cmake -P {0}
run: |
string(TIMESTAMP current_date "%Y-%m-%d-%H-%M-%S" UTC)
message("::set-output name=timestamp::${current_date}")
- name: show_cache
id: show_cache
run: echo "${{ runner.os }}-ccache_microchain-${{ steps.ccache_cache_timestamp.outputs.timestamp }}"
- name: ccache cache files
uses: actions/[email protected]
with:
path: .ccache
key: ${{ runner.os }}-ccache_microchain-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: |
${{ runner.os }}-ccache_microchain-
- name: 🛠 Build
run: |
set -e
export CCACHE_DIR=${GITHUB_WORKSPACE}/.ccache
export CCACHE_CONFIGPATH=${GITHUB_WORKSPACE}/.github/ccache.conf
echo =====
pwd
echo ${GITHUB_WORKSPACE}
echo =====
ccache -s
echo =====
git submodule update --init external/atomicassets-contract
git submodule update --init external/Catch2
git submodule update --init external/fmt
git submodule update --init external/rapidjson
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DSKIP_TS=Yes -DEDEN_ATOMIC_ASSETS_ACCOUNT=atomicassets -DEDEN_ATOMIC_MARKET_ACCOUNT=atomicmarket -DEDEN_SCHEMA_NAME=members -DBUILD_NATIVE=OFF ..
make -j$(nproc) wasm-configure
bash -c "cd wasm && make -j$(nproc) eden-micro-chain"
echo =====
ls -la ${GITHUB_WORKSPACE}
echo =====
ccache -s
echo =====
- name: 📃 Upload ccache.log
uses: actions/upload-artifact@v2
with:
name: microchain_ccache_log
path: |
ccache.log
- name: 📃 Upload Eden Microchain
uses: actions/upload-artifact@v2
with:
name: Eden Microchain
path: |
build/eden-micro-chain.wasm
box-build:
needs: build-micro-chain
name: Build Eden Box
runs-on: ubuntu-latest
steps:
- name: ✅ Checkout code
uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
src:
- ".github/workflows/build.yml"
- ".eslintignore"
- ".eslintrc.js"
- ".prettierrc.json"
- "lerna.json"
- "package.json"
- "packages/common/**"
- "tsconfig.build.json"
- "tsconfig.json"
- "yarn.lock"
- "docker/eden-box.Dockerfile"
- "packages/box/**"
- name: Download Eden Microchain
if: steps.filter.outputs.src == 'true'
uses: actions/download-artifact@v2
with:
name: Eden Microchain
path: build
- name: Image Preparation
if: steps.filter.outputs.src == 'true'
id: prep
run: |
REGISTRY="ghcr.io"
IMAGE="${REGISTRY}/${{ github.repository_owner }}/eden-box"
TAGS="${IMAGE}:${{ github.sha }}"
if [[ $GITHUB_REF == ref/head/master ]]; then
TAGS="${TAGS},${IMAGE}:latest"
fi
echo ::set-output name=tags::${TAGS,,}
- name: Showtag
if: steps.filter.outputs.src == 'true'
id: showtag
run: echo ${{ steps.prep.outputs.tags }}
- name: Docker Buildx setup
if: steps.filter.outputs.src == 'true'
uses: docker/setup-buildx-action@v1
- name: Login in to registry
if: steps.filter.outputs.src == 'true'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 🛠 Build & Publish Image
if: steps.filter.outputs.src == 'true'
uses: docker/build-push-action@v2
with:
push: true
file: docker/eden-box.Dockerfile
tags: ${{ steps.prep.outputs.tags }}
context: .
e2e:
needs: [build-cpp, build-micro-chain]
name: E2E Tests
environment: e2e_tests
runs-on: ubuntu-latest
steps:
- name: ✅ Checkout code
uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
src:
- ".github/workflows/build.yml"
- ".eslintignore"
- ".eslintrc.js"
- ".prettierrc.json"
- "lerna.json"
- "package.json"
- "packages/common/**"
- "tsconfig.build.json"
- "tsconfig.json"
- "yarn.lock"
- "scripts/eden_chain_runner.sh"
- "packages/**"
- "contracts/**"
- name: Download Eden Microchain
if: steps.filter.outputs.src == 'true'
uses: actions/download-artifact@v2
with:
name: Eden Microchain
path: build
- name: Download Ephemeral Eden Chain Runners
if: steps.filter.outputs.src == 'true'
uses: actions/download-artifact@v2
with:
name: Ephemeral Eden Chains Runners
path: build
- name: Download clsdk
if: steps.filter.outputs.src == 'true'
uses: actions/download-artifact@v2
with:
name: clsdk
path: build
- name: Start Genesis Ephemeral Chain
if: steps.filter.outputs.src == 'true'
run: |
cp ./scripts/eden_chain_runner.sh ./build
cd build
tar -xvf clsdk-ubuntu-20-04.tar.gz clsdk/bin
ls -la
sh -x ./eden_chain_runner.sh run-genesis.wasm
- name: 🛠 Build and Start WebApp
if: steps.filter.outputs.src == 'true'
run: |
export DFUSE_PREVENT_CONNECT=1
export NODE_ENV=test
env
yarn
yarn build --stream --ignore @edenos/example-history-app
yarn start-test --stream --ignore @edenos/example-history-app &
env:
IPFS_PINATA_JWT: ${{ secrets.IPFS_PINATA_JWT }}
- name: 🧪 Run E2E
if: steps.filter.outputs.src == 'true'
run: |
yarn test --stream
- name: 🎥 Upload Cypress Results
if: always() && steps.filter.outputs.src == 'true'
uses: actions/upload-artifact@v2
with:
name: Cypress E2E Videos and Screenshots
path: |
packages/webapp/cypress/screenshots
packages/webapp/cypress/videos
webapp-build:
needs: build-micro-chain
name: Build Eden Community WebApp
runs-on: ubuntu-latest
steps:
- name: ✅ Checkout code
uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
src:
- ".github/workflows/build.yml"
- ".eslintignore"
- ".eslintrc.js"
- ".prettierrc.json"
- "lerna.json"
- "package.json"
- "packages/common/**"
- "tsconfig.build.json"
- "tsconfig.json"
- "yarn.lock"
- "docker/eden-webapp.Dockerfile"
- "packages/webapp/**"
- name: Image Preparation
if: steps.filter.outputs.src == 'true'
id: prep
run: |
REGISTRY="ghcr.io"
IMAGE="${REGISTRY}/${{ github.repository_owner }}/eden-webapp"
TAGS="${IMAGE}:${{ github.sha }}"
if [[ $GITHUB_REF == ref/head/master ]]; then
TAGS="${TAGS},${IMAGE}:latest"
fi
echo ::set-output name=tags::${TAGS,,}
- name: Showtag
if: steps.filter.outputs.src == 'true'
id: showtag
run: echo ${{ steps.prep.outputs.tags }}
- name: Docker Buildx setup
if: steps.filter.outputs.src == 'true'
uses: docker/setup-buildx-action@v1
- name: Login in to registry
if: steps.filter.outputs.src == 'true'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 🛠 Build & Publish Image
if: steps.filter.outputs.src == 'true'
uses: docker/build-push-action@v2
with:
push: true
file: docker/eden-webapp.Dockerfile
tags: ${{ steps.prep.outputs.tags }}
context: .