Skip to content

Commit

Permalink
Preserve symlinks when creating the release package
Browse files Browse the repository at this point in the history
actions/upload-artifact follows symlinks when asked to archive a directory,
which results in the release package having three copies of each macos/catalyst
library. To fix this, skip extracting the zip before archiving even though it
results in an awkward nested zip.
  • Loading branch information
tgoyne committed Feb 13, 2024
1 parent 68530d3 commit 55466ae
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 183 deletions.
102 changes: 18 additions & 84 deletions .github/workflows/master-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ on:
push:
branches:
- "master"
- "tg/release-symlink"
env:
XCODE_VERSION: "['14.2', '14.3.1', '15.1', '15.2']"
PLATFORM: "['ios', 'osx', 'watchos', 'tvos', 'catalyst', 'visionos']"
BUILD_PLATFORM: "['ios', 'iossimulator', 'osx', 'watchos', 'watchossimulator', 'tvos', 'tvossimulator', 'catalyst', 'visionos', 'visionossimulator']"
DOC_VERSION: '15.1'
DOC_VERSION: '15.2'
JAZZY_VERSION: '0.14.4'
RELEASE_VERSION: '15.2'
TEST_VERSION: '15.1'
TEST_VERSION: '15.2'
jobs:
cleanup: # Clean-up XCode cloud workflows, before running the pipeline
runs-on: ubuntu-latest
Expand All @@ -21,7 +22,7 @@ jobs:
id: token
run: |
token=$(echo $(ruby ./scripts/xcode_cloud_helper.rb --issuer-id ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }} --key-id ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }} --pk "${{ secrets.APPLE_STORE_CONNECT_API_KEY }}" get-token))
echo "TOKEN=$token" >> $GITHUB_OUTPUT
echo "TOKEN=$token" >> $GITHUB_OUTPUT
- name: Clean up release-packages xcode cloud workflows
run: |
ruby ./scripts/xcode_cloud_helper.rb clean-up-release-workflows -t ${{ steps.token.outputs.TOKEN }}
Expand Down Expand Up @@ -81,13 +82,12 @@ jobs:
name: realm-examples
build-product: # Creates framework for each platform, xcode version, target and configuration
runs-on: macos-13
name: Package framework
name: Package framework
needs: prepare
strategy:
max-parallel: 20 # Blocks of 20, therefore if any of the build fails, we don't get a lot of XCode Clouds builds hanging, which are expensive.
matrix:
platform: ${{ fromJSON(needs.prepare.outputs.BUILD_PLATFORM_MATRIX) }}
target: [RealmSwift, Realm]
xcode-version: ${{ fromJSON(needs.prepare.outputs.XCODE_VERSIONS_MATRIX) }}
configuration: [release, static]
exclude:
Expand All @@ -107,8 +107,6 @@ jobs:
configuration: static
- platform: visionossimulator
configuration: static
- target: RealmSwift
configuration: static
- platform: visionos
xcode-version: 14.2
- platform: visionossimulator
Expand Down Expand Up @@ -136,21 +134,21 @@ jobs:
timeout_minutes: 10
max_attempts: 3
command: |
workflow_id=$(ruby ./scripts/xcode_cloud_helper.rb create-workflow release-package-build ${{ matrix.platform }} ${{ matrix.xcode-version }} ${{ matrix.target }} ${{ matrix.configuration }} -t ${{ steps.token.outputs.TOKEN }})
workflow_id=$(ruby ./scripts/xcode_cloud_helper.rb create-workflow release-package-build ${{ matrix.platform }} ${{ matrix.xcode-version }} RealmSwift ${{ matrix.configuration }} -t ${{ steps.token.outputs.TOKEN }})
echo "WORKFLOW_ID=$workflow_id" >> $GITHUB_OUTPUT
- name: Runs the XCode Cloud workflow created by the previous step
id: build-run
uses: nick-fields/retry@v2
with:
timeout_minutes: 10
timeout_minutes: 15
max_attempts: 3
command: |
build_run_id=$(ruby ./scripts/xcode_cloud_helper.rb build-workflow ${{ steps.create-workflow.outputs.WORKFLOW_ID }} ${{ github.ref_name }} -t ${{ steps.token.outputs.TOKEN }})
echo "BUILD_RUN_ID=$build_run_id" >> $GITHUB_OUTPUT
- name: Check build status and wait for it to finish
uses: nick-fields/retry@v2
with:
timeout_minutes: 10
timeout_minutes: 15
max_attempts: 3
command: |
while [ "$status" != 'COMPLETE' ]
Expand All @@ -176,76 +174,12 @@ jobs:
command: |
token=$(ruby ./scripts/xcode_cloud_helper.rb --issuer-id ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }} --key-id ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }} --pk "${{ secrets.APPLE_STORE_CONNECT_API_KEY }}" get-token)
ruby ./scripts/xcode_cloud_helper.rb download-artifact ${{ steps.build-run.outputs.BUILD_RUN_ID }} -t $token
- name: Prepare product folder
uses: nick-fields/retry@v2
with:
timeout_minutes: 10
max_attempts: 3
command: |
sh -x build.sh release-package-product
- name: Upload framework
uses: actions/upload-artifact@v4
with:
name: product-${{ matrix.platform }}-${{ matrix.xcode-version }}-${{ matrix.target }}-${{ matrix.configuration }}
path: product-package
# build-product: # Creates framework for each platform, xcode version, target and configuration
# runs-on: macos-13
# name: Package framework
# needs: prepare
# strategy:
# matrix:
# platform: ${{ fromJSON(needs.prepare.outputs.BUILD_PLATFORM_MATRIX) }}
# target: [RealmSwift, Realm]
# xcode-version: ${{ fromJSON(needs.prepare.outputs.XCODE_VERSIONS_MATRIX) }}
# configuration: [release, static]
# exclude:
# - platform: osx
# configuration: static
# - platform: tvos
# configuration: static
# - platform: watchos
# configuration: static
# - platform: visionos
# configuration: static
# - platform: catalyst
# configuration: static
# - platform: tvossimulator
# configuration: static
# - platform: watchossimulator
# configuration: static
# - platform: visionossimulator
# configuration: static
# - target: RealmSwift
# configuration: static
# - platform: visionos
# xcode-version: 14.2
# - platform: visionossimulator
# xcode-version: 14.2
# - platform: visionos
# xcode-version: 14.3.1
# - platform: visionossimulator
# xcode-version: 14.3.1
# - platform: visionos
# xcode-version: 15.1
# - platform: visionossimulator
# xcode-version: 15.1
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Select Xcode Version
# run: sudo xcode-select -switch /Applications/Xcode_${{ matrix.xcode-version }}.app
# - name: Download visionOS, only for 15.2
# if: ${{ matrix.platform == 'visionos' || matrix.platform == 'visionossimulator' }}
# run: xcodebuild -downloadPlatform visionOS
# - name: Create framework
# run: sh -x build.sh release-package-build_${{ matrix.platform }}-${{ matrix.target }}-${{ matrix.configuration }}
# - name: Prepare product folder
# run: sh -x build.sh release-package-product
# - name: Upload build product
# uses: actions/upload-artifact@v4
# with:
# name: product-${{ matrix.platform }}-${{ matrix.xcode-version }}-${{ matrix.target }}-${{ matrix.configuration }}
# path: product-package
name: build-${{ matrix.platform }}-${{ matrix.xcode-version }}-${{ matrix.configuration }}
path: xcode-cloud-build-${{ steps.build-run.outputs.BUILD_RUN_ID }}.zip
compression-level: 0
package-xcframework-platform: # Creates xcframework for each platform and xcode version
runs-on: macos-13
name: Package xcframework for platform
Expand All @@ -254,7 +188,7 @@ jobs:
matrix:
platform: ${{ fromJSON(needs.prepare.outputs.PLATFORM_MATRIX) }}
xcode-version: ${{ fromJSON(needs.prepare.outputs.XCODE_VERSIONS_MATRIX) }}
exclude:
exclude:
- platform: visionos
xcode-version: 14.2
- platform: visionos
Expand All @@ -269,10 +203,10 @@ jobs:
- name: Restore frameworks
uses: actions/download-artifact@v4
with:
pattern: product-${{ matrix.platform }}*-${{ matrix.xcode-version }}-*
pattern: build-${{ matrix.platform }}*-${{ matrix.xcode-version }}-*
- name: Create xcframework
run: sh -x build.sh release-create-xcframework_${{ matrix.xcode-version }} ${{ matrix.platform }}
- name: Upload xcframework
run: sh -x build.sh release-create-xcframework-${{ matrix.xcode-version }} ${{ matrix.platform }}
- name: Upload xcframework
uses: actions/upload-artifact@v4
with:
name: realm-${{ matrix.platform }}-${{ matrix.xcode-version }}
Expand Down Expand Up @@ -301,7 +235,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: realm-swift-${{ needs.prepare.outputs.VERSION }}
path: pkg/realm-swift-${{ needs.prepare.outputs.VERSION }}.zip
path: pkg/realm-swift-${{ needs.prepare.outputs.VERSION }}.zip
test-package-examples:
runs-on: macos-13
name: Test examples
Expand Down Expand Up @@ -380,7 +314,7 @@ jobs:
mkdir -p build
unzip realm-${{ matrix.platform }}-${{ env.TEST_VERSION }}.zip -d build
- name: Run installation test
run: |
run: |
echo "REALM_TEST_BRANCH=${{ github.ref_name }}" >> $GITHUB_OUTPUT
cd examples/installation
./build.rb ${{ matrix.platform }} ${{ matrix.installation }} ${{ matrix.linkage }}
Expand Down Expand Up @@ -413,4 +347,4 @@ jobs:
echo "REALM_TEST_BRANCH=${{ github.ref_name }}" >> $GITHUB_OUTPUT
cd examples/installation
./build.rb osx xcframework dynamic
Loading

0 comments on commit 55466ae

Please sign in to comment.