Skip to content

Commit 1e22047

Browse files
authored
Merge pull request #51 from lightningdevkit/2022-06-multi-arch-builds
Add script for manual multi-architecture build support
2 parents cd388d2 + ecf304f commit 1e22047

File tree

415 files changed

+8126
-64894
lines changed

Some content is hidden

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

415 files changed

+8126
-64894
lines changed

.github/actions/build-for-testing/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ inputs:
99
workspace:
1010
description: Workspace Name
1111
required: true
12+
description: Build for testing.
1213
runs:
1314
using: composite
1415
steps:
Lines changed: 43 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,45 @@
11
name: Install Dependencies
2+
description: Install dependencies
23
runs:
3-
using: composite
4-
steps:
5-
- name: Install Homebrew Dependencies
6-
shell: bash
7-
run: |
8-
brew install gnu-sed
9-
- name: Checkout Rust-Lightning and LDK-C-Bindings git
10-
shell: bash
11-
run: |
12-
git clone --branch 2021-03-java-bindings-base https://github.com/TheBlueMatt/rust-lightning bindings/artifacts/rust-lightning
13-
git clone https://github.com/lightningdevkit/ldk-c-bindings bindings/artifacts/ldk-c-bindings
14-
- name: Install Rust, required targets
15-
shell: bash
16-
run: |
17-
rustup toolchain install nightly
18-
rustup target add aarch64-apple-darwin aarch64-apple-ios x86_64-apple-ios
19-
rustup component add rust-src --toolchain nightly-x86_64-apple-darwin
20-
- name: Load Cache
21-
uses: actions/cache@v3
22-
with:
23-
path: |
24-
~/.cargo/bin/
25-
~/.cargo/registry/index/
26-
~/.cargo/registry/cache/
27-
~/.cargo/git/db/
28-
target/
29-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
30-
- name: Generate C Bindings
31-
shell: bash
32-
run: |
33-
export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
34-
pushd bindings/artifacts/ldk-c-bindings
35-
./genbindings.sh ../rust-lightning true
36-
popd
37-
- name: Generate Swift Bindings
38-
shell: bash
39-
run: |
40-
python3 ./
41-
env:
42-
LDK_SWIFT_GENERATOR_INPUT_HEADER_PATH: bindings/artifacts/ldk-c-bindings/lightning-c-bindings/include/lightning.h
4+
using: composite
5+
steps:
6+
- name: Install Homebrew Dependencies
7+
shell: bash
8+
run: |
9+
brew install gnu-sed
10+
- name: Checkout Rust-Lightning and LDK-C-Bindings git
11+
shell: bash
12+
run: |
13+
echo `pwd`
14+
mkdir -p ./bindings/artifacts/bin
15+
git clone --branch 2022-06-108-java-bindings https://github.com/TheBlueMatt/rust-lightning ./bindings/artifacts/rust-lightning
16+
git clone --branch v0.0.108.2 https://github.com/lightningdevkit/ldk-c-bindings ./bindings/artifacts/ldk-c-bindings
17+
- name: Install Rust, required targets
18+
shell: bash
19+
run: |
20+
rustup toolchain install nightly
21+
rustup target add aarch64-apple-darwin aarch64-apple-ios x86_64-apple-ios
22+
rustup component add rust-src --toolchain nightly-x86_64-apple-darwin
23+
- name: Load Cache
24+
uses: actions/cache@v3
25+
with:
26+
path: |
27+
~/.cargo/bin/
28+
~/.cargo/registry/index/
29+
~/.cargo/registry/cache/
30+
~/.cargo/git/db/
31+
target/
32+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
33+
- name: Generate C Bindings
34+
shell: bash
35+
run: |
36+
export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
37+
pushd bindings/artifacts/ldk-c-bindings
38+
./genbindings.sh ../rust-lightning true
39+
popd
40+
- name: Generate Swift Bindings
41+
shell: bash
42+
run: |
43+
python3 ./
44+
env:
45+
LDK_SWIFT_GENERATOR_INPUT_HEADER_PATH: bindings/artifacts/ldk-c-bindings/lightning-c-bindings/include/lightning.h
Lines changed: 54 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,59 @@
11
name: Build Frameworks
22
permissions:
3-
contents: read
4-
statuses: read
5-
pull-requests: read
6-
actions: read
7-
checks: write
3+
contents: read
4+
statuses: read
5+
pull-requests: read
6+
actions: read
7+
checks: write
88
on:
9-
push:
10-
branches:
11-
- main
12-
pull_request:
13-
branches:
14-
- "*"
9+
push:
10+
branches:
11+
- main
12+
pull_request:
13+
branches:
14+
- "*"
1515

