Skip to content

Commit bae6dfc

Browse files
committed
Add release framework action
# Conflicts: # xcode/LDK/LDKFramework.xcodeproj/project.pbxproj
1 parent 1e22047 commit bae6dfc

File tree

3 files changed

+191
-38
lines changed

3 files changed

+191
-38
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Archive Framework
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+
platform:
13+
description: Platform Name
14+
required: true
15+
runs:
16+
using: composite
17+
steps:
18+
- shell: bash
19+
working-directory: .
20+
run: |
21+
cd xcode
22+
23+
xcodebuild archive \
24+
-scheme '${{ inputs.scheme }}' \
25+
-workspace '${{ inputs.workspace }}' \
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
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Release Framework
2+
permissions:
3+
contents: write
4+
statuses: read
5+
pull-requests: read
6+
actions: read
7+
checks: write
8+
on:
9+
push:
10+
tags:
11+
- "*"
12+
13+
jobs:
14+
archive:
15+
name: Archive Frameworks (${{ matrix.configuration['platform'] }})
16+
runs-on: macos-12
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
configuration:
21+
- scheme: LDKFramework
22+
destination: generic/platform=iOS
23+
platform: iOS
24+
workspace: LDKFramework.xcworkspace
25+
- scheme: LDKFramework
26+
destination: generic/platform=iOS Simulator
27+
platform: iOS Simulator
28+
workspace: LDKFramework.xcworkspace
29+
- scheme: LDKFramework_Mac
30+
destination: generic/platform=OS X
31+
platform: Darwin
32+
workspace: LDKFramework.xcworkspace
33+
- scheme: LDKFramework
34+
destination: generic/platform=macOS
35+
platform: Catalyst
36+
workspace: LDKFramework.xcworkspace
37+
env:
38+
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app/Contents/Developer
39+
BUILD_DIR: ./build
40+
steps:
41+
- name: Configure Xcode
42+
uses: maxim-lobanov/setup-xcode@v1
43+
with:
44+
xcode-version: latest
45+
- name: Checkout
46+
uses: actions/checkout@v2
47+
- name: Install Dependencies
48+
uses: ./.github/actions/install-dependencies
49+
- name: Archive
50+
uses: ./.github/actions/archive-framework
51+
with:
52+
workspace: ${{ matrix.configuration['workspace'] }}
53+
scheme: ${{ matrix.configuration['scheme'] }}
54+
destination: ${{ matrix.configuration['destination'] }}
55+
platform: ${{ matrix.configuration['platform'] }}
56+
- name: Upload Archive
57+
uses: actions/upload-artifact@v3
58+
with:
59+
name: LDKFramework-${{ matrix.configuration['platform'] }}.xcarchive
60+
path: |
61+
./xcode/build/LDKFramework-${{ matrix.configuration['platform'] }}.xcarchive
62+
create-xcframework:
63+
name: Create Fat Framework
64+
runs-on: macos-12
65+
needs: [archive]
66+
env:
67+
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app/Contents/Developer
68+
BUILD_DIR: ./build
69+
steps:
70+
- name: Download xcarchives
71+
uses: actions/download-artifact@v3
72+
- name: Create xcframework and release
73+
run: |
74+
xcodebuild -create-xcframework \
75+
-framework LDKFramework-iOS.xcarchive/Products/Library/Frameworks/LDKFramework.framework \
76+
-framework LDKFramework-iOS\ Simulator.xcarchive/Products/Library/Frameworks/LDKFramework.framework \
77+
-framework LDKFramework-Catalyst.xcarchive/Products/Library/Frameworks/LDKFramework.framework \
78+
-framework LDKFramework-Darwin.xcarchive/Products/Library/Frameworks/LDKFramework_Mac.framework \
79+
-output LDKFramework.xcframework
80+
- name: Zip Xcframework
81+
run: |
82+
zip -r LDKFramework.xcframework.zip LDKFramework.xcframework
83+
- name: Upload Framework Artifact
84+
uses: actions/upload-artifact@v3
85+
with:
86+
name: LDKFramework.xcframework.zip
87+
path: LDKFramework.xcframework.zip
88+
release:
89+
name: Create Release
90+
runs-on: ubuntu-latest
91+
needs: [create-xcframework]
92+
steps:
93+
- name: Download Framework Artifact
94+
uses: actions/download-artifact@v3
95+
with:
96+
name: LDKFramework.xcframework.zip
97+
- name: Create Release
98+
uses: softprops/action-gh-release@v1
99+
with:
100+
files: LDKFramework.xcframework.zip

