-
Notifications
You must be signed in to change notification settings - Fork 12
101 lines (98 loc) · 4.74 KB
/
swift.yml
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
name: Test Bindings
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check_bindings:
name: Swift Package Manager Tests
runs-on: ubuntu-latest
env:
TOOLCHAIN: stable
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Install native Rust toolchain and build utilities
run: |
# sudo apt-get purge grub\*
# sudo apt-get --only-upgrade install grub-efi-amd64-signed
# sudo apt-get autoremove
# sudo update-grub
sudo apt-get update
# sudo apt-get -y upgrade
sudo apt-get -y install cargo lld git g++ clang curl
- name: Install Dependencies
uses: ./.github/actions/install-dependencies
with:
destination: ./ci
configureRustNightly: false
env:
LDK_SWIFT_GENERATOR_OUTPUT_DIRECTORY_PATH: ci/LDKSwift/Sources/LDKSwift/bindings
- name: Copy new headers into bindings
run: |
python3 ./scripts/copy_c_files.py
env:
LDK_C_BINDINGS_BASE: ${{ github.workspace }}/ci/ldk-c-bindings
H_FILE_OUTPUT_DIRECTORY: ${{ github.workspace }}/ci/LDKSwift/Sources/LDKHeaders/include
C_FILE_OUTPUT_DIRECTORY: ${{ github.workspace }}/ci/LDKSwift/Sources/LDKHeaders
- name: Install Swift Toolchain
run: |
curl --verbose -L -o swift-5.7.2-RELEASE-ubuntu22.04.tar.gz https://download.swift.org/swift-5.7.2-release/ubuntu2204/swift-5.7.2-RELEASE/swift-5.7.2-RELEASE-ubuntu22.04.tar.gz
echo "Sha sum: $(sha256sum swift-5.7.2-RELEASE-ubuntu22.04.tar.gz | awk '{ print $1 }')"
if [ "$(sha256sum swift-5.7.2-RELEASE-ubuntu22.04.tar.gz | awk '{ print $1 }')" != "${EXPECTED_SWIFT_SHASUM}" ]; then
echo "Bad hash"
echo "Contents: \n$(cat swift-5.7.2-RELEASE-ubuntu22.04.tar.gz)"
exit 1
fi
tar xvvf swift-5.7.2-RELEASE-ubuntu22.04.tar.gz
env:
EXPECTED_SWIFT_SHASUM: e729912846b0cff98bf8e0e5ede2e17bc2d1098de3cdb6fa13b3ff52c36ee5d6
- name: Install Swift Formatter
run: |
git clone https://github.com/apple/swift-format.git
cd swift-format
git checkout "tags/$VERSION"
swift build -c release
env:
VERSION: 508.0.1
- name: Regenerate Swift files
run: |
npm install
npm run tsc
node ./src/index.mjs
env:
LDK_SWIFT_GENERATOR_INPUT_HEADER_PATH: ci/ldk-c-bindings/lightning-c-bindings/include/lightning.h
SWIFT_FORMAT_PATH: ${{ github.workspace }}/swift-format/.build/release/swift-format
- name: Test bindings parsing and generation
run: npm test
- name: Verify generated output recency
run: |
git diff --exit-code out/ ':(exclude)out/VersionDescriptor.swift'
- name: Build Swift bindings package
run: |
cd ci/LDKSwift
../../swift-5.7.2-RELEASE-ubuntu22.04/usr/bin/swift build
env:
LDK_C_BINDINGS_BASE: ${{ github.workspace }}/ci/ldk-c-bindings
LLVM_CLANG_ASAN_PATH: /usr/lib/llvm-14/lib/clang/14.0.0/lib/linux/libclang_rt.asan-x86_64.a
RUST_BACKTRACE: 1
- name: Test Swift bindings package without address sanitizer
run: |
cd ci/LDKSwift
../../swift-5.7.2-RELEASE-ubuntu22.04/usr/bin/swift test -v
env:
LDK_C_BINDINGS_BASE: ${{ github.workspace }}/ci/ldk-c-bindings
RUST_BACKTRACE: 1
- name: Test Swift bindings package with address sanitizer
continue-on-error: true
run: |
cd ci/LDKSwift
../../swift-5.7.2-RELEASE-ubuntu22.04/usr/bin/swift test -v
env:
LDK_C_BINDINGS_BASE: ${{ github.workspace }}/ci/ldk-c-bindings
LLVM_CLANG_ASAN_PATH: /usr/lib/llvm-14/lib/clang/14.0.0/lib/linux/libclang_rt.asan-x86_64.a
RUST_BACKTRACE: 1