Skip to content

Commit aee5cc7

Browse files
authored
Merge pull request #59 from lightningdevkit/2022-07-python-release-workflow
Move Xcode build and release workflows to Python scripts.
2 parents e360ff6 + 4aa91a5 commit aee5cc7

28 files changed

+2659
-5811
lines changed
Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11
name: Archive Framework
22
inputs:
3-
scheme:
4-
description: Scheme
5-
required: true
6-
destination:
7-
description: Destination
8-
required: true
9-
platform:
10-
description: Platform Name
11-
required: true
12-
project:
13-
description: Project directory, relative to the xcode folder
14-
required: true
3+
destination:
4+
description: Destination platform/architecture details. Typically looks like "generic/platform=iOS" or "platform=macOS,variant=Mac Catalyst,arch=x86_64"
5+
required: true
6+
human_readable_platform:
7+
description: Human-readable platform name, used for directory naming
8+
required: true
9+
description: Framework archivation description.
1510
runs:
16-
using: composite
17-
steps:
18-
- shell: bash
19-
working-directory: .
20-
run: |
21-
cd xcode
11+
using: composite
12+
steps:
13+
- shell: bash
14+
working-directory: .
15+
run: |
16+
cd xcode
2217
23-
xcodebuild archive \
24-
-scheme '${{ inputs.scheme }}' \
25-
-project '${{ inputs.project }}' \
26-
-destination '${{ inputs.destination }}' \
27-
-archivePath "$BUILD_DIR/LDKFramework-${{ inputs.platform }}" \
28-
ENABLE_BITCODE=NO \
29-
CLANG_ADDRESS_SANITIZER=NO CLANG_ADDRESS_SANITIZER_ALLOW_ERROR_RECOVERY=NO CLANG_ADDRESS_SANITIZER_USE_AFTER_SCOPE=NO \
30-
SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES
18+
LDK_C_BINDINGS_BINARY_DIRECTORY="" \
19+
xcodebuild archive \
20+
-project 'LDKFramework/LDKFramework.xcodeproj' \
21+
-scheme 'LDKFramework' \
22+
-destination 'generic/platform=${{ inputs.destination }}' \
23+
-archivePath "/Users/runner/work/ldk-swift/ldk-swift/bindings/bin/release/${{ inputs.human_readable_platform }}/${{ inputs.human_readable_platform }}" \
24+
ENABLE_BITCODE=NO \
25+
EXCLUDED_ARCHS="i386 armv7" \
26+
SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
27+
LDK_C_BINDINGS_BASE="${LDK_C_BINDINGS_BASE}" \
28+
LDK_C_BINDINGS_BINARY_DIRECTORY="" \
29+
LDK_C_BINDINGS_BINARY_FORCED_REBUILD_OUTPUT_DIRECTORY="${LDK_C_BINDINGS_BINARY_DIRECTORY}"

.github/workflows/build-frameworks.yml

