Skip to content

Commit 98651ad

Browse files
committed
Add CI Tooling for testing framework builds
Move DirectBindingsApp test to its own workflow Shorten Build Framework job name Remove UI Tests and signer requirement Make Unit Test targets runnable Do not require codesigning to build for testing Give jobs better names DirectBindingsApp load LDKFramework from workspace Build and run tests with simulator Fix DirectBindingsApp xcodeproj handle common files Add copy C headers build phase Define output paths in copy script Embed LDKFramework project in DirectBindingsApp Include bindings in test target Read XCResult from xcode folder Print correct message
1 parent cede724 commit 98651ad

File tree

21 files changed

+2553
-30395
lines changed

21 files changed

+2553
-30395
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Build For Testing
2+
inputs:
3+
scheme:
4+
description: Scheme
5+
required: true
6+
destination:
7+
description: Destination
8+
required: true
9+
workspace:
10+
description: Workspace Name
11+
required: true
12+
runs:
13+
using: composite
14+
steps:
15+
- shell: bash
16+
working-directory: .
17+
run: |
18+
cd xcode
19+
20+
xcodebuild clean build-for-testing \
21+
-allowProvisioningUpdates \
22+
-allowProvisioningDeviceRegistration \
23+
-workspace '${{ inputs.workspace }}' \
24+
-scheme '${{ inputs.scheme }}' \
25+
-destination '${{ inputs.destination }}' \
26+
-resultBundlePath BuildResults.xcresult \
27+
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Install Dependencies
2+
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="/opt/homebrew/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
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Test Without Building
2+
inputs:
3+
scheme:
4+
description: Scheme
5+
required: true
6+
destination:
7+
description: Destination
8+
required: true
9+
test-plan:
10+
description: Test Plan
11+
required: false
12+
artifact-prefix:
13+
description: The prefix for the filename of the uploaded xcresults file
14+
required: true
15+
check-name:
16+
description: The check name
17+
required: true
18+
workspace:
19+
description: Workspace Name
20+
required: true
21+
runs:
22+
using: composite
23+
steps:
24+
- shell: bash
25+
id: vars
26+
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
27+
- shell: bash
28+
working-directory: .
29+
run: |
30+
cd xcode
31+
32+
xcodebuild test-without-building \
33+
-workspace '${{ inputs.workspace }}' \
34+
-scheme '${{ inputs.scheme }}' \
35+
-destination '${{ inputs.destination }}' \
36+
-resultBundlePath "${{ inputs.artifact-prefix }}-${{ steps.vars.outputs.sha_short }}.xcresult"
37+
- uses: kishikawakatsumi/xcresulttool@v1
38+
if: always()
39+
with:
40+
path: ./xcode/${{ inputs.artifact-prefix }}-${{ steps.vars.outputs.sha_short }}.xcresult
41+
title: ${{ inputs.check-name }}
42+
show-passed-tests: false
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Build Frameworks
2+
permissions:
3+
contents: read
4+
statuses: read
5+
pull-requests: read
6+
actions: read
7+
checks: write
8+
on:
9+
push:
10+
branches:
11+
- main
12+
pull_request:
13+
branches:
14+
- "*"
15+
16+
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.4,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+
env:
37+
DEVELOPER_DIR: /Applications/Xcode_13.3.1.app/Contents/Developer
38+
steps:
39+
- name: Configure Xcode
40+
uses: maxim-lobanov/setup-xcode@v1
41+
with:
42+
xcode-version: latest
43+
- name: Checkout
44+
uses: actions/checkout@v2
45+
- name: Install Dependencies
46+
uses: ./.github/actions/install-dependencies
47+
- name: Build
48+
id: build
49+
uses: ./.github/actions/build-for-testing
50+
with:
51+
workspace: ${{ matrix.configuration['workspace'] }}
52+
scheme: ${{ matrix.configuration['scheme'] }}
53+
destination: ${{ matrix.configuration['destination'] }}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: DirectBindingsApp
2+
permissions:
3+
contents: read
4+
statuses: read
5+
pull-requests: read
6+
actions: read
7+
checks: write
8+
on:
9+
push:
10+
branches:
11+
- main
12+
pull_request:
13+
branches:
14+
- "*"
15+
16+
jobs:
17+
build:
18+
name: Build (${{ matrix.configuration['scheme'] }} - ${{ matrix.configuration['platform'] }})
19+
runs-on: macos-12
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
configuration:
24+
- scheme: DirectBindingsApp
25+
destination: platform=iOS Simulator,OS=15.4,name=iPhone 13 Pro
26+
platform: iOS Simulator
27+
workspace: LDKFramework.xcworkspace
28+
- scheme: DirectBindingsAppTests
29+
destination: platform=iOS Simulator,OS=15.4,name=iPhone 13 Pro
30+
platform: iOS Simulator
31+
workspace: LDKFramework.xcworkspace
32+
xcode-unit-test: DirectBindingsAppTests
33+
env:
34+
DEVELOPER_DIR: /Applications/Xcode_13.3.1.app/Contents/Developer
35+
steps:
36+
- name: Configure Xcode
37+
uses: maxim-lobanov/setup-xcode@v1
38+
with:
39+
xcode-version: latest
40+
- name: Checkout
41+
uses: actions/checkout@v2
42+
- name: Install Dependencies
43+
uses: ./.github/actions/install-dependencies
44+
- name: Build
45+
id: build
46+
uses: ./.github/actions/build-for-testing
47+
with:
48+
workspace: ${{ matrix.configuration['workspace'] }}
49+
scheme: ${{ matrix.configuration['scheme'] }}
50+
destination: ${{ matrix.configuration['destination'] }}
51+
- name: Xcode Unit Test
52+
if: ${{ matrix.configuration['xcode-unit-test'] != '' }}
53+
continue-on-error: true
54+
uses: ./.github/actions/test-without-building
55+
with:
56+
workspace: ${{ matrix.configuration['workspace'] }}
57+
scheme: ${{ matrix.configuration['scheme'] }}
58+
destination: ${{ matrix.configuration['destination'] }}
59+
test-plan: ${{ matrix.configuration['xcode-unit-test'] }}
60+
artifact-prefix: unit-tests-${{ matrix.configuration['sdk-name'] }}
61+
check-name: Xcode Unit Tests (${{ matrix.configuration['platform'] }})