xcode/build_framework.sh

Lines changed: 61 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,70 @@
11
set -e # bail upon first error
22

3-
pushd ../bindings/bin
43
BIN_OUTPUT_DIRECTORY=`pwd`
4+
BUILD_DIR=${BIN_OUTPUT_DIRECTORY}/build
5+
6+
mkdir -p $BUILD_DIR
7+
8+
pushd $BUILD_DIR
59
rm -rf LDKFramework*
610
popd
711

8-
pushd ./LDKFramework
12+
# As of clang 13, the `13.0` in the target `x86_64-apple-ios13.0-macabi` is dropped.
13+
# However, in cc-rs, it is still hard-coded that way (https://github.com/rust-lang/cc-rs/pull/678).
14+
# The only way for this script to run completely (i.e. include Mac Catalyst) is to switch to a version of Xcode
15+
# that uses clang 12 (13.2.1 being the latest). Should be resolved after https://github.com/rust-lang/cc-rs/pull/678
16+
sudo xcode-select -s /Applications/Xcode\ 13.2.1.app/Contents/Developer/
917

10-
# Build for both iOS and iOS Simulator
11-
xcodebuild archive -scheme LDKFramework -destination "generic/platform=iOS" -archivePath ${BIN_OUTPUT_DIRECTORY}/LDKFramework-iOS ENABLE_BITCODE=NO CLANG_ADDRESS_SANITIZER=NO CLANG_ADDRESS_SANITIZER_ALLOW_ERROR_RECOVERY=NO CLANG_ADDRESS_SANITIZER_USE_AFTER_SCOPE=NO SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES
12-
xcodebuild archive -scheme LDKFramework -destination "generic/platform=iOS Simulator" -archivePath ${BIN_OUTPUT_DIRECTORY}/LDKFramework-Sim CLANG_ADDRESS_SANITIZER=NO CLANG_ADDRESS_SANITIZER_ALLOW_ERROR_RECOVERY=NO CLANG_ADDRESS_SANITIZER_USE_AFTER_SCOPE=NO SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES
18+
rm -f LDK/libldk.a
19+
# Build for iOS
20+
xcodebuild archive \
21+
-scheme LDKFramework \
22+
-workspace 'LDKFramework.xcworkspace' \
23+
-destination 'generic/platform=iOS' \
24+
-archivePath ${BUILD_DIR}/LDKFramework-iOS \
25+
ENABLE_BITCODE=NO \
26+
CLANG_ADDRESS_SANITIZER=NO CLANG_ADDRESS_SANITIZER_ALLOW_ERROR_RECOVERY=NO CLANG_ADDRESS_SANITIZER_USE_AFTER_SCOPE=NO \
27+
SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES
1328

14-
popd
29+
rm -f LDK/libldk.a
30+
# Build for iOS Simulator
31+
xcodebuild archive \
32+
-scheme LDKFramework \
33+
-workspace 'LDKFramework.xcworkspace' \
34+
-destination 'generic/platform=iOS Simulator' \
35+
-archivePath ${BUILD_DIR}/LDKFramework-Sim \
36+
ENABLE_BITCODE=NO \
37+
CLANG_ADDRESS_SANITIZER=NO CLANG_ADDRESS_SANITIZER_ALLOW_ERROR_RECOVERY=NO CLANG_ADDRESS_SANITIZER_USE_AFTER_SCOPE=NO \
38+
SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES
39+
40+
rm -f LDK/libldk.a
41+
# Build for OS X Darwin
42+
xcodebuild archive \
43+
-scheme LDKFramework_Mac \
44+
-workspace 'LDKFramework.xcworkspace' \
45+
-destination 'generic/platform=OS X' \
46+
-archivePath ${BUILD_DIR}/LDKFramework-Darwin \
47+
ENABLE_BITCODE=NO \
48+
CLANG_ADDRESS_SANITIZER=NO CLANG_ADDRESS_SANITIZER_ALLOW_ERROR_RECOVERY=NO CLANG_ADDRESS_SANITIZER_USE_AFTER_SCOPE=NO \
49+
SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES
50+
51+
rm -f LDK/libldk.a
52+
# Build for macOS Catalyst
53+
xcodebuild archive \
54+
-scheme LDKFramework \
55+
-workspace 'LDKFramework.xcworkspace' \
56+
-destination 'generic/platform=macOS' \
57+
-archivePath ${BUILD_DIR}/LDKFramework-Catalyst \
58+
ENABLE_BITCODE=NO \
59+
CLANG_ADDRESS_SANITIZER=NO CLANG_ADDRESS_SANITIZER_ALLOW_ERROR_RECOVERY=NO CLANG_ADDRESS_SANITIZER_USE_AFTER_SCOPE=NO \
60+
SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES
61+
62+
xcodebuild -create-xcframework \
63+
-framework ${BUILD_DIR}/LDKFramework-iOS.xcarchive/Products/Library/Frameworks/LDKFramework.framework \
64+
-framework ${BUILD_DIR}/LDKFramework-Sim.xcarchive/Products/Library/Frameworks/LDKFramework.framework \
65+
-framework ${BUILD_DIR}/LDKFramework-Darwin.xcarchive/Products/Library/Frameworks/LDKFramework_Mac.framework \
66+
-framework ${BUILD_DIR}/LDKFramework-Catalyst.xcarchive/Products/Library/Frameworks/LDKFramework.framework \
67+
-output ${BUILD_DIR}/LDKFramework.xcframework
1568