1616
jobs:
17-
build:
18-
name: Build Framework (${{ matrix.configuration['platform'] }})
19-
runs-on: macos-12
20-
strategy:
21-
fail-fast: false
22-
matrix:
23-
configuration:
24-
- scheme: LDKFramework
25-
destination: generic/platform=iOS
26-
platform: iOS
27-
workspace: LDKFramework.xcworkspace
28-
- scheme: LDKFramework
29-
destination: platform=iOS Simulator,OS=15.2,name=iPhone 13 Pro
30-
platform: iOS Simulator
31-
workspace: LDKFramework.xcworkspace
32-
- scheme: LDKFramework_Mac
33-
destination: generic/platform=OS X
34-
platform: OS X
35-
workspace: LDKFramework.xcworkspace
36-
- scheme: LDKFramework
37-
destination: platform=macOS,variant=Mac Catalyst,arch=x86_64
38-
platform: Mac Catalyst
39-
workspace: LDKFramework.xcworkspace
40-
env:
41-
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app/Contents/Developer
42-
steps:
43-
- name: Configure Xcode
44-
uses: maxim-lobanov/setup-xcode@v1
45-
with:
46-
xcode-version: latest
47-
- name: Checkout
48-
uses: actions/checkout@v2
49-
- name: Install Dependencies
50-
uses: ./.github/actions/install-dependencies
51-
- name: Build
52-
id: build
53-
uses: ./.github/actions/build-for-testing
54-
with:
55-
workspace: ${{ matrix.configuration['workspace'] }}
56-
scheme: ${{ matrix.configuration['scheme'] }}
57-
destination: ${{ matrix.configuration['destination'] }}
17+
build:
18+
name: Build Framework (${{ matrix.configuration['platform'] }})
19+
runs-on: macos-12
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
configuration:
24+
- scheme: LDKFramework
25+
destination: generic/platform=iOS
26+
platform: iOS
27+
workspace: LDKFramework.xcworkspace
28+
- scheme: LDKFramework
29+
destination: platform=iOS Simulator,OS=15.2,name=iPhone 13 Pro
30+
platform: iOS Simulator
31+
workspace: LDKFramework.xcworkspace
32+
- scheme: LDKFramework_Mac
33+
destination: generic/platform=OS X
34+
platform: OS X
35+
workspace: LDKFramework.xcworkspace
36+
- scheme: LDKFramework
37+
destination: platform=macOS,variant=Mac Catalyst,arch=x86_64
38+
platform: Mac Catalyst
39+
workspace: LDKFramework.xcworkspace
40+
env:
41+
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app/Contents/Developer
42+
LDK_C_BINDINGS_BASE: /Users/runner/work/ldk-swift/ldk-swift/bindings/artifacts/ldk-c-bindings
43+
LDK_C_BINDINGS_BINARY_DIRECTORY: /Users/runner/work/ldk-swift/ldk-swift/bindings/artifacts/bin
44+
steps:
45+
- name: Configure Xcode
46+
uses: maxim-lobanov/setup-xcode@v1
47+
with:
48+
xcode-version: latest
49+
- name: Checkout
50+
uses: actions/checkout@v2
51+
- name: Install Dependencies
52+
uses: ./.github/actions/install-dependencies
53+
- name: Build
54+
id: build
55+
uses: ./.github/actions/build-for-testing
56+
with:
57+
workspace: ${{ matrix.configuration['workspace'] }}
58+
scheme: ${{ matrix.configuration['scheme'] }}
59+
destination: ${{ matrix.configuration['destination'] }}

.github/workflows/direct-bindings-app-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
build:
1818
name: Build (${{ matrix.configuration['scheme'] }} - ${{ matrix.configuration['platform'] }})
1919
runs-on: macos-12
20+
continue-on-error: true
2021
strategy:
2122
fail-fast: false
2223
matrix:

.github/workflows/swift.yml

Lines changed: 14 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Check Bindings
22

3-
on: [ push, pull_request ]
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
48

