Skip to content

Commit

Permalink
Preserve symlinks in XCArchives and XCFramework (#55)
Browse files Browse the repository at this point in the history
# Preserve symlinks in XCArchives and XCFramework

## ♻️ Current situation & Problem
Currently, the XCArchives and XCFramework actions don't preserve
symlinks, resulting in build failures for using XCFrameworks on the
macOS platform.


## ⚙️ Release Notes 
- Preserve symlinks in XCArchives and XCFramework


## 📚 Documentation
-


## ✅ Testing
Tested with llama.cpp XCFramework building


### Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md).
  • Loading branch information
philippzagar authored Mar 7, 2024
1 parent 4f79591 commit e7025f1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/archive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
swift --version
echo Release version: ${{ inputs.version }}
echo SDK: ${{ matrix.sdk }}
- name: Archive for iOS
- name: Archive for ${{ matrix.sdk }} SDK
run: |
xcodebuild archive \
-workspace ${{ inputs.workspaceFile }} \
Expand All @@ -80,8 +80,12 @@ jobs:
CI=TRUE \
VERSION_NUMBER=${{ inputs.version }} \
SWIFT_OBJC_INTEROP_MODE=${{ (inputs.cxxInterop && 'objcxx') || 'objc' }}
- name: Package the XCArchive # To preserve symlinks within the XCArchives that are not preserved by the GitHub Actions artifact upload
run: |
cd .build
tar -zcvf ${{ inputs.xcArchiveName }}-${{ matrix.sdk }}.xcarchive.tar.gz ${{ inputs.xcArchiveName }}-${{ matrix.sdk }}.xcarchive
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.xcArchiveName }}-${{ matrix.sdk }}.xcarchive
path: ./.build/${{ inputs.xcArchiveName }}-${{ matrix.sdk }}.xcarchive
name: ${{ inputs.xcArchiveName }}-${{ matrix.sdk }}.xcarchive.tar.gz
path: ./.build/${{ inputs.xcArchiveName }}-${{ matrix.sdk }}.xcarchive.tar.gz
18 changes: 17 additions & 1 deletion .github/workflows/xcframework.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ on:
type: string
required: false
default: 'Release'
dryRun:
description: 'If true, the workflow will not commit and release the built XCFramework.'
type: boolean
required: false
default: false
runsonlabels:
description: 'JSON-based collection of labels indicating which type of github runner should be chosen.'
type: string
Expand Down Expand Up @@ -84,7 +89,8 @@ jobs:
- uses: actions/download-artifact@v4
with:
path: ./.build
- name: Create XCFramework
merge-multiple: true
- name: Unpack XCArchives and create XCFramework
run: |
rm -rf ${{ inputs.xcFrameworkName }}.xcframework
Expand All @@ -96,6 +102,9 @@ jobs:
IFS=' ' read -r -a SDKS <<< "$SDK_LIST"
FRAMEWORKS_ARGS=""
for SDK in "${SDKS[@]}"; do
# Unpack the XCArchive
tar -zxvf ./.build/${{ inputs.xcFrameworkName }}-${SDK}.xcarchive.tar.gz -C ./.build/
# Specify the path to the framework within the XCArchive
ARCHIVE_PATH="./.build/${{ inputs.xcFrameworkName }}-${SDK}.xcarchive/Products/Library/Frameworks/${{ inputs.xcFrameworkName }}.framework"
echo "Checking archive path: $ARCHIVE_PATH"
if [ -d "$ARCHIVE_PATH" ]; then
Expand All @@ -115,6 +124,7 @@ jobs:
rm -rf .build
- name: Commit and push XCFramework
uses: EndBug/add-and-commit@v9
if: ${{ !inputs.dryRun }}
with:
add: ${{ inputs.xcFrameworkName }}.xcframework
message: Create XCFramework for release ${{ inputs.version }}
Expand All @@ -126,8 +136,14 @@ jobs:
- name: Create Artifacts
run: |
tar -zcvf ${{ inputs.xcFrameworkName }}.xcframework.tar.gz ${{ inputs.xcFrameworkName }}.xcframework
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.xcFrameworkName }}.xcframework.tar.gz
path: ${{ inputs.xcFrameworkName }}.xcframework.tar.gz
- name: Create Release
uses: softprops/action-gh-release@v1
if: ${{ !inputs.dryRun }}
with:
tag_name: ${{ inputs.version }}
generate_release_notes: true
Expand Down

0 comments on commit e7025f1

Please sign in to comment.