16-
ARCH=$(uname -m)
17-
if [ "$ARCH" != "arm64" ]; then
18-
pushd ./LDKFramework_Mac
19-
xcodebuild archive -scheme LDKFramework -destination "platform=macOS,arch=x86_64,variant=Mac Catalyst" -archivePath ${BIN_OUTPUT_DIRECTORY}/LDKFramework-macOS ENABLE_BITCODE=NO ONLY_ACTIVE_ARCH=YES SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES
20-
popd
21-
22-
xcodebuild -create-xcframework \
23-
-framework ${BIN_OUTPUT_DIRECTORY}/LDKFramework-iOS.xcarchive/Products/Library/Frameworks/LDKFramework.framework \
24-
-framework ${BIN_OUTPUT_DIRECTORY}/LDKFramework-Sim.xcarchive/Products/Library/Frameworks/LDKFramework.framework \
25-
-framework ${BIN_OUTPUT_DIRECTORY}/LDKFramework-macOS.xcarchive/Products/Library/Frameworks/LDKFramework.framework \
26-
-output ${BIN_OUTPUT_DIRECTORY}/LDKFramework.xcframework
27-
28-
xcodebuild -create-xcframework \
29-
-framework ${BIN_OUTPUT_DIRECTORY}/LDKFramework-iOS.xcarchive/Products/Library/Frameworks/LDKFramework.framework \
30-
-framework ${BIN_OUTPUT_DIRECTORY}/LDKFramework-macOS.xcarchive/Products/Library/Frameworks/LDKFramework.framework \
31-
-output ${BIN_OUTPUT_DIRECTORY}/LDKFramework-no-simulator.xcframework
32-
33-
34-
xcodebuild -create-xcframework \
35-
-framework ${BIN_OUTPUT_DIRECTORY}/LDKFramework-macOS.xcarchive/Products/Library/Frameworks/LDKFramework.framework \
36-
-output ${BIN_OUTPUT_DIRECTORY}/LDKFramework-only-macOS.xcframework
37-
38-
xcodebuild -create-xcframework \
39-
-framework ${BIN_OUTPUT_DIRECTORY}/LDKFramework-iOS.xcarchive/Products/Library/Frameworks/LDKFramework.framework \
40-
-framework ${BIN_OUTPUT_DIRECTORY}/LDKFramework-Sim.xcarchive/Products/Library/Frameworks/LDKFramework.framework \
41-
-output ${BIN_OUTPUT_DIRECTORY}/LDKFramework-no-macOS.xcframework
42-
else
43-
xcodebuild -create-xcframework \
44-
-framework ${BIN_OUTPUT_DIRECTORY}/LDKFramework-iOS.xcarchive/Products/Library/Frameworks/LDKFramework.framework \
45-
-framework ${BIN_OUTPUT_DIRECTORY}/LDKFramework-Sim.xcarchive/Products/Library/Frameworks/LDKFramework.framework \
46-
-output ${BIN_OUTPUT_DIRECTORY}/LDKFramework.xcframework
47-
fi
69+
# Switch back to default version of Xcode (presumably latest)
70+
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer/

0 commit comments

Comments
 (0)