forked from lightningdevkit/ldk-garbagecollected
-
Notifications
You must be signed in to change notification settings - Fork 0
248 lines (243 loc) · 12.2 KB
/
build.yml
File metadata and controls
248 lines (243 loc) · 12.2 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
name: Continuous Integration Checks
on: [push, pull_request]
env:
NUGET_PACKAGE_VERSION: 0.0.0.5
jobs:
wasm_bindings:
runs-on: ubuntu-latest
# Ubuntu's version of clang doesn't support....anything that should work.
# Ubuntu is an utter trash OS and should generally never be used for anything.
# We also require at least rustc 1.51 (ie https://github.com/rust-lang/rust/pull/79998),
# so we use debian testing
container: debian:bookworm
strategy:
fail-fast: false
steps:
- name: Install build utilities and test that clang can build for wasm
run: |
apt-get update
apt-get -y dist-upgrade
apt-get -y install cargo libstd-rust-dev-wasm32 lld git g++ clang curl node-typescript npm python3 wasi-libc
echo "int main() {}" > genbindings_wasm_test_file.c
clang -nostdlib -o /dev/null --target=wasm32-wasi -Wl,--no-entry genbindings_wasm_test_file.c
rm genbindings_wasm_test_file.c
- name: Checkout source code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install cbindgen
run: |
git clone https://github.com/eqrion/cbindgen
cd cbindgen/
git checkout v0.20.0
cargo update -p indexmap --precise "1.6.2" --verbose
cargo install --locked --path .
- name: Checkout Rust-Lightning and LDK-C-Bindings git
run: |
git config --global safe.directory '*'
git config --global user.email "ldk-ci@example.com"
git config --global user.name "LDK CI"
# Note this is a different endpoint, as we need one non-upstream commit!
git clone https://github.com/lightningdevkit/rust-lightning
cd rust-lightning
git checkout origin/0.0.121-bindings
cd ..
git clone https://github.com/lightningdevkit/ldk-c-bindings
cd ldk-c-bindings
git checkout 0.0.121
cd lightning-c-bindings
cargo update -p memchr --precise "2.5.0" --verbose
- name: Rebuild C bindings without STD
run: |
cd ldk-c-bindings
git config --global safe.directory "*"
./genbindings.sh ../rust-lightning false
- name: Set package version
run: |
echo "LDK_GARBAGECOLLECTED_GIT_OVERRIDE=v$NUGET_PACKAGE_VERSION" >> "$GITHUB_ENV"
- name: Build and Test TS Debug Bindings for Node
run: |
# We need FinalizationRegistry and top-level await support, which requires node 14.6/8,
# however Debian ships with Node 12
# Thus, we install the binary nodejs from nodejs.org and test with that.
curl https://nodejs.org/dist/v16.13.1/node-v16.13.1-linux-x64.tar.xz > nodejs.tar.xz
tar xvvf nodejs.tar.xz
export PATH=$(pwd)/$(echo node-*/bin):$PATH
./genbindings.sh ./ldk-c-bindings/ wasm true false
- name: Build and Test TS Release Bindings for Node
run: |
export PATH=$(pwd)/$(echo node-*/bin):$PATH
./genbindings.sh ./ldk-c-bindings/ wasm false false
- name: Install Playwright for Web Tests
run: |
export HOME=/root/ # Github actions is apparently broken
export PATH=$(pwd)/$(echo node-*/bin):$PATH
# npx playwright install-deps is broken so we do it manually, see https://github.com/microsoft/playwright/issues/11165
apt-get install -y --no-install-recommends fonts-liberation libenchant-2-2 libicu72 libjpeg62-turbo libasound2 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libcairo2 libcups2 libdbus-1-3 libdrm2 libegl1 libgbm1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxdamage1 libxext6 libxfixes3 libxrandr2 libxshmfence1 xvfb fonts-noto-color-emoji fonts-unifont libfontconfig libfreetype6 xfonts-scalable fonts-ipafont-gothic fonts-wqy-zenhei fonts-tlwg-loma-otf ffmpeg libcairo-gobject2 libdbus-glib-1-2 libfontconfig1 libgdk-pixbuf2.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libxcb-shm0 libxcursor1 libxi6 libxrender1 libxt6 gstreamer1.0-libav gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-plugins-good libepoxy0 libevdev2 libgl1 libgles2 libgstreamer-gl1.0-0 libgstreamer1.0-0 libharfbuzz-icu0 libharfbuzz0b libhyphen0 libnotify4 libopenjp2-7 libopus0 libpng16-16 libsecret-1-0 libsoup2.4-1 libwayland-client0 libwayland-egl1 libwayland-server0 libwebp7 libwebpdemux2 libwoff1 libxkbcommon0 libxml2 libxslt1.1
mkdir -p $HOME/.cache/ms-playwright # `playwright install` is too dumb to create this for us
chmod -R 777 $HOME/
npm i -D playwright@1.37.0-alpha-jul-31-2023
npx playwright@1.37.0-alpha-jul-31-2023 install
- name: Build and Test TS Debug Bindings for Web
run: |
export HOME=/root/ # Github actions is apparently broken
export PATH=$(pwd)/$(echo node-*/bin):$PATH
git config --global safe.directory "*"
./genbindings.sh ./ldk-c-bindings/ wasm true true
cd ts
rm liblightningjs.wasm && ln -s $(pwd)/../liblightningjs_debug.wasm ./liblightningjs.wasm
python3 -m http.server &
SERVER_PID=$!
node test/browser.mjs
kill $SERVER_PID
- name: Build and Test TS Release Bindings for Web
run: |
export HOME=/root/ # Github actions is apparently broken
export PATH=$(pwd)/$(echo node-*/bin):$PATH
./genbindings.sh ./ldk-c-bindings/ wasm false true
cd ts
rm liblightningjs.wasm && ln -s $(pwd)/../liblightningjs_release.wasm ./liblightningjs.wasm
python3 -m http.server &
SERVER_PID=$!
node test/browser.mjs
kill $SERVER_PID
- name: Check latest TS files are in git
run: |
git checkout ts/package.json
git checkout node-net/package.json
git diff --exit-code
c_sharp_bindings:
runs-on: ubuntu-latest
# Ubuntu's version of clang doesn't support....anything that should work.
# Ubuntu is an utter trash OS and should generally never be used for anything.
# We also require at least rustc 1.51 (ie https://github.com/rust-lang/rust/pull/79998),
# so we use debian testing
container: debian:bookworm
strategy:
fail-fast: false
steps:
- name: Install required dependencies
run: |
apt-get update
apt-get -y dist-upgrade
apt-get -y install cargo lld llvm git g++ clang curl python3 mono-devel
- name: Checkout source code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install cbindgen
run: |
git clone https://github.com/eqrion/cbindgen
cd cbindgen/
git checkout v0.20.0
cargo update -p indexmap --precise "1.6.2" --verbose
cargo install --locked --path .
- name: Checkout Rust-Lightning and LDK-C-Bindings git
run: |
git config --global safe.directory '*'
git config --global user.email "ldk-ci@example.com"
git config --global user.name "LDK CI"
# Note this is a different endpoint, as we need one non-upstream commit!
git clone https://github.com/lightningdevkit/rust-lightning
cd rust-lightning
git checkout origin/0.0.121-bindings
cd ..
git clone https://github.com/lightningdevkit/ldk-c-bindings
cd ldk-c-bindings
git checkout 0.0.121
cd lightning-c-bindings
cargo update -p memchr --precise "2.5.0" --verbose
- name: Rebuild C bindings with STD
run: |
cd ldk-c-bindings
git config --global safe.directory "*"
./genbindings.sh ../rust-lightning true
- name: Set package version
run: |
echo "LDK_GARBAGECOLLECTED_GIT_OVERRIDE=v$NUGET_PACKAGE_VERSION" >> "$GITHUB_ENV"
- name: Build and Test C# Debug Bindings
run: |
./genbindings.sh ./ldk-c-bindings/ c_sharp true true
mono-csc -out:test.exe -langversion:3 -unsafe c_sharp/src/org/ldk/enums/*.cs c_sharp/src/org/ldk/impl/*.cs c_sharp/src/org/ldk/util/*.cs c_sharp/src/org/ldk/structs/*.cs c_sharp/test/src/tests.cs
ln -s libldkcsharp_debug_Linux-amd64.so libldkcsharp.so
export ASAN_OPTIONS=detect_leaks=0
LD_PRELOAD=/usr/lib/llvm-14/lib/clang/14.0.6/lib/linux/libclang_rt.asan-x86_64.so mono test.exe
c_sharp_determinism:
runs-on: ubuntu-latest
# Ubuntu's version of clang doesn't support....anything that should work.
# Ubuntu is an utter trash OS and should generally never be used for anything.
# We also require dotnet so we use fedora
container: fedora:39
strategy:
fail-fast: false
env:
DOTNET_NOLOGO: true
steps:
- name: Install required dependencies
run: |
dnf install -y mingw64-gcc git cargo dotnet clang llvm lld faketime rust-std-static-x86_64-pc-windows-gnu which diffutils rust-src
- name: Checkout source code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install cbindgen
run: |
cargo install cbindgen
- name: Checkout Rust-Lightning and LDK-C-Bindings git
run: |
git config --global safe.directory '*'
git config --global user.email "ldk-ci@example.com"
git config --global user.name "LDK CI"
# Note this is a different endpoint, as we need one non-upstream commit!
git clone https://github.com/lightningdevkit/rust-lightning
cd rust-lightning
git checkout origin/0.0.121-bindings
cd ..
git clone https://github.com/lightningdevkit/ldk-c-bindings
cd ldk-c-bindings
git checkout 0.0.121
- name: Fetch MacOS SDK
run: |
curl -o Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz https://bitcoincore.org/depends-sources/sdks/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz
tar xvvf Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz
- name: Rebuild C bindings with STD
run: |
export MACOS_SDK="$PWD/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers"
cd ldk-c-bindings
export LDK_C_BINDINGS_EXTRA_TARGETS=x86_64-pc-windows-gnu
export LDK_C_BINDINGS_EXTRA_TARGET_CCS=`pwd`/deterministic-build-wrappers/clang-x86_64-windows
export LDK_C_BINDINGS_EXTRA_TARGET_LINK_LTO=true
./genbindings.sh ../rust-lightning true
- name: Remove checked-in source to ensure its correctly checked-in
run: rm c_sharp/src/org/ldk/enums/*.cs c_sharp/src/org/ldk/impl/*.cs c_sharp/src/org/ldk/structs/*.cs
- name: Set package version
run: |
echo "LDK_GARBAGECOLLECTED_GIT_OVERRIDE=v$(dotnet fsi nugetPreRelease.fsx $NUGET_PACKAGE_VERSION)" >> "$GITHUB_ENV"
- name: Build Windows C# Bindings
run: |
LDK_TARGET=x86_64-pc-windows-gnu LDK_TARGET_CPU=sandybridge ./genbindings.sh ./ldk-c-bindings/ c_sharp false false
- name: Build Linux C# Bindings
run: |
./genbindings.sh ./ldk-c-bindings/ c_sharp false false
- name: Build macOS x86-64 C# Bindings
run: |
export MACOS_SDK="$PWD/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers"
CC=clang LDK_TARGET=x86_64-apple-darwin LDK_TARGET_CPU=sandybridge ./genbindings.sh ./ldk-c-bindings/ c_sharp false false
- name: Build macOS aarch64 C# Bindings
run: |
export MACOS_SDK="$PWD/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers"
CC=clang LDK_TARGET=aarch64-apple-darwin LDK_TARGET_CPU=apple-a14 ./genbindings.sh ./ldk-c-bindings/ c_sharp false false
- name: Build Release NUPKG
run: |
cd c_sharp
./build-release-nupkg.sh
- uses: actions/upload-artifact@v3
with:
name: LdkSharp.nupkg
path: c_sharp/LdkSharp.nupkg
- name: Publish nuget package on nuget.org
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
if [ ${{ secrets.NUGET_API_KEY }} ]; then
dotnet nuget push c_sharp/LdkSharp.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
fi