1212 uses : actions/checkout@v2
1313 - name : Checkout Rust-Lightning and LDK-C-Bindings git
1414 run : |
15+ cd bindings/LDK
16+ ls -ll
17+ cd ../../ci
1518 git config --global user.email "[email protected] " 1619 git config --global user.name "LDK CI"
1720 # Note this is a different endpoint, as we need one non-upstream commit!
3134 # git checkout 1bb5ae1b34aeb74009b7b4b5ebefc957cddc30a6
3235 echo "ldk-c-bindings commit hash:"
3336 git rev-parse HEAD
34- cd ..
35- - name : Install Swift Toolchain
36- run : |
37- curl --verbose -L -o swift-5.4.2-RELEASE-ubuntu20.04.tar.gz https://swift.org/builds/swift-5.4.2-release/ubuntu2004/swift-5.4.2-RELEASE/swift-5.4.2-RELEASE-ubuntu20.04.tar.gz
38- echo "Sha sum: $(sha256sum swift-5.4.2-RELEASE-ubuntu20.04.tar.gz | awk '{ print $1 }')"
39- if [ "$(sha256sum swift-5.4.2-RELEASE-ubuntu20.04.tar.gz | awk '{ print $1 }')" != "${EXPECTED_SWIFT_SHASUM}" ]; then
40- echo "Bad hash"
41- echo "Contents: \n$(cat swift-5.4.2-RELEASE-ubuntu20.04.tar.gz)"
42- exit 1
43- fi
44- tar xvvf swift-5.4.2-RELEASE-ubuntu20.04.tar.gz
45- env :
46- EXPECTED_SWIFT_SHASUM : 86b849d9f6ba2eda4e12ea5eafaa0748bffcd6272466b514c2b0fd4a829c63a4
47- - name : Install native Rust toolchain, Valgrind, and build utilitis
37+ - name : Install native Rust toolchain, Valgrind, and build utilities
4838 run : |
4939 sudo apt-get update
5040 sudo apt-get -y dist-upgrade
@@ -53,58 +43,118 @@ jobs:
5343 run : cargo install --force cbindgen
5444 - name : Regenerate C bindings
5545 run : |
56- cd ldk-c-bindings
46+ pwd
47+ cd ci/ldk-c-bindings
48+ pwd
5749 ./genbindings.sh ../rust-lightning true
5850 cd ..
59- - name : Debug bindings target directory structure
60- run : |
61- python ci/walker.py ldk-c-bindings/lightning-c-bindings/target
6251 - name : Copy new headers into bindings
6352 run : |
64- mkdir -p ci/LDKSwift/Sources/LDKHeaders/include
65- cp ldk-c-bindings/lightning-c-bindings/include/*.h ci/LDKSwift/Sources/LDKHeaders/include/
66- cp ldk-c-bindings/ldk-net/ldk_net.h ci/LDKSwift/Sources/LDKHeaders/include/
67- cp ldk-c-bindings/ldk-net/ldk_net.c ci/LDKSwift/Sources/LDKHeaders/
53+ cd ci
54+ mkdir -p ./LDKSwift/Sources/LDKHeaders/include
55+ cp ldk-c-bindings/lightning-c-bindings/include/*.h ./LDKSwift/Sources/LDKHeaders/include/
56+ cp ldk-c-bindings/ldk-net/ldk_net.h ./LDKSwift/Sources/LDKHeaders/include/
57+ cp ldk-c-bindings/ldk-net/ldk_net.c ./LDKSwift/Sources/LDKHeaders/
6858 - name : Set up Python
6959 uses : actions/setup-python@v2
7060 - name : Fix header files
7161 run : |
72- python ci/fix_header_includes.py
62+ cd ci
63+ python ./fix_header_includes.py
7364 - name : Generate (copy for debugging) Swift bindings and copy batteries
7465 run : |
75- python ./ # Generate bindings
66+ pwd
67+ python ./ # Generate bindings into ci subdirectory
7668
7769 # TODO: switch back to generation method after debugging
7870 # mkdir -p ci/LDKSwift/Sources/LDKSwift
7971 # cp -a bindings/LDK/. ci/LDKSwift/Sources/LDKSwift
8072
8173 cp -R bindings/batteries ci/LDKSwift/Sources/LDKSwift
8274 env :
83- LDK_SWIFT_GENERATOR_INPUT_HEADER_PATH : ldk-c-bindings/lightning-c-bindings/include/lightning.h
75+ LDK_SWIFT_GENERATOR_INPUT_HEADER_PATH : ci/ ldk-c-bindings/lightning-c-bindings/include/lightning.h
8476 LDK_SWIFT_GENERATOR_OUTPUT_DIRECTORY_PATH : ci/LDKSwift/Sources/LDKSwift
77+ - name : Check that the latest auto-generated Swift files are in the repo
78+ run : |
79+ python ./ # Generate bindings into local directory
80+ python ci/walker.py bindings/LDK
81+ git diff --exit-code bindings/LDK ':(exclude)bindings/LDK/Bindings.swift'
82+ env :
83+ LDK_SWIFT_GENERATOR_INPUT_HEADER_PATH : ci/ldk-c-bindings/lightning-c-bindings/include/lightning.h
8584 - name : Fix Swift files
8685 run : |
87- python ci/fix_swift_imports.py
88- - name : Debug CI directory structure
86+ cd ci
87+ python ./fix_swift_imports.py
88+ - name : Install Swift Toolchain
8989 run : |
90- python ci/walker.py ci/
90+ curl --verbose -L -o swift-5.6-RELEASE-ubuntu20.04.tar.gz https://download.swift.org/swift-5.6-release/ubuntu2004/swift-5.6-RELEASE/swift-5.6-RELEASE-ubuntu20.04.tar.gz
91+ echo "Sha sum: $(sha256sum swift-5.6-RELEASE-ubuntu20.04.tar.gz | awk '{ print $1 }')"
92+ if [ "$(sha256sum swift-5.6-RELEASE-ubuntu20.04.tar.gz | awk '{ print $1 }')" != "${EXPECTED_SWIFT_SHASUM}" ]; then
93+ echo "Bad hash"
94+ echo "Contents: \n$(cat swift-5.6-RELEASE-ubuntu20.04.tar.gz)"
95+ exit 1
96+ fi
97+ tar xvvf swift-5.6-RELEASE-ubuntu20.04.tar.gz
98+ env :
99+ EXPECTED_SWIFT_SHASUM : 3f0d926bfc08eea00a69b1d992f2ab5e08155d97476096a3ef959fe7c4cbd58b
91100 - name : Build Swift bindings package
92101 run : |
93102 cd ci/LDKSwift
94- ../../swift-5.4.2-RELEASE-ubuntu20.04/usr/bin/swift build
95- cd ../../
103+ ../../swift-5.6-RELEASE-ubuntu20.04/usr/bin/swift build
96104 env :
97105 LDK_C_BINDINGS_BASE : /home/runner/work/ldk-swift/ldk-swift/ldk-c-bindings
98106 LLVM_CLANG_ASAN_PATH : /usr/lib/llvm-11/lib/clang/11.0.0/lib/linux/libclang_rt.asan-x86_64.a
99107 RUST_BACKTRACE : 1
100- - name : Test Swift bindings package
108+ - name : Test Swift bindings package without address sanitizer
101109 run : |
110+ python ci/toggle_address_sanitation_library.py off
102111 cd ci/LDKSwift
103- ../../swift-5.4.2 -RELEASE-ubuntu20.04/usr/bin/swift test -v
112+ ../../swift-5.6 -RELEASE-ubuntu20.04/usr/bin/swift test -v
104113 env :
105- LDK_C_BINDINGS_BASE : /home/runner/work/ldk-swift/ldk-swift/ldk-c-bindings
114+ LDK_C_BINDINGS_BASE : /home/runner/work/ldk-swift/ldk-swift/ci/ ldk-c-bindings
106115 LLVM_CLANG_ASAN_PATH : /usr/lib/llvm-11/lib/clang/11.0.0/lib/linux/libclang_rt.asan-x86_64.a
107116 RUST_BACKTRACE : 1
108- - name : Check that the latest headers are in the swift repo
117+ - name : Archive code coverage results
118+ uses : actions/upload-artifact@v3
119+ with :
120+ name : ci_archive
121+ path : ci
122+
123+ test_bindings_with_sanitizer :
124+ runs-on : ubuntu-20.04
125+ needs : check_bindings
126+ steps :
127+ - name : Download code coverage results archive
128+ uses : actions/download-artifact@v3
129+ with :
130+ name : ci_archive
131+ path : ci
132+ - name : Set up Python
133+ uses : actions/setup-python@v2
134+ - name : Install Swift Toolchain
135+ run : |
136+ curl --verbose -L -o swift-5.6-RELEASE-ubuntu20.04.tar.gz https://download.swift.org/swift-5.6-release/ubuntu2004/swift-5.6-RELEASE/swift-5.6-RELEASE-ubuntu20.04.tar.gz
137+ echo "Sha sum: $(sha256sum swift-5.6-RELEASE-ubuntu20.04.tar.gz | awk '{ print $1 }')"
138+ if [ "$(sha256sum swift-5.6-RELEASE-ubuntu20.04.tar.gz | awk '{ print $1 }')" != "${EXPECTED_SWIFT_SHASUM}" ]; then
139+ echo "Bad hash"
140+ echo "Contents: \n$(cat swift-5.6-RELEASE-ubuntu20.04.tar.gz)"
141+ exit 1
142+ fi
143+ tar xvvf swift-5.6-RELEASE-ubuntu20.04.tar.gz
144+ env :
145+ EXPECTED_SWIFT_SHASUM : 3f0d926bfc08eea00a69b1d992f2ab5e08155d97476096a3ef959fe7c4cbd58b
146+ - name : Install Valgrind and build utilities
109147 run : |
110- git diff --exit-code
148+ sudo apt-get update
149+ sudo apt-get -y dist-upgrade
150+ sudo apt-get -y install valgrind lld g++ clang
151+ - name : Test Swift bindings package with address sanitizer
152+ run : |
153+ python ci/toggle_address_sanitation_library.py on
154+ cd ci/LDKSwift
155+ ../../swift-5.6-RELEASE-ubuntu20.04/usr/bin/swift test -Xswiftc -suppress-warnings
156+ env :
157+ LDK_C_BINDINGS_BASE : /home/runner/work/ldk-swift/ldk-swift/ci/ldk-c-bindings
158+ LLVM_CLANG_ASAN_PATH : /usr/lib/llvm-11/lib/clang/11.0.0/lib/linux/libclang_rt.asan-x86_64.a
159+ RUST_BACKTRACE : 1
160+
0 commit comments