Skip to content

Commit c5cd72b

Browse files
committed
Test bindings with address sanitizer first
1 parent 108f6d1 commit c5cd72b

File tree

1 file changed

+32
-6
lines changed

1 file changed

+32
-6
lines changed

.github/workflows/swift.yml

+32-6
Original file line numberDiff line numberDiff line change
@@ -94,27 +94,53 @@ jobs:
9494
- name: Verify generated output recency
9595
run: |
9696
git diff --exit-code out/ ':(exclude)out/VersionDescriptor.swift'
97-
- name: Build Swift bindings package
97+
- name: Build Swift bindings package with address sanitizer
9898
run: |
9999
cd ci/LDKSwift
100+
# should be /usr/lib/llvm-18/lib/clang/18/lib/linux/libclang_rt.asan-x86_64.a
101+
export LLVM_CLANG_ASAN_PATH="$(clang -print-resource-dir)/lib/linux/libclang_rt.asan-x86_64.a"
100102
../../swift-5.7.2-RELEASE-ubuntu22.04/usr/bin/swift build
101103
env:
102104
LDK_C_BINDINGS_BASE: ${{ github.workspace }}/ci/ldk-c-bindings
103-
LLVM_CLANG_ASAN_PATH: /usr/lib/llvm-14/lib/clang/14.0.0/lib/linux/libclang_rt.asan-x86_64.a
104105
RUST_BACKTRACE: 1
105-
- name: Test Swift bindings package without address sanitizer
106+
- name: Test Swift bindings package with address sanitizer
107+
continue-on-error: true
106108
run: |
107109
cd ci/LDKSwift
110+
# should be /usr/lib/llvm-18/lib/clang/18/lib/linux/libclang_rt.asan-x86_64.a
111+
export LLVM_CLANG_ASAN_PATH="$(clang -print-resource-dir)/lib/linux/libclang_rt.asan-x86_64.a"
108112
../../swift-5.7.2-RELEASE-ubuntu22.04/usr/bin/swift test -v
109113
env:
110114
LDK_C_BINDINGS_BASE: ${{ github.workspace }}/ci/ldk-c-bindings
111115
RUST_BACKTRACE: 1
112-
- name: Test Swift bindings package with address sanitizer
113-
continue-on-error: true
116+
- name: Prepare release-optimized rust binaries
117+
run: |
118+
env
119+
pushd ${{ github.workspace }}/ci/ldk-c-bindings/lightning-c-bindings
120+
cargo clean
121+
cargo build --release --features std
122+
123+
# debug the target
124+
find ./target
125+
env:
126+
RUST_BACKTRACE: 1
127+
RUSTFLAGS: --cfg=c_bindings -C embed-bitcode=yes -C lto
128+
CARGO_PROFILE_RELEASE_LTO: true
129+
- name: Build Swift bindings package without address sanitizer
130+
run: |
131+
env
132+
cd ci/LDKSwift
133+
../../swift-5.7.2-RELEASE-ubuntu22.04/usr/bin/swift build
134+
env:
135+
LDK_C_BINDINGS_BASE: ${{ github.workspace }}/ci/ldk-c-bindings
136+
LDK_C_BINDINGS_BINARY_DIRECTORY: ${{ github.workspace }}/ci/ldk-c-bindings/lightning-c-bindings/target/release
137+
RUST_BACKTRACE: 1
138+
- name: Test Swift bindings package without address sanitizer
114139
run: |
140+
env
115141
cd ci/LDKSwift
116142
../../swift-5.7.2-RELEASE-ubuntu22.04/usr/bin/swift test -v
117143
env:
118144
LDK_C_BINDINGS_BASE: ${{ github.workspace }}/ci/ldk-c-bindings
119-
LLVM_CLANG_ASAN_PATH: /usr/lib/llvm-14/lib/clang/14.0.0/lib/linux/libclang_rt.asan-x86_64.a
145+
LDK_C_BINDINGS_BINARY_DIRECTORY: ${{ github.workspace }}/ci/ldk-c-bindings/lightning-c-bindings/target/release
120146
RUST_BACKTRACE: 1

0 commit comments

Comments
 (0)