Skip to content

Commit 159fd5c

Browse files
authored
Merge pull request #3 from lightningdevkit/native_tcp_handing
Use native TCP handling logic
2 parents e59e09b + 8bf96f6 commit 159fd5c

File tree

299 files changed

+8083
-21447
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

299 files changed

+8083
-21447
lines changed

.github/workflows/swift.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Continuous Integration Checks
2+
3+
on: [ push, pull_request ]
4+
5+
jobs:
6+
check_bindings:
7+
runs-on: ubuntu-20.04
8+
env:
9+
TOOLCHAIN: stable
10+
steps:
11+
- name: Checkout source code
12+
uses: actions/checkout@v2
13+
- name: Checkout Rust-Lightning and LDK-C-Bindings git
14+
run: |
15+
git config --global user.email "[email protected]"
16+
git config --global user.name "LDK CI"
17+
# Note this is a different endpoint, as we need one non-upstream commit!
18+
git clone https://git.bitcoin.ninja/rust-lightning
19+
cd rust-lightning
20+
git checkout origin/2021-03-java-bindings-base
21+
cd ..
22+
git clone https://github.com/lightningdevkit/ldk-c-bindings
23+
- name: Install native Rust toolchain, Valgrind, and build utilitis
24+
run: |
25+
sudo apt-get update
26+
sudo apt-get -y dist-upgrade
27+
sudo apt-get -y install cargo valgrind lld git g++ clang curl
28+
- name: Install cbindgen
29+
run: cargo install --force cbindgen
30+
- name: Install Swift Toolchain
31+
run: |
32+
curl https://swift.org/builds/swift-5.4.2-release/ubuntu2004/swift-5.4.2-RELEASE/swift-5.4.2-RELEASE-ubuntu20.04.tar.gz > swift-5.4.2-RELEASE-ubuntu20.04.tar.gz
33+
if [ "$(sha256sum swift-5.4.2-RELEASE-ubuntu20.04.tar.gz | awk '{ print $1 }')" != "86b849d9f6ba2eda4e12ea5eafaa0748bffcd6272466b514c2b0fd4a829c63a4" ]; then
34+
echo "Bad hash"
35+
exit 1
36+
fi
37+
tar xvvf swift-5.4.2-RELEASE-ubuntu20.04.tar.gz
38+
- name: Regenerate C bindings
39+
run: |
40+
cd ldk-c-bindings
41+
./genbindings.sh ../rust-lightning true
42+
cd ..
43+
- name: Debug bindings target directory structure
44+
run: |
45+
python ci/walker.py ldk-c-bindings/lightning-c-bindings/target
46+
- name: Copy new headers into bindings
47+
run: |
48+
mkdir -p ci/LDKSwift/Sources/LDKHeaders/include
49+
cp ldk-c-bindings/lightning-c-bindings/include/*.h ci/LDKSwift/Sources/LDKHeaders/include/
50+
cp ldk-c-bindings/ldk-net/ldk_net.h ci/LDKSwift/Sources/LDKHeaders/include/
51+
cp ldk-c-bindings/ldk-net/ldk_net.c ci/LDKSwift/Sources/LDKHeaders/
52+
- name: Set up Python
53+
uses: actions/setup-python@v2
54+
- name: Fix header files
55+
run: |
56+
python ci/fix_header_includes.py
57+
- name: Generate (copy for debugging) Swift bindings and copy batteries
58+
run: |
59+
python ./ # Generate bindings
60+
61+
# TODO: switch back to generation method after debugging
62+
# mkdir -p ci/LDKSwift/Sources/LDKSwift
63+
# cp -a bindings/LDK/. ci/LDKSwift/Sources/LDKSwift
64+
65+
cp -R bindings/batteries ci/LDKSwift/Sources/LDKSwift
66+
env:
67+
LDK_SWIFT_GENERATOR_INPUT_HEADER_PATH: ldk-c-bindings/lightning-c-bindings/include/lightning.h
68+
LDK_SWIFT_GENERATOR_OUTPUT_DIRECTORY_PATH: ci/LDKSwift/Sources/LDKSwift
69+
- name: Fix Swift files
70+
run: |
71+
python ci/fix_swift_imports.py
72+
- name: Debug CI directory structure
73+
run: |
74+
python ci/walker.py ci/
75+
- name: Build Swift bindings package
76+
run: |
77+
cd ci/LDKSwift
78+
../../swift-5.4.2-RELEASE-ubuntu20.04/usr/bin/swift build
79+
cd ../../
80+
env:
81+
LDK_C_BINDINGS_BASE: /home/runner/work/ldk-swift/ldk-swift/ldk-c-bindings
82+
LLVM_CLANG_ASAN_PATH: /usr/lib/llvm-11/lib/clang/11.0.0/lib/linux/libclang_rt.asan-x86_64.a
83+
RUST_BACKTRACE: 1
84+
- name: Test Swift bindings package
85+
run: |
86+
cd ci/LDKSwift
87+
../../swift-5.4.2-RELEASE-ubuntu20.04/usr/bin/swift test -v
88+
env:
89+
LDK_C_BINDINGS_BASE: /home/runner/work/ldk-swift/ldk-swift/ldk-c-bindings
90+
LLVM_CLANG_ASAN_PATH: /usr/lib/llvm-11/lib/clang/11.0.0/lib/linux/libclang_rt.asan-x86_64.a
91+
RUST_BACKTRACE: 1
92+
- name: Check that the latest headers are in the swift repo
93+
run: |
94+
git diff --exit-code

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ lib*.a
44
.DS_Store
55
__pycache__
66

7+
ci/Build
8+
ci/LDKSwift/Sources
9+
ci/LDKSwift/.build
10+
ci/LDKSwift/.swiftpm
11+
712
/xcode/LDKFramework/Build/
813
/xcode/LDKFramework/LDKFramework.xcodeproj/project.xcworkspace/
914
/xcode/LDKFramework/LDKFramework.xcodeproj/xcuserdata/

0 commit comments

Comments
 (0)