12
12
uses : actions/checkout@v2
13
13
- name : Checkout Rust-Lightning and LDK-C-Bindings git
14
14
run : |
15
+ cd bindings/LDK
16
+ ls -ll
17
+ cd ../../ci
15
18
git config --global user.email "[email protected] "
16
19
git config --global user.name "LDK CI"
17
20
# Note this is a different endpoint, as we need one non-upstream commit!
31
34
# git checkout 1bb5ae1b34aeb74009b7b4b5ebefc957cddc30a6
32
35
echo "ldk-c-bindings commit hash:"
33
36
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
48
38
run : |
49
39
sudo apt-get update
50
40
sudo apt-get -y dist-upgrade
@@ -53,58 +43,118 @@ jobs:
53
43
run : cargo install --force cbindgen
54
44
- name : Regenerate C bindings
55
45
run : |
56
- cd ldk-c-bindings
46
+ pwd
47
+ cd ci/ldk-c-bindings
48
+ pwd
57
49
./genbindings.sh ../rust-lightning true
58
50
cd ..
59
- - name : Debug bindings target directory structure
60
- run : |
61
- python ci/walker.py ldk-c-bindings/lightning-c-bindings/target
62
51
- name : Copy new headers into bindings
63
52
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/
68
58
- name : Set up Python
69
59
uses : actions/setup-python@v2
70
60
- name : Fix header files
71
61
run : |
72
- python ci/fix_header_includes.py
62
+ cd ci
63
+ python ./fix_header_includes.py
73
64
- name : Generate (copy for debugging) Swift bindings and copy batteries
74
65
run : |
75
- python ./ # Generate bindings
66
+ pwd
67
+ python ./ # Generate bindings into ci subdirectory
76
68
77
69
# TODO: switch back to generation method after debugging
78
70
# mkdir -p ci/LDKSwift/Sources/LDKSwift
79
71
# cp -a bindings/LDK/. ci/LDKSwift/Sources/LDKSwift
80
72
81
73
cp -R bindings/batteries ci/LDKSwift/Sources/LDKSwift
82
74
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
84
76
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
85
84
- name : Fix Swift files
86
85
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
89
89
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
91
100
- name : Build Swift bindings package
92
101
run : |
93
102
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
96
104
env :
97
105
LDK_C_BINDINGS_BASE : /home/runner/work/ldk-swift/ldk-swift/ldk-c-bindings
98
106
LLVM_CLANG_ASAN_PATH : /usr/lib/llvm-11/lib/clang/11.0.0/lib/linux/libclang_rt.asan-x86_64.a
99
107
RUST_BACKTRACE : 1
100
- - name : Test Swift bindings package
108
+ - name : Test Swift bindings package without address sanitizer
101
109
run : |
110
+ python ci/toggle_address_sanitation_library.py off
102
111
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
104
113
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
106
115
LLVM_CLANG_ASAN_PATH : /usr/lib/llvm-11/lib/clang/11.0.0/lib/linux/libclang_rt.asan-x86_64.a
107
116
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
109
147
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