Skip to content

Commit d9ff961

Browse files
authored
Merge pull request #62 from lightningdevkit/2022-07-streamline-workflows
Streamline Github CI workflows
2 parents 3978963 + 5dff20f commit d9ff961

File tree

6 files changed

+31
-43
lines changed

6 files changed

+31
-43
lines changed

.github/actions/install-dependencies/action.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
name: Install Dependencies
22
description: Install dependencies
3+
inputs:
4+
destination:
5+
description: Location to check out rust-lightning and ldk-c-bindings repositories
6+
default: '.'
7+
required: true
8+
configureRustNightly:
9+
description: Flag whether or not to install rust, which is not necessary on Ubuntu machines
10+
default: 'true'
11+
required: false
312
runs:
413
using: composite
514
steps:
@@ -11,16 +20,18 @@ runs:
1120
shell: bash
1221
run: |
1322
echo `pwd`
14-
mkdir -p ./bindings/artifacts/bin
15-
git clone --branch 2022-07-109-java-bindings https://github.com/TheBlueMatt/rust-lightning ./bindings/artifacts/rust-lightning
16-
git clone --branch v0.0.109.0 https://github.com/lightningdevkit/ldk-c-bindings ./bindings/artifacts/ldk-c-bindings
23+
mkdir -p ${{ inputs.destination }}/bin
24+
git clone --branch 2022-07-109-java-bindings https://github.com/TheBlueMatt/rust-lightning ${{ inputs.destination }}/rust-lightning
25+
git clone --branch v0.0.109.0 https://github.com/lightningdevkit/ldk-c-bindings ${{ inputs.destination }}/ldk-c-bindings
1726
- name: Install Rust, required targets
27+
if: ${{ inputs.configureRustNightly == 'true' }}
1828
shell: bash
1929
run: |
2030
rustup toolchain install nightly
2131
rustup target add aarch64-apple-darwin aarch64-apple-ios x86_64-apple-ios
2232
rustup component add rust-src --toolchain nightly-x86_64-apple-darwin
2333
- name: Load Cache
34+
if: ${{ inputs.configureRustNightly == 'true' }}
2435
uses: actions/cache@v3
2536
with:
2637
path: |
@@ -34,12 +45,12 @@ runs:
3445
shell: bash
3546
run: |
3647
export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
37-
pushd bindings/artifacts/ldk-c-bindings
48+
pushd ${{ inputs.destination }}/ldk-c-bindings
3849
./genbindings.sh ../rust-lightning true
3950
popd
4051
- name: Generate Swift Bindings
4152
shell: bash
4253
run: |
4354
python3 ./
4455
env:
45-
LDK_SWIFT_GENERATOR_INPUT_HEADER_PATH: bindings/artifacts/ldk-c-bindings/lightning-c-bindings/include/lightning.h
56+
LDK_SWIFT_GENERATOR_INPUT_HEADER_PATH: ${{ inputs.destination }}/ldk-c-bindings/lightning-c-bindings/include/lightning.h

.github/workflows/build-xcframework-parallel-archives.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ jobs:
4242
uses: actions/checkout@v2
4343
- name: Install Dependencies
4444
uses: ./.github/actions/install-dependencies
45+
with:
46+
destination: ./bindings/artifacts
4547
- name: Build
4648
id: build
4749
uses: ./.github/actions/archive-framework

.github/workflows/build-xcframework-parallel-libldk.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ jobs:
5050
uses: actions/checkout@v2
5151
- name: Install Dependencies
5252
uses: ./.github/actions/install-dependencies
53+
with:
54+
destination: ./bindings/artifacts
5355
- name: Build libldk.a
5456
shell: bash
5557
run:

.github/workflows/build-xcframework-sequential.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
uses: actions/checkout@v2
3030
- name: Install Dependencies
3131
uses: ./.github/actions/install-dependencies
32+
with:
33+
destination: ./bindings/artifacts
3234
- name: Generate XCFramework
3335
uses: ./.github/actions/generate-xcframework
3436
- name: Create XCFramework artifact