.github/workflows/swift.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
name: Continuous Integration Checks
1+
name: Check Bindings
22

33
on: [ push, pull_request ]
44

55
jobs:
66
check_bindings:
7+
name: Build Bindings
78
runs-on: ubuntu-20.04
89
env:
910
TOOLCHAIN: stable
@@ -122,6 +123,7 @@ jobs:
122123
path: ci
123124

124125
test_bindings_with_sanitizer:
126+
name: Test Bindings with Sanitizer
125127
runs-on: ubuntu-20.04
126128
needs: check_bindings
127129
steps:
@@ -158,4 +160,3 @@ jobs:
158160
LDK_C_BINDINGS_BASE: /home/runner/work/ldk-swift/ldk-swift/ci/ldk-c-bindings
159161
LLVM_CLANG_ASAN_PATH: /usr/lib/llvm-11/lib/clang/11.0.0/lib/linux/libclang_rt.asan-x86_64.a
160162
RUST_BACKTRACE: 1
161-

.gitignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ ci/LDKSwift/.swiftpm
1717
/xcode/DirectBindingsApp/DirectBindingsApp.xcodeproj/xcuserdata/
1818

1919
## User settings
20-
xcode/LDK/*.h
21-
xcode/LDK/*.c
20+
xcode/build
21+
xcode/LDK/headers/*
2222
xcuserdata/
23-
/xcode/LDK/build
23+
/bindings/artifacts
24+
/xcode/DirectBindingsApp/headers

0 commit comments

Comments
 (0)