-
Notifications
You must be signed in to change notification settings - Fork 206
591 lines (517 loc) · 28.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
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
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
name: Build
on: [push]
env:
BUILD_TYPE: Release
BUILD_CONFIG: RelWithDebInfo
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true # Remove this line when we stop using Ubuntu 18
jobs:
###############################################################################
# Build Desktop
###############################################################################
build_desktop:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-12, ubuntu-18.04, ubuntu-20.04, windows-2019]
steps:
- name: Checkout
if: matrix.os != 'ubuntu-18.04'
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Submodule update
shell: bash
run: |
git submodule update --init --recursive --jobs 4
###############################################################################
# Create Build Environment
###############################################################################
- name: Create Build Environment [macos]
if: startsWith(matrix.os, 'macos')
run: |
echo $GITHUB_WORKSPACE
echo "OPENSSL_ROOT_DIR=/usr/local/opt/[email protected]" >> $GITHUB_ENV
- name: Create Build Environment [ununtu all]
shell: bash
if: matrix.os == 'ubuntu-16.04' || matrix.os == 'ubuntu-18.04' || matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install libssl-dev curl libxi-dev libcups2-dev -y
- name: Create Build Environment [ubuntu-18.04]
shell: bash
if: matrix.os == 'ubuntu-18.04'
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update -y
sudo apt-get install g++-7 -y
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7
sudo update-alternatives --set gcc "/usr/bin/gcc-7"
- name: Create Build Environment [windows]
shell: bash
if: matrix.os == 'windows-2019'
run: |
git clone --depth=1 https://github.com/BeamMW/libs.git c:/beam-libs
echo "OPENSSL_ROOT_DIR=c:\beam-libs\openssl" >> $GITHUB_ENV
git clone https://github.com/BeamMW/boost_prebuild_${{matrix.os}}.git c:/boost_prebuild
echo "BOOST_ROOT=c:\boost_prebuild" >> $GITHUB_ENV
- name: Download boost [ubuntu && macos]
if: matrix.os != 'windows-2019'
shell: bash
run: |
rm -rf ${{runner.workspace}}/boost_prebuild
git clone --depth=1 https://github.com/BeamMW/boost_prebuild_${{matrix.os}}.git ${{runner.workspace}}/boost_prebuild
echo "BOOST_INCLUDEDIR=${{runner.workspace}}/boost_prebuild/include" >> $GITHUB_ENV
echo "BOOST_LIBRARYDIR=${{runner.workspace}}/boost_prebuild/lib/" >> $GITHUB_ENV
###############################################################################
# Configure CMake
###############################################################################
- name: Configure CMake [macos]
if: startsWith(matrix.os, 'macos')
run: |
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBEAM_LINK_TYPE=Static -DBRANCH_NAME=${GITHUB_REF##*/} -DBEAM_HW_WALLET=Off .
- name: Configure CMake [ununtu all]
if: matrix.os == 'ubuntu-16.04' || matrix.os == 'ubuntu-18.04' || matrix.os == 'ubuntu-20.04'
run: |
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBEAM_LINK_TYPE=Static -DBEAM_USE_STATIC_RUNTIME=ON -DBRANCH_NAME=${GITHUB_REF##*/} -DBEAM_HW_WALLET=Off .
- name: Configure CMake [windows]
shell: bash
if: matrix.os == 'windows-2019'
run: |
cmake --version
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_CONFIGURATION_TYPES:STRING=$BUILD_CONFIG -DBEAM_LINK_TYPE=Static -DBEAM_USE_STATIC_RUNTIME=On -DBRANCH_NAME=${GITHUB_REF##*/} -DBEAM_BUILD_JNI=Off -DBEAM_HW_WALLET=Off .
- name: Save version info
shell: bash
run: |
echo "BEAM_VERSION=$(cat beam_version.gen)" >> $GITHUB_ENV
rm beam_version.gen
###############################################################################
# Build
###############################################################################
- name: Build [macos]
if: startsWith(matrix.os, 'macos')
run: cmake --build . --parallel --config $BUILD_TYPE
- name: Build [ununtu all]
shell: bash
if: matrix.os == 'ubuntu-16.04' || matrix.os == 'ubuntu-18.04' || matrix.os == 'ubuntu-20.04'
run: make -j$(nproc)
- name: Build [windows]
shell: bash
if: matrix.os == 'windows-2019'
run: cmake --build . --config $BUILD_CONFIG --parallel
###############################################################################
# Test
###############################################################################
- name: Test [macos]
if: startsWith(matrix.os, 'macos')
continue-on-error: false
run: ctest -C $BUILD_TYPE --verbose
- name: Test [ununtu all]
if: matrix.os == 'ubuntu-16.04' || matrix.os == 'ubuntu-18.04' || matrix.os == 'ubuntu-20.04'
continue-on-error: false
shell: bash
run: ctest --verbose
- name: Test [windows]
if: matrix.os == 'windows-2019'
continue-on-error: false
shell: bash
run: ctest -C $BUILD_CONFIG --verbose
###############################################################################
# Collect artifacts
###############################################################################
- name: Import Code-Signing Certificates [macos]
if: startsWith(matrix.os, 'macos')
uses: Apple-Actions/import-codesign-certs@v2
with:
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
- name: Sign the mac binaries [macos]
if: startsWith(matrix.os, 'macos')
run: |
codesign --sign "Developer ID Application" --deep --force --verbose --options runtime --timestamp beam/beam-node
codesign --sign "${{secrets.MACOS_SIGN_IDENTITY}}" --deep --force --verbose --options runtime --timestamp beam/beam-node
codesign --deep --force -v -s "${{secrets.MACOS_SIGN_IDENTITY}}" -o runtime --timestamp beam/beam-node
codesign --deep --force -v -s "${{secrets.MACOS_SIGN_IDENTITY}}" -o runtime --timestamp wallet/cli/beam-wallet
codesign --deep --force -v -s "${{secrets.MACOS_SIGN_IDENTITY}}" -o runtime --timestamp wallet/api/wallet-api
codesign --deep --force -v -s "${{secrets.MACOS_SIGN_IDENTITY}}" -o runtime --timestamp explorer/explorer-node
codesign --deep --force -v -s "${{secrets.MACOS_SIGN_IDENTITY}}" -o runtime --timestamp wallet/broadcaster/broadcaster
codesign --deep --force -v -s "${{secrets.MACOS_SIGN_IDENTITY}}" -o runtime --timestamp bvm/ethash_service/ethash-service
- name: Checksum [ubuntu]
if: matrix.os == 'ubuntu-16.04' || matrix.os =='ubuntu-18.04' || matrix.os == 'ubuntu-20.04'
run: |
sha256sum beam/beam-node > beam/beam-node-checksum.txt
sha256sum wallet/cli/beam-wallet > wallet/cli/beam-wallet-checksum.txt
sha256sum wallet/api/wallet-api > wallet/api/wallet-api-checksum.txt
sha256sum explorer/explorer-node > explorer/explorer-node-checksum.txt
sha256sum wallet/broadcaster/broadcaster > wallet/broadcaster/broadcaster-checksum.txt
sha256sum bvm/ethash_service/ethash-service > bvm/ethash_service/ethash-service-checksum.txt
- name: Checksum [macos]
if: startsWith(matrix.os, 'macos')
run: |
shasum -a 256 beam/beam-node > beam/beam-node-checksum.txt
shasum -a 256 wallet/cli/beam-wallet > wallet/cli/beam-wallet-checksum.txt
shasum -a 256 wallet/api/wallet-api > wallet/api/wallet-api-checksum.txt
shasum -a 256 explorer/explorer-node > explorer/explorer-node-checksum.txt
shasum -a 256 wallet/broadcaster/broadcaster > wallet/broadcaster/broadcaster-checksum.txt
shasum -a 256 bvm/ethash_service/ethash-service > bvm/ethash_service/ethash-service-checksum.txt
- name: Collect [macos && ununtu all]
shell: bash
if: matrix.os != 'windows-2019'
run: |
mkdir artifacts
tar -cvf artifacts/beam-node.tar -C beam beam-node beam-node-checksum.txt beam-node.cfg
tar -cvf artifacts/beam-wallet.tar -C wallet/cli beam-wallet beam-wallet-checksum.txt beam-wallet.cfg
tar -cvf artifacts/wallet-api.tar -C wallet/api wallet-api wallet-api-checksum.txt wallet-api.cfg
tar -cvf artifacts/explorer-node.tar -C explorer explorer-node explorer-node-checksum.txt explorer-node.cfg
tar -cvf artifacts/broadcaster.tar -C wallet/broadcaster broadcaster broadcaster-checksum.txt
tar -cvf artifacts/ethash-service.tar -C bvm/ethash_service ethash-service ethash-service-checksum.txt
- name: Collect [windows]
shell: bash
if: matrix.os == 'windows-2019'
run: |
mkdir artifacts
cp beam/${{env.BUILD_CONFIG}}/beam-node.exe artifacts/beam-node.exe
cp beam/beam-node.cfg artifacts/beam-node.cfg
cp wallet/cli/${{env.BUILD_CONFIG}}/beam-wallet.exe artifacts/beam-wallet.exe
cp wallet/cli/beam-wallet.cfg artifacts/beam-wallet.cfg
cp wallet/api/${{env.BUILD_CONFIG}}/wallet-api.exe artifacts/wallet-api.exe
cp wallet/api/wallet-api.cfg artifacts/wallet-api.cfg
cp explorer/${{env.BUILD_CONFIG}}/explorer-node.exe artifacts/explorer-node.exe
cp explorer/explorer-node.cfg artifacts/explorer-node.cfg
cp wallet/broadcaster/${{env.BUILD_CONFIG}}/broadcaster.exe artifacts/broadcaster.exe
cp bvm/ethash_service/${{env.BUILD_CONFIG}}/ethash-service.exe artifacts/ethash-service.exe
cp 3rdparty/asio-ipfs/ipfs_bindings/ipfs-bindings.dll artifacts/ipfs-bindings.dll
- name: Collect pdb [windows]
shell: bash
if: matrix.os == 'windows-2019'
run: |
mkdir pdb
cp beam/${{env.BUILD_CONFIG}}/beam-node.pdb pdb/beam-node.pdb
cp wallet/cli/${{env.BUILD_CONFIG}}/beam-wallet.pdb pdb/beam-wallet.pdb
cp wallet/api/${{env.BUILD_CONFIG}}/wallet-api.pdb pdb/wallet-api.pdb
cp explorer/${{env.BUILD_CONFIG}}/explorer-node.pdb pdb/explorer-node.pdb
cp wallet/broadcaster/${{env.BUILD_CONFIG}}/broadcaster.pdb pdb/broadcaster.pdb
cp bvm/ethash_service/${{env.BUILD_CONFIG}}/ethash-service.pdb pdb/ethash-service.pdb
- name: Checksum [windows]
if: matrix.os == 'windows-2019'
run: |
certUtil -hashfile artifacts/beam-node.exe SHA256 > artifacts/beam-node-checksum.txt
certUtil -hashfile artifacts/beam-wallet.exe SHA256 > artifacts/beam-wallet-checksum.txt
certUtil -hashfile artifacts/wallet-api.exe SHA256 > artifacts/wallet-api-checksum.txt
certUtil -hashfile artifacts/explorer-node.exe SHA256 > artifacts/explorer-node-checksum.txt
certUtil -hashfile artifacts/broadcaster.exe SHA256 > artifacts/broadcaster-checksum.txt
certUtil -hashfile artifacts/ethash-service.exe SHA256 > artifacts/ethash-service-checksum.txt
certUtil -hashfile artifacts/ipfs-bindings.dll SHA256 > artifacts/ipfs-bindings-checksum.txt
- name: OS name [macos]
if: startsWith(matrix.os, 'macos')
run: echo "PLATFORM_NAME=mac" >> $GITHUB_ENV
- name: OS name [ununtu all]
shell: bash
if: matrix.os == 'ubuntu-16.04' || matrix.os == 'ubuntu-18.04' || matrix.os == 'ubuntu-20.04'
run: echo "PLATFORM_NAME=linux" >> $GITHUB_ENV
- name: OS name [ununtu-18.04]
shell: bash
if: matrix.os == 'ubuntu-18.04'
run: echo "PLATFORM_NAME=ubuntu-18" >> $GITHUB_ENV
- name: OS name [windows]
shell: bash
if: matrix.os == 'windows-2019'
run: echo "PLATFORM_NAME=win" >> $GITHUB_ENV
###############################################################################
# Upload
###############################################################################
- uses: actions/upload-artifact@v4
with:
name: ${{env.PLATFORM_NAME}}-beam-node-${{env.BEAM_VERSION}}
path: artifacts/beam-node*
if-no-files-found: error
- uses: actions/upload-artifact@v4
with:
name: ${{env.PLATFORM_NAME}}-beam-wallet-cli-${{env.BEAM_VERSION}}
path: artifacts/beam-wallet*
if-no-files-found: error
- uses: actions/upload-artifact@v4
with:
name: ${{env.PLATFORM_NAME}}-wallet-api-${{env.BEAM_VERSION}}
path: |
artifacts/wallet-api*
artifacts/ipfs-bindings*
if-no-files-found: error
- uses: actions/upload-artifact@v4
with:
name: ${{env.PLATFORM_NAME}}-explorer-node-${{env.BEAM_VERSION}}
path: artifacts/explorer-node*
if-no-files-found: error
- uses: actions/upload-artifact@v4
with:
name: ${{env.PLATFORM_NAME}}-broadcaster-${{env.BEAM_VERSION}}
path: artifacts/broadcaster*
if-no-files-found: error
- uses: actions/upload-artifact@v4
with:
name: ${{env.PLATFORM_NAME}}-ethash-service-${{env.BEAM_VERSION}}
path: artifacts/ethash-service*
if-no-files-found: error
###############################################################################
# Upload windows pdb
###############################################################################
- uses: actions/upload-artifact@v4
if: matrix.os == 'windows-2019'
with:
name: pdb-${{env.BEAM_VERSION}}
path: pdb
if-no-files-found: error
###############################################################################
# Build IOS
###############################################################################
build_ios:
runs-on: macos-latest
#if: ${{false}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Submodule update
shell: bash
run: |
git submodule update --init --recursive --jobs 4
###############################################################################
# Create Build Environment
###############################################################################
- name: Create Build Environment
run: |
git clone --depth=1 https://github.com/BeamMW/boost-ios.git ${{runner.workspace}}/dependencies/boost-ios
git clone --depth=1 https://github.com/BeamMW/boost-ios-simulator.git ${{runner.workspace}}/dependencies/boost-ios-simulator
git clone --depth=1 https://github.com/BeamMW/openssl-ios.git ${{runner.workspace}}/dependencies/openssl-ios
git clone --depth=1 https://github.com/leetal/ios-cmake.git ${{runner.workspace}}/dependencies/toolchain-ios
# echo "BUILD_TYPE=Release" >> $GITHUB_ENV
echo "OPENSSL_ROOT_DIR=${{runner.workspace}}/dependencies/openssl-ios/" >> $GITHUB_ENV
echo "OPENSSL_CRYPTO_LIBRARY=${{runner.workspace}}/dependencies/openssl-ios/lib/libcrypto.a" >> $GITHUB_ENV
echo "OPENSSL_INCLUDE_DIR=${{runner.workspace}}/dependencies/openssl-ios/include" >> $GITHUB_ENV
echo "OPENSSL_SSL_LIBRARY=${{runner.workspace}}/dependencies/openssl-ios/lib/libssl.a" >> $GITHUB_ENV
echo "OPENSSL_LIBRARIES=${{runner.workspace}}/dependencies/openssl-ios/lib" >> $GITHUB_ENV
###############################################################################
# Configure CMake && Build
###############################################################################
- name: Configure CMake && Build
run: |
export BOOST_ROOT_IOS="${{runner.workspace}}/dependencies/boost-ios"
cmake . -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_TOOLCHAIN_FILE=${{runner.workspace}}/dependencies/toolchain-ios/ios.toolchain.cmake -DPLATFORM=OS64 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DDEPLOYMENT_TARGET=11.0 -DENABLE_BITCODE=NO -DOPENSSL_ROOT_DIR=$OPENSSL_ROOT_DIR -DOPENSSL_CRYPTO_LIBRARY=$OPENSSL_CRYPTO_LIBRARY -DOPENSSL_INCLUDE_DIR=$OPENSSL_INCLUDE_DIR -DOPENSSL_SSL_LIBRARY=$OPENSSL_SSL_LIBRARY -DOPENSSL_LIBRARIES=$OPENSSL_LIBRARIES -DIOS=YES -Wno-error=deprecated-declarations -Wno-error=deprecated -DCMAKE_TRY_COMPILE_PLATFORM_VARIABLES=CMAKE_WARN_DEPRECATED -DBEAM_IPFS_SUPPORT=Off -B./build
make -C ./build -j$(sysctl -n hw.ncpu)
export BOOST_ROOT_IOS="${{runner.workspace}}/dependencies/boost-ios-simulator"
cmake . -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_TOOLCHAIN_FILE=${{runner.workspace}}/dependencies/toolchain-ios/ios.toolchain.cmake -DPLATFORM=SIMULATOR64 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DDEPLOYMENT_TARGET=11.0 -DENABLE_BITCODE=NO -DOPENSSL_ROOT_DIR=$OPENSSL_ROOT_DIR -DOPENSSL_CRYPTO_LIBRARY=$OPENSSL_CRYPTO_LIBRARY -DOPENSSL_INCLUDE_DIR=$OPENSSL_INCLUDE_DIR -DOPENSSL_SSL_LIBRARY=$OPENSSL_SSL_LIBRARY -DOPENSSL_LIBRARIES=$OPENSSL_LIBRARIES -DIOS=YES -Wno-error=deprecated-declarations -Wno-error=deprecated -DCMAKE_TRY_COMPILE_PLATFORM_VARIABLES=CMAKE_WARN_DEPRECATED -DBEAM_IPFS_SUPPORT=Off -B./build-simulator
make -C ./build-simulator -j$(sysctl -n hw.ncpu)
- name: Save version info
run: |
echo "BEAM_VERSION=$(cat beam_version.gen)" >> $GITHUB_ENV
rm beam_version.gen
###############################################################################
# Collect artifacts
###############################################################################
- name: Collect
run: |
echo BEAM_VERSION = $BEAM_VERSION
mkdir -p ${{runner.workspace}}/results/beam-ios/include
mkdir -p ${{runner.workspace}}/results/beam-ios/lib
find ./build -name \*.a -type f -exec cp {} ${{runner.workspace}}/results/beam-ios/lib/ \;
rsync -am --include='*.h' --include='*.hpp' --include='*/' --exclude='*' . ${{runner.workspace}}/results/beam-ios/include/
cp ./build/core/version.h ${{runner.workspace}}/results/beam-ios/include/core/
mkdir -p ${{runner.workspace}}/results/beam-ios-simulator/include
mkdir -p ${{runner.workspace}}/results/beam-ios-simulator/lib
find ./build-simulator -name \*.a -type f -exec cp {} ${{runner.workspace}}/results/beam-ios-simulator/lib/ \;
rsync -am --include='*.h' --include='*.hpp' --include='*/' --exclude='*' . ${{runner.workspace}}/results/beam-ios-simulator/include/
cp ./build/core/version.h ${{runner.workspace}}/results/beam-ios-simulator/include/core/
mkdir -p ${{runner.workspace}}/results/beam-ios-combined/include
mkdir -p ${{runner.workspace}}/results/beam-ios-combined/lib
find ${{runner.workspace}}/results/beam-ios/lib -type f -print0 | while IFS= read -r -d $'\0' file; do lipo -create -output ${{runner.workspace}}/results/beam-ios-combined/lib/$(basename "$file") "$file" ${{runner.workspace}}/results/beam-ios-simulator/lib/$(basename "$file"); done;
rsync -am --include='*.h' --include='*.hpp' --include='*/' --exclude='*' . ${{runner.workspace}}/results/beam-ios-combined/include/
###############################################################################
# Upload
###############################################################################
- uses: actions/upload-artifact@v4
with:
name: beam-ios-${{env.BEAM_VERSION}}
path: ${{runner.workspace}}/results/beam-ios
if-no-files-found: error
- uses: actions/upload-artifact@v4
with:
name: beam-ios-simulator-${{env.BEAM_VERSION}}
path: ${{runner.workspace}}/results/beam-ios-simulator
if-no-files-found: error
- uses: actions/upload-artifact@v4
with:
name: beam-ios-combined-${{env.BEAM_VERSION}}
path: ${{runner.workspace}}/results/beam-ios-combined
if-no-files-found: error
###############################################################################
# Build ANDROID
###############################################################################
build_android:
runs-on: ubuntu-20.04
#if: ${{false}}
strategy:
matrix:
abi: [x86, x86_64, armeabi-v7a, arm64-v8a]
env:
ANDROID_ABI: ${{matrix.abi}}
ANDROID_SDK_VERSION: 25
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Submodule update
shell: bash
run: |
git submodule update --init --recursive --jobs 4
###############################################################################
# Create Build Environment
###############################################################################
- name: Create Build Environment
run: |
git clone --depth=1 https://github.com/BeamMW/boost-android.git ${{runner.workspace}}/dependencies/boost_1_68-android
git clone --depth=1 https://github.com/BeamMW/openssl-android.git ${{runner.workspace}}/dependencies/Prebuilt-OpenSSL-Android
echo "ANDROID_NDK_HOME=$ANDROID_NDK_LATEST_HOME" >> $GITHUB_ENV
ls /usr/local/lib/android/sdk
echo "BOOST_ROOT_ANDROID=${{runner.workspace}}/dependencies/boost_1_68-android" >> $GITHUB_ENV
echo "OPENSSL_ROOT_DIR_ANDROID=${{runner.workspace}}/dependencies/Prebuilt-OpenSSL-Android" >> $GITHUB_ENV
###############################################################################
# Configure CMake
###############################################################################
- name: Configure CMake
run: |
export PATH=${{env.ANDROID_NDK_HOME}}:$PATH
cmake -DCMAKE_TOOLCHAIN_FILE=${{env.ANDROID_NDK_HOME}}/build/cmake/android.toolchain.cmake -DANDROID_NATIVE_API_LEVEL=${{env.ANDROID_SDK_VERSION}} -DANDROID_ABI=${{env.ANDROID_ABI}} -DBEAM_IPFS_SUPPORT=Off -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} .
###############################################################################
# Build
###############################################################################
- name: Build
run: |
export PATH=${{env.ANDROID_NDK_HOME}}:$PATH
make wallet-jni -j$(nproc)
- name: Save version info
run: |
echo "BEAM_VERSION=$(cat beam_version.gen)" >> $GITHUB_ENV
rm beam_version.gen
###############################################################################
# Upload
###############################################################################
- uses: actions/upload-artifact@v4
with:
name: libwallet-jni-${{env.ANDROID_ABI}}-${{env.BEAM_VERSION}}
path: |
android/libwallet-jni.so
android/com
if-no-files-found: error
###############################################################################
# Build Key Keeper Web Assembly
###############################################################################
build_key_keeper:
if: ${{false}} # disabled
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Submodule update
shell: bash
run: |
git submodule update --init --recursive --jobs 4
###############################################################################
# Create Build Environment
###############################################################################
- name: Download and install emscripten
shell: bash
run: |
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
git pull
./emsdk install 3.1.10
./emsdk activate 3.1.10
- name: Download boost
shell: bash
run: |
git clone --depth=1 https://github.com/BeamMW/boost-linux.git ${{runner.workspace}}/boost_prebuild
echo "BOOST_ROOT=${{runner.workspace}}/boost_prebuild" >> $GITHUB_ENV
###############################################################################
# Configure CMake
###############################################################################
- name: Configure CMake
run: |
source ./emsdk/emsdk_env.sh
emcmake cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE keykeeper
###############################################################################
# Build
###############################################################################
- name: Build
run: |
make -j$(nproc)
###############################################################################
# Upload
###############################################################################
- uses: actions/upload-artifact@v4
with:
name: wasm-key-keeper
path: |
wasm-key-keeper.*
if-no-files-found: error
###############################################################################
# Build Web Assembly
###############################################################################
build_wasm:
runs-on: ubuntu-20.04
#if: ${{false}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Submodule update
shell: bash
run: |
git submodule update --init --recursive --jobs 4
###############################################################################
# Create Build Environment
###############################################################################
- name: Download and install emscripten
shell: bash
run: |
git clone https://github.com/emscripten-core/emsdk.git ${{runner.workspace}}/emsdk
cd ${{runner.workspace}}/emsdk
git pull
./emsdk install 3.1.10
./emsdk activate 3.1.10
- name: Download boost
shell: bash
run: |
git clone --depth=1 https://github.com/BeamMW/boost_prebuild_ubuntu-20.04.git ${{runner.workspace}}/boost_prebuild
echo "BOOST_INCLUDEDIR=${{runner.workspace}}/boost_prebuild/include" >> $GITHUB_ENV
echo "BOOST_LIBRARYDIR=${{runner.workspace}}/boost_prebuild/lib/" >> $GITHUB_ENV
- name: Download openssl
shell: bash
run: |
git clone --depth=1 https://github.com/BeamMW/openssl-wasm.git ${{runner.workspace}}/openssl-wasm
###############################################################################
# Configure CMake && Build
###############################################################################
- name: Configure CMake && Build
run: |
source ${{runner.workspace}}/emsdk/emsdk_env.sh
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=${{runner.workspace}}/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DBoost_DEBUG=On -DBEAM_TESTS_ENABLED=Off -DBEAM_WALLET_CLIENT_LIBRARY=On -DBEAM_ATOMIC_SWAP_SUPPORT=Off -DBEAM_IPFS_SUPPORT=Off -DBEAM_LASER_SUPPORT=Off -DBEAM_ASSET_SWAP_SUPPORT=Off -DBEAM_USE_STATIC=On -DBOOST_ROOT=${{runner.workspace}}/boost_prebuild -DCMAKE_FIND_ROOT_PATH:FILEPATH="${{runner.workspace}}/boost_prebuild;${{runner.workspace}}/openssl-wasm" -DOPENSSL_ROOT_DIR=${{runner.workspace}}/openssl-wasm -B${{runner.workspace}}/build_wasm
emmake make -j$(nproc) -C ${{runner.workspace}}/build_wasm
- name: Save version info
run: |
echo "BEAM_VERSION=$(cat beam_version.gen)" >> $GITHUB_ENV
rm beam_version.gen
###############################################################################
# Upload
###############################################################################
- uses: actions/upload-artifact@v4
with:
name: beam-wasm-${{env.BEAM_VERSION}}
path: |
${{runner.workspace}}/build_wasm/wasmclient/wasm-client.*
if-no-files-found: error
- uses: actions/setup-node@v4
with:
registry-url: "https://registry.npmjs.org"
- run: npm publish ${{runner.workspace}}/build_wasm/wasmclient/
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}