.github/workflows/release-framework.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ jobs:
3232
uses: actions/checkout@v2
3333
- name: Install Dependencies
3434
uses: ./.github/actions/install-dependencies
35+
with:
36+
destination: ./bindings/artifacts
3537
- name: Generate XCFramework
3638
uses: ./.github/actions/generate-xcframework
3739
- name: Create XCFramework artifact

.github/workflows/swift.yml

Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,56 +15,25 @@ jobs:
1515
steps:
1616
- name: Checkout source code
1717
uses: actions/checkout@v2
18-
- name: Checkout Rust-Lightning and LDK-C-Bindings git
19-
run: |
20-
cd ./ci
21-
git config --global user.email "[email protected]"
22-
git config --global user.name "LDK CI"
23-
# Note this is a different endpoint, as we need one non-upstream commit!
24-
# git clone https://git.bitcoin.ninja/rust-lightning
25-
# git clone https://github.com/TheBlueMatt/rust-lightning
26-
git clone --branch 2022-07-109-java-bindings https://github.com/TheBlueMatt/rust-lightning
27-
cd rust-lightning
28-
echo "rust-lightning commit hash:"
29-
git rev-parse HEAD
30-
cd ..
31-
git clone --branch v0.0.109.0 https://github.com/lightningdevkit/ldk-c-bindings
32-
# git clone https://github.com/TheBlueMatt/ldk-c-bindings
33-
cd ldk-c-bindings
34-
echo "ldk-c-bindings commit hash:"
35-
git rev-parse HEAD
3618
- name: Install native Rust toolchain, Valgrind, and build utilities
3719
run: |
3820
sudo apt-get update
3921
sudo apt-get -y dist-upgrade
4022
sudo apt-get -y install cargo valgrind lld git g++ clang curl
41-
- name: Install cbindgen
42-
run: cargo install --force cbindgen
43-
- name: Regenerate C bindings
44-
run: |
45-
pwd
46-
cd ci/ldk-c-bindings
47-
pwd
48-
./genbindings.sh ../rust-lightning true
49-
cd ..
23+
- name: Install Dependencies
24+
uses: ./.github/actions/install-dependencies
25+
with:
26+
destination: ./ci
27+
configureRustNightly: false
28+
env:
29+
LDK_SWIFT_GENERATOR_OUTPUT_DIRECTORY_PATH: ci/LDKSwift/Sources/LDKSwift/bindings
5030
- name: Copy new headers into bindings
5131
run: |
5232
cd ci
5333
mkdir -p ./LDKSwift/Sources/LDKHeaders/include
5434
cp ldk-c-bindings/lightning-c-bindings/include/*.h ./LDKSwift/Sources/LDKHeaders/include/
5535
cp ldk-c-bindings/ldk-net/ldk_net.h ./LDKSwift/Sources/LDKHeaders/include/
5636
cp ldk-c-bindings/ldk-net/ldk_net.c ./LDKSwift/Sources/LDKHeaders/
57-
- name: Generate (copy for debugging) Swift bindings and copy batteries
58-
run: |
59-
pwd
60-
python3 ./ # Generate bindings into ci subdirectory
61-
62-
# TODO: switch back to generation method after debugging
63-
# mkdir -p ci/LDKSwift/Sources/LDKSwift
64-
# cp -a bindings/LDK/. ci/LDKSwift/Sources/LDKSwift
65-
env:
66-
LDK_SWIFT_GENERATOR_INPUT_HEADER_PATH: ci/ldk-c-bindings/lightning-c-bindings/include/lightning.h
67-
LDK_SWIFT_GENERATOR_OUTPUT_DIRECTORY_PATH: ci/LDKSwift/Sources/LDKSwift/bindings
6837
- name: Check that the latest auto-generated Swift files are in the repo
6938
run: |
7039
python3 ./ # Generate bindings into local directory

0 commit comments

Comments
 (0)