Lines changed: 0 additions & 76 deletions
This file was deleted.
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: XCFramework from XCArchives
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-xcarchives:
18+
name: Build xcarchive for ${{ matrix.configuration['human_readable_platform'] }}
19+
runs-on: macos-12
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
configuration:
24+
- destination: 'iOS Simulator'
25+
human_readable_platform: 'iphonesimulator'
26+
- destination: 'iOS'
27+
human_readable_platform: 'iphoneos'
28+
- destination: 'OS X'
29+
human_readable_platform: 'macosx'
30+
- destination: 'macOS,variant=Mac Catalyst'
31+
human_readable_platform: 'catalyst'
32+
env:
33+
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app/Contents/Developer
34+
LDK_C_BINDINGS_BASE: /Users/runner/work/ldk-swift/ldk-swift/bindings/artifacts/ldk-c-bindings
35+
LDK_C_BINDINGS_BINARY_DIRECTORY: /Users/runner/work/ldk-swift/ldk-swift/bindings/artifacts/bin
36+
steps:
37+
- name: Configure Xcode
38+
uses: maxim-lobanov/setup-xcode@v1
39+
with:
40+
xcode-version: latest
41+
- name: Checkout
42+
uses: actions/checkout@v2
43+
- name: Install Dependencies
44+
uses: ./.github/actions/install-dependencies
45+
- name: Build
46+
id: build
47+
uses: ./.github/actions/archive-framework
48+
with:
49+
destination: ${{ matrix.configuration['destination'] }}
50+
human_readable_platform: ${{ matrix.configuration['human_readable_platform'] }}
51+
- name: Xcarchive hack
52+
run: touch ./bindings_root.txt
53+
- name: Upload xcarchive
54+
uses: actions/upload-artifact@v3
55+
with:
56+
name: bindings
57+
path: ./bindings/**/bin/release/${{ matrix.configuration['human_readable_platform'] }}/${{ matrix.configuration['human_readable_platform'] }}.xcarchive
58+
59+
generate:
60+
name: Combine xcarchives into xcframework
61+
runs-on: macos-12
62+
needs: [ build-xcarchives ]
63+
env:
64+
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app/Contents/Developer
65+
LDK_C_BINDINGS_BASE: /Users/runner/work/ldk-swift/ldk-swift/bindings/artifacts/ldk-c-bindings
66+
steps:
67+
- name: Configure Xcode
68+
uses: maxim-lobanov/setup-xcode@v1
69+
with:
70+
xcode-version: latest
71+
- name: Checkout
72+
uses: actions/checkout@v2
73+
- name: Download xcarchives
74+
uses: actions/download-artifact@v3
75+
- name: Generate xcframework
76+
shell: bash
77+
run:
78+
python3 ./src/scripts/generate_xcframework.py
79+
env:
80+
PRESERVE_XCARCHIVES: true
81+
- name: Zip Xcframework
82+
run: |
83+
ditto -c -k --sequesterRsrc /Users/runner/work/ldk-swift/ldk-swift/bindings/bin/release/LDKFramework.xcframework LDKFramework.xcframework.zip
84+
- name: Upload Framework Artifact
85+
uses: actions/upload-artifact@v3
86+
with:
87+
name: LDKFramework
88+
path: LDKFramework.xcframework.zip
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: XCFramework from libldks
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-libldks:
18+
name: Build & lipo libldk.a for ${{ matrix.configuration['human_readable_platform'] }}
19+
runs-on: macos-12
20+
env:
21+
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app/Contents/Developer
22+
LDK_C_BINDINGS_BASE: /Users/runner/work/ldk-swift/ldk-swift/bindings/artifacts/ldk-c-bindings
23+
strategy:
24+
fail-fast: true
25+
matrix:
26+
configuration:
27+
- platform_name: 'iphoneos'
28+
human_readable_platform: 'iphoneos'
29+
llvm_target_triple_suffix: ''
30+
architectures: 'arm64'
31+
- platform_name: 'iphonesimulator'
32+
human_readable_platform: 'iphonesimulator'
33+
llvm_target_triple_suffix: '-simulator'
34+
architectures: 'arm64 x86_64'
35+
- platform_name: 'macosx'
36+
human_readable_platform: 'macosx'
37+
llvm_target_triple_suffix: ''
38+
architectures: 'arm64 x86_64'
39+
- platform_name: 'macosx'
40+
human_readable_platform: 'catalyst'
41+
llvm_target_triple_suffix: '-macabi'
42+
architectures: 'arm64 x86_64'
43+
steps:
44+
- name: Configure Xcode
45+
if: matrix.configuration['human_readable_platform'] == 'catalyst'
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 libldk.a
54+
shell: bash
55+
run:
56+
python3 ./src/scripts/build_individual_libldk.py
57+
env:
58+
PLATFORM_NAME: ${{ matrix.configuration['platform_name'] }}
59+
LLVM_TARGET_TRIPLE_SUFFIX: ${{ matrix.configuration['llvm_target_triple_suffix'] }}
60+
ARCHS: ${{ matrix.configuration['architectures'] }}
61+
- name: Upload binary
62+
uses: actions/upload-artifact@v3
63+
with:
64+
name: bindings
65+
path: |
66+
./bindings/**/artifacts/ldk-c-bindings/lightning-c-bindings/include/*.h
67+
./bindings/**/artifacts/ldk-c-bindings/ldk-net/ldk_net.*
68+
./bindings/**/bin/release/${{ matrix.configuration['human_readable_platform'] }}/libldk.a
69+
generate-parallel:
70+
name: Build xcarchives and generate xcframework
71+
needs: [ build-libldks ]
72+
runs-on: macos-12
73+
env:
74+
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app/Contents/Developer
75+
LDK_C_BINDINGS_BASE: /Users/runner/work/ldk-swift/ldk-swift/bindings/artifacts/ldk-c-bindings
76+
steps:
77+
- name: Configure Xcode
78+
uses: maxim-lobanov/setup-xcode@v1
79+
with:
80+
xcode-version: latest
81+
- name: Checkout
82+
uses: actions/checkout@v2
83+
- name: Download libldks
84+
uses: actions/download-artifact@v3
85+
- name: Generate Swift Bindings
86+
shell: bash
87+
run: |
88+
python3 ./
89+
env:
90+
LDK_SWIFT_GENERATOR_INPUT_HEADER_PATH: bindings/artifacts/ldk-c-bindings/lightning-c-bindings/include/lightning.h
91+
- name: Generate xcframework
92+
shell: bash
93+
run:
94+
python3 ./src/scripts/generate_xcframework.py
95+
- name: Zip Xcframework
96+
run: |
97+
ditto -c -k --sequesterRsrc /Users/runner/work/ldk-swift/ldk-swift/bindings/bin/release/LDKFramework.xcframework LDKFramework.xcframework.zip
98+
- name: Upload Framework Artifact
99+
uses: actions/upload-artifact@v3
100+
with:
101+
name: LDKFramework
102+
path: LDKFramework.xcframework.zip
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: XCFramework from sequential Python script
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+
generate-sequential:
18+
name: Build libldks, build xcarchives, and combine into xcframework
19+
runs-on: macos-12
20+
env:
21+
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app/Contents/Developer
22+
LDK_C_BINDINGS_BASE: /Users/runner/work/ldk-swift/ldk-swift/bindings/artifacts/ldk-c-bindings
23+
steps:
24+
- name: Configure Xcode
25+
uses: maxim-lobanov/setup-xcode@v1
26+
with:
27+
xcode-version: latest
28+
- name: Checkout
29+
uses: actions/checkout@v2
30+
- name: Install Dependencies
31+
uses: ./.github/actions/install-dependencies
32+
- name: Generate XCFramework
33+
uses: ./.github/actions/generate-xcframework
34+
- name: Zip Xcframework
35+
run: |
36+
ditto -c -k --sequesterRsrc /Users/runner/work/ldk-swift/ldk-swift/bindings/bin/release/LDKFramework.xcframework LDKFramework.xcframework.zip
37+
- name: Upload Framework Artifact
38+
uses: actions/upload-artifact@v3
39+
with:
40+
name: LDKFramework
41+
path: LDKFramework.xcframework.zip

0 commit comments

Comments
 (0)