-
Notifications
You must be signed in to change notification settings - Fork 6
306 lines (272 loc) · 13.1 KB
/
deploy.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
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
name: Build and upload assets
on:
release:
types: [ published ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
TARGET: linux-gnu/amd64
- os: ubuntu-latest
TARGET: linux-gnu/aarch64
- os: ubuntu-latest
TARGET: linux-musl/amd64
- os: ubuntu-latest
TARGET: linux-musl/aarch64
- os: windows-latest
TARGET: windows-gnullvm/amd64
- os: windows-latest
TARGET: windows-msvc/amd64
- os: macos-latest
TARGET: macos/amd64
- os: macos-latest
TARGET: macos/aarch64
name: Building, ${{ matrix.TARGET }}
steps:
- name: Fix CRLF on Windows
if: runner.os == 'Windows'
run: git config --global core.autocrlf false
- name: Checkout sources
uses: actions/checkout@v4
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install zig on Linux
if: runner.os == 'Linux'
uses: goto-bus-stop/setup-zig@v2 # needed for cargo-zigbuild
- name: Install protoc on Linux
if: runner.os == 'Linux'
uses: taiki-e/install-action@v2
with:
tool: protoc
- name: Install protoc on macOS
if: runner.os == 'macOS'
uses: taiki-e/install-action@v2
with:
tool: protoc
- name: Install msys2 on Windows
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
msystem: clang64
install: mingw-w64-clang-x86_64-clang mingw-w64-clang-x86_64-protobuf zip
- name: Build on Linux for linux-gnu/amd64
if: matrix.TARGET == 'linux-gnu/amd64'
env:
TARGET_CC: x86_64-linux-gnu-gcc
TARGET_CXX: x86_64-linux-gnu-g++
RUSTFLAGS: -C linker=x86_64-linux-gnu-gcc
run: |
rustup target add x86_64-unknown-linux-gnu
cargo build --target x86_64-unknown-linux-gnu --bin karlsend --release
cargo build --target x86_64-unknown-linux-gnu --bin simpa --release
cargo build --target x86_64-unknown-linux-gnu --bin rothschild --release
cargo build --target x86_64-unknown-linux-gnu --bin karlsen-wallet --release
mkdir bin || true
cp target/x86_64-unknown-linux-gnu/release/karlsend bin/
cp target/x86_64-unknown-linux-gnu/release/simpa bin/
cp target/x86_64-unknown-linux-gnu/release/rothschild bin/
cp target/x86_64-unknown-linux-gnu/release/karlsen-wallet bin/
archive="bin/rusty-karlsen-${{ github.event.release.tag_name }}-linux-gnu-amd64.zip"
zip -r "${archive}" ./bin/*
- name: Build on Linux for linux-gnu/aarch64
if: matrix.TARGET == 'linux-gnu/aarch64'
env:
TARGET_CC: aarch64-linux-gnu-gcc
TARGET_CXX: aarch64-linux-gnu-g++
RUSTFLAGS: -C linker=aarch64-linux-gnu-gcc
run: |
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
rustup target add aarch64-unknown-linux-gnu
cargo build --target aarch64-unknown-linux-gnu --bin karlsend --release
cargo build --target aarch64-unknown-linux-gnu --bin simpa --release
cargo build --target aarch64-unknown-linux-gnu --bin rothschild --release
cargo build --target aarch64-unknown-linux-gnu --bin karlsen-wallet --release
mkdir bin || true
cp target/aarch64-unknown-linux-gnu/release/karlsend bin/
cp target/aarch64-unknown-linux-gnu/release/simpa bin/
cp target/aarch64-unknown-linux-gnu/release/rothschild bin/
cp target/aarch64-unknown-linux-gnu/release/karlsen-wallet bin/
archive="bin/rusty-karlsen-${{ github.event.release.tag_name }}-linux-gnu-aarch64.zip"
zip -r "${archive}" ./bin/*
- name: Build on Linux for linux-musl/amd64
if: matrix.TARGET == 'linux-musl/amd64'
# We're using musl to make the binaries statically linked and portable.
env:
RUSTFLAGS: -C target-feature=-crt-static
run: |
rustup target add x86_64-unknown-linux-musl
cargo install cargo-zigbuild
cargo --verbose zigbuild --bin karlsend --bin simpa --bin rothschild --bin karlsen-wallet --release --target x86_64-unknown-linux-musl
mkdir bin || true
cp target/x86_64-unknown-linux-musl/release/karlsend bin/
cp target/x86_64-unknown-linux-musl/release/simpa bin/
cp target/x86_64-unknown-linux-musl/release/rothschild bin/
cp target/x86_64-unknown-linux-musl/release/karlsen-wallet bin/
archive="bin/rusty-karlsen-${{ github.event.release.tag_name }}-linux-musl-amd64.zip"
zip -r "${archive}" ./bin/*
- name: Build on Linux for linux-musl/aarch64
if: matrix.TARGET == 'linux-musl/aarch64'
# We're using musl to make the binaries statically linked and portable.
env:
RUSTFLAGS: -C target-feature=-crt-static
run: |
rustup target add aarch64-unknown-linux-musl
cargo install cargo-zigbuild
cargo --verbose zigbuild --bin karlsend --bin simpa --bin rothschild --bin karlsen-wallet --release --target aarch64-unknown-linux-musl
mkdir bin || true
cp target/aarch64-unknown-linux-musl/release/karlsend bin/
cp target/aarch64-unknown-linux-musl/release/simpa bin/
cp target/aarch64-unknown-linux-musl/release/rothschild bin/
cp target/aarch64-unknown-linux-musl/release/karlsen-wallet bin/
archive="bin/rusty-karlsen-${{ github.event.release.tag_name }}-linux-musl-aarch64.zip"
zip -r "${archive}" ./bin/*
- name: Build on Windows for windows-gnullvm/amd64
if: matrix.TARGET == 'windows-gnullvm/amd64'
# We're using clang to link only the ucrt library statically.
env:
RUSTFLAGS: -L/clang64/lib -lstatic=c++
shell: msys2 {0}
run: |
export PATH="${PATH}:/c/Users/runneradmin/.cargo/bin" # manually override path to select proper msys2 build tools.
rustup target add x86_64-pc-windows-gnullvm
cargo build --target x86_64-pc-windows-gnullvm --bin karlsend --release
cargo build --target x86_64-pc-windows-gnullvm --bin simpa --release
cargo build --target x86_64-pc-windows-gnullvm --bin rothschild --release
cargo build --target x86_64-pc-windows-gnullvm --bin karlsen-wallet --release
mkdir bin || true
cp target/x86_64-pc-windows-gnullvm/release/karlsend.exe bin/
cp target/x86_64-pc-windows-gnullvm/release/simpa.exe bin/
cp target/x86_64-pc-windows-gnullvm/release/rothschild.exe bin/
cp target/x86_64-pc-windows-gnullvm/release/karlsen-wallet.exe bin/
archive="bin/rusty-karlsen-${{ github.event.release.tag_name }}-windows-gnullvm-amd64.zip"
zip -r "${archive}" ./bin/*
- name: Build on Windows for windows-msvc/amd64
if: matrix.TARGET == 'windows-msvc/amd64'
shell: msys2 {0}
run: |
export PATH="${PATH}:/c/Users/runneradmin/.cargo/bin" # manually override path to select proper msys2 build tools.
rustup target add x86_64-pc-windows-msvc
cargo build --target x86_64-pc-windows-msvc --bin karlsend --release
cargo build --target x86_64-pc-windows-msvc --bin simpa --release
cargo build --target x86_64-pc-windows-msvc --bin rothschild --release
cargo build --target x86_64-pc-windows-msvc --bin karlsen-wallet --release
mkdir bin || true
cp target/x86_64-pc-windows-msvc/release/karlsend.exe bin/
cp target/x86_64-pc-windows-msvc/release/simpa.exe bin/
cp target/x86_64-pc-windows-msvc/release/rothschild.exe bin/
cp target/x86_64-pc-windows-msvc/release/karlsen-wallet.exe bin/
archive="bin/rusty-karlsen-${{ github.event.release.tag_name }}-windows-msvc-amd64.zip"
zip -r "${archive}" ./bin/*
- name: Build on macOS for macos/amd64
if: matrix.TARGET == 'macos/amd64'
run: |
rustup target add x86_64-apple-darwin
cargo build --target x86_64-apple-darwin --bin karlsend --release
cargo build --target x86_64-apple-darwin --bin simpa --release
cargo build --target x86_64-apple-darwin --bin rothschild --release
cargo build --target x86_64-apple-darwin --bin karlsen-wallet --release
mkdir bin || true
cp target/x86_64-apple-darwin/release/karlsend bin/
cp target/x86_64-apple-darwin/release/simpa bin/
cp target/x86_64-apple-darwin/release/rothschild bin/
cp target/x86_64-apple-darwin/release/karlsen-wallet bin/
archive="bin/rusty-karlsen-${{ github.event.release.tag_name }}-macos-amd64.zip"
zip -r "${archive}" ./bin/*
- name: Build on macOS for macos/aarch64
if: matrix.TARGET == 'macos/aarch64'
run: |
rustup target add aarch64-apple-darwin
cargo build --target aarch64-apple-darwin --bin karlsend --release
cargo build --target aarch64-apple-darwin --bin simpa --release
cargo build --target aarch64-apple-darwin --bin rothschild --release
cargo build --target aarch64-apple-darwin --bin karlsen-wallet --release
mkdir bin || true
cp target/aarch64-apple-darwin/release/karlsend bin/
cp target/aarch64-apple-darwin/release/simpa bin/
cp target/aarch64-apple-darwin/release/rothschild bin/
cp target/aarch64-apple-darwin/release/karlsen-wallet bin/
archive="bin/rusty-karlsen-${{ github.event.release.tag_name }}-macos-aarch64.zip"
zip -r "${archive}" ./bin/*
- name: Upload release asset
uses: softprops/action-gh-release@v2
with:
files: |
bin/*.zip
build-wasm:
runs-on: ubuntu-latest
name: Building WASM32 SDK
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install Protoc
uses: taiki-e/install-action@v2
with:
tool: protoc
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install llvm
id: install_llvm
continue-on-error: true
run: |
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
sudo apt-get install -y clang-15 lldb-15 lld-15 clangd-15 clang-tidy-15 clang-format-15 clang-tools-15 llvm-15-dev lld-15 lldb-15 llvm-15-tools libomp-15-dev libc++-15-dev libc++abi-15-dev libclang-common-15-dev libclang-15-dev libclang-cpp15-dev libunwind-15-dev
# Make Clang 15 default
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-15/bin/clang++ 100
sudo update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-15/bin/clang 100
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/lib/llvm-15/bin/clang-format 100
sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/lib/llvm-15/bin/clang-tidy 100
sudo update-alternatives --install /usr/bin/run-clang-tidy run-clang-tidy /usr/lib/llvm-15/bin/run-clang-tidy 100
# Alias cc to clang
sudo update-alternatives --install /usr/bin/cc cc /usr/lib/llvm-15/bin/clang 0
sudo update-alternatives --install /usr/bin/c++ c++ /usr/lib/llvm-15/bin/clang++ 0
- name: Install gcc-multilib
# gcc-multilib allows clang to find gnu libraries properly.
run: sudo apt install -y gcc-multilib
- name: Install stable toolchain
if: steps.install_llvm.outcome == 'success' && steps.install_llvm.conclusion == 'success'
uses: dtolnay/rust-toolchain@stable
- name: Install wasm-pack
run: cargo install wasm-pack
- name: Add wasm32 target
run: rustup target add wasm32-unknown-unknown
- name: Install NodeJS
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install NodeJS dependencies
run: npm install --global typedoc typescript
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build WASM32 SDK
run: |
mkdir sdk || true
cd wasm
bash build-release
mv release/karlsen-wasm32-sdk.zip ../sdk/karlsen-wasm32-sdk-${{ github.event.release.tag_name }}.zip
- name: Upload WASM32 SDK
uses: softprops/action-gh-release@v2
with:
files: |
sdk/*.zip