59
jobs:
610
check_bindings:
@@ -13,27 +17,20 @@ jobs:
1317
uses: actions/checkout@v2
1418
- name: Checkout Rust-Lightning and LDK-C-Bindings git
1519
run: |
16-
cd bindings/LDK
17-
ls -ll
18-
cd ../../ci
20+
cd ./ci
1921
git config --global user.email "[email protected]"
2022
git config --global user.name "LDK CI"
2123
# Note this is a different endpoint, as we need one non-upstream commit!
2224
# git clone https://git.bitcoin.ninja/rust-lightning
2325
# git clone https://github.com/TheBlueMatt/rust-lightning
24-
# git clone --branch 2021-03-java-bindings-base https://github.com/TheBlueMatt/rust-lightning
25-
git clone --branch 2022-05-107-bindings-scratch https://github.com/TheBlueMatt/rust-lightning
26+
git clone --branch 2022-06-108-java-bindings https://github.com/TheBlueMatt/rust-lightning
2627
cd rust-lightning
27-
# git checkout origin/2021-03-java-bindings-base
28-
# git checkout v0.0.100
29-
# git checkout 8966f8d3d4911e034621c6d3c3d20140d3a7e76a
3028
echo "rust-lightning commit hash:"
3129
git rev-parse HEAD
3230
cd ..
33-
# git clone https://github.com/lightningdevkit/ldk-c-bindings
34-
git clone https://github.com/TheBlueMatt/ldk-c-bindings
31+
git clone --branch v0.0.108.2 https://github.com/lightningdevkit/ldk-c-bindings
32+
# git clone https://github.com/TheBlueMatt/ldk-c-bindings
3533
cd ldk-c-bindings
36-
# git checkout 1bb5ae1b34aeb74009b7b4b5ebefc957cddc30a6
3734
echo "ldk-c-bindings commit hash:"
3835
git rev-parse HEAD
3936
- name: Install native Rust toolchain, Valgrind, and build utilities
@@ -59,10 +56,6 @@ jobs:
5956
cp ldk-c-bindings/ldk-net/ldk_net.c ./LDKSwift/Sources/LDKHeaders/
6057
- name: Set up Python
6158
uses: actions/setup-python@v2
62-
- name: Fix header files
63-
run: |
64-
cd ci
65-
python ./fix_header_includes.py
6659
- name: Generate (copy for debugging) Swift bindings and copy batteries
6760
run: |
6861
pwd
@@ -71,22 +64,15 @@ jobs:
7164
# TODO: switch back to generation method after debugging
7265
# mkdir -p ci/LDKSwift/Sources/LDKSwift
7366
# cp -a bindings/LDK/. ci/LDKSwift/Sources/LDKSwift
74-
75-
cp -R bindings/batteries ci/LDKSwift/Sources/LDKSwift
7667
env:
7768
LDK_SWIFT_GENERATOR_INPUT_HEADER_PATH: ci/ldk-c-bindings/lightning-c-bindings/include/lightning.h
78-
LDK_SWIFT_GENERATOR_OUTPUT_DIRECTORY_PATH: ci/LDKSwift/Sources/LDKSwift
69+
LDK_SWIFT_GENERATOR_OUTPUT_DIRECTORY_PATH: ci/LDKSwift/Sources/LDKSwift/bindings
7970
- name: Check that the latest auto-generated Swift files are in the repo
8071
run: |
8172
python ./ # Generate bindings into local directory
82-
python ci/walker.py bindings/LDK
83-
git diff --exit-code bindings/LDK ':(exclude)bindings/LDK/Bindings.swift'
73+
git diff --exit-code ci/LDKSwift/Sources/LDKSwift ':(exclude)ci/LDKSwift/Sources/LDKSwift/bindings/Bindings.swift'
8474
env:
8575
LDK_SWIFT_GENERATOR_INPUT_HEADER_PATH: ci/ldk-c-bindings/lightning-c-bindings/include/lightning.h
86-
- name: Fix Swift files
87-
run: |
88-
cd ci
89-
python ./fix_swift_imports.py
9076
- name: Install Swift Toolchain
9177
run: |
9278
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
@@ -104,58 +90,21 @@ jobs:
10490
cd ci/LDKSwift
10591
../../swift-5.6-RELEASE-ubuntu20.04/usr/bin/swift build
10692
env:
107-
LDK_C_BINDINGS_BASE: /home/runner/work/ldk-swift/ldk-swift/ldk-c-bindings
93+
LDK_C_BINDINGS_BASE: /home/runner/work/ldk-swift/ldk-swift/ci/ldk-c-bindings
10894
LLVM_CLANG_ASAN_PATH: /usr/lib/llvm-11/lib/clang/11.0.0/lib/linux/libclang_rt.asan-x86_64.a
10995
RUST_BACKTRACE: 1
11096
- name: Test Swift bindings package without address sanitizer
11197
run: |
112-
python ci/toggle_address_sanitation_library.py off
11398
cd ci/LDKSwift
11499
../../swift-5.6-RELEASE-ubuntu20.04/usr/bin/swift test -v
115100
env:
116101
LDK_C_BINDINGS_BASE: /home/runner/work/ldk-swift/ldk-swift/ci/ldk-c-bindings
117-
LLVM_CLANG_ASAN_PATH: /usr/lib/llvm-11/lib/clang/11.0.0/lib/linux/libclang_rt.asan-x86_64.a
118102
RUST_BACKTRACE: 1
119-
- name: Archive code coverage results
120-
uses: actions/upload-artifact@v3
121-
with:
122-
name: ci_archive
123-
path: ci
124-
125-
test_bindings_with_sanitizer:
126-
name: Test Bindings with Sanitizer
127-
runs-on: ubuntu-20.04
128-
needs: check_bindings
129-
steps:
130-
- name: Download code coverage results archive
131-
uses: actions/download-artifact@v3
132-
with:
133-
name: ci_archive
134-
path: ci
135-
- name: Set up Python
136-
uses: actions/setup-python@v2
137-
- name: Install Swift Toolchain
138-
run: |
139-
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
140-
echo "Sha sum: $(sha256sum swift-5.6-RELEASE-ubuntu20.04.tar.gz | awk '{ print $1 }')"
141-
if [ "$(sha256sum swift-5.6-RELEASE-ubuntu20.04.tar.gz | awk '{ print $1 }')" != "${EXPECTED_SWIFT_SHASUM}" ]; then
142-
echo "Bad hash"
143-
echo "Contents: \n$(cat swift-5.6-RELEASE-ubuntu20.04.tar.gz)"
144-
exit 1
145-
fi
146-
tar xvvf swift-5.6-RELEASE-ubuntu20.04.tar.gz
147-
env:
148-
EXPECTED_SWIFT_SHASUM: 3f0d926bfc08eea00a69b1d992f2ab5e08155d97476096a3ef959fe7c4cbd58b
149-
- name: Install Valgrind and build utilities
150-
run: |
151-
sudo apt-get update
152-
sudo apt-get -y dist-upgrade
153-
sudo apt-get -y install valgrind lld g++ clang
154103
- name: Test Swift bindings package with address sanitizer
104+
continue-on-error: true
155105
run: |
156-
python ci/toggle_address_sanitation_library.py on
157106
cd ci/LDKSwift
158-
../../swift-5.6-RELEASE-ubuntu20.04/usr/bin/swift test -Xswiftc -suppress-warnings
107+
../../swift-5.6-RELEASE-ubuntu20.04/usr/bin/swift test -v
159108
env:
160109
LDK_C_BINDINGS_BASE: /home/runner/work/ldk-swift/ldk-swift/ci/ldk-c-bindings
161110
LLVM_CLANG_ASAN_PATH: /usr/lib/llvm-11/lib/clang/11.0.0/lib/linux/libclang_rt.asan-x86_64.a

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ lib*.a
55
__pycache__
66

77
ci/Build
8-
ci/LDKSwift/Sources
98
ci/LDKSwift/.build
109
ci/LDKSwift/.swiftpm
1110

11+
ci/LDKSwift/Sources/*
12+
!ci/LDKSwift/Sources/LDKSwift/
13+
!ci/LDKSwift/Sources/LDKSwift/batteries/*
14+
!ci/LDKSwift/Sources/LDKSwift/bindings/Bindings.swift
15+
1216
/xcode/LDKFramework/Build/
1317
/xcode/LDKFramework/LDKFramework.xcodeproj/project.xcworkspace/
1418
/xcode/LDKFramework/LDKFramework.xcodeproj/xcuserdata/

0 commit comments

Comments
 (0)