-
Notifications
You must be signed in to change notification settings - Fork 4
90 lines (75 loc) · 2.91 KB
/
prebuild.yaml
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
name: Upload prebuilt packages
on:
release:
types: [ created ]
jobs:
prebuilds:
name: Upload binary for (${{ matrix.os }}, ${{ matrix.node }})
strategy:
matrix:
node: [ "electron", "node" ]
os: [ "windows-latest", "macos-latest", "ubuntu-latest" ]
# CONTINUE because it can fail for completely irrelevant reason like IO timeout and that would prevent the
# whole job from restarting because some part of the packages are already published and would fail anyway
continue-on-error: true
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the code
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: "16.x"
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install LLVM (windows)
run: choco install -y llvm
if: runner.os == 'Windows'
- name: Install system libs (not windows)
run: sudo apt-get install libusb-1.0-0-dev libudev-dev
if: runner.os == 'Linux'
- name: Install build tools (windows)
run: choco install -y visualcpp-build-tools
if: runner.os == 'Windows'
- name: Install JS dependencies
run: yarn install
- name: Build Rust lib (windows)
run: yarn workspace @emeraldpay/emerald-vault-native run build:rs:${{ matrix.node }}
if: runner.os == 'Windows'
env:
# dynamic linkage may be a problem for Windows users who would need to install some extra DLLs just to make Emerald works
# so better to link them statically.
RUSTFLAGS: "-C target-feature=+crt-static"
RUST_BACKTRACE: "1"
- name: Build Rust lib (not windows)
run: yarn workspace @emeraldpay/emerald-vault-native run build:rs:${{ matrix.node }}
if: runner.os != 'Windows'
env:
RUST_BACKTRACE: "1"
# support macOS High Sierra
MACOSX_DEPLOYMENT_TARGET: "10.13"
- name: Show lib details
run: |
node_modules/@mapbox/node-pre-gyp/bin/node-pre-gyp reveal --directory packages/native
ls packages/native/native
- name: Build Typescript
run: yarn workspaces run build:ts
# Cleanup to avoid putting temp files into resulting package
- name: Clean Before Package
run: yarn workspace @emeraldpay/emerald-vault-native run clean:rs
- name: Package
run: yarn workspace @emeraldpay/emerald-vault-native run package:${{ matrix.node }}
- name: Upload
id: upload-release-asset
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
file: packages/native/build/stage/*/*.tar.gz
file_glob: true