From f28ad233eea645c62e771ccb64b387ff7296a2c4 Mon Sep 17 00:00:00 2001 From: Lionel Henry Date: Fri, 30 Aug 2024 13:43:11 +0200 Subject: [PATCH] Create universal binary as part of the macos subjobs And fix issues --- .github/workflows/release-macos.yml | 56 +++++++++++++++++++++++++++++ .github/workflows/release.yml | 32 ++--------------- 2 files changed, 58 insertions(+), 30 deletions(-) diff --git a/.github/workflows/release-macos.yml b/.github/workflows/release-macos.yml index 23c442eae..fce73eda4 100644 --- a/.github/workflows/release-macos.yml +++ b/.github/workflows/release-macos.yml @@ -92,3 +92,59 @@ jobs: with: name: ark-${{ matrix.flavor }}-darwin-${{ matrix.arch }}-archive path: ark-${{ inputs.version }}-${{ matrix.flavor }}-darwin-${{ matrix.arch }}.zip + + + build_universal: + name: Build macOS universal binary + runs-on: macos-latest + timeout-minutes: 40 + needs: build_macos + + env: + DEBUG_FLAG: ${{ matrix.flavor == 'debug' && '-debug' || '' }} + + strategy: + matrix: + flavor: [debug, release] + + steps: + - name: Download macOS arm64 kernel (${{ matrix.flavor }}) + uses: actions/download-artifact@v4 + with: + name: ark-${{ matrix.flavor }}-darwin-arm64-archive + + - name: Download macOS x64 kernel (${{ matrix.flavor}}) + uses: actions/download-artifact@v4 + with: + name: ark-${{ matrix.flavor }}-darwin-x64-archive + + - name: Checkout sources to get copies of LICENSE and NOTICE + uses: actions/checkout@v4 + + # Combine macOS binaries to a single binary with lipo + - name: Create macOS universal binary + run: | + # Decompress x64 builds + rm -rf x64 && mkdir x64 && pushd x64 + unzip ../ark-${{ inputs.version }}-${{ matrix.flavor }}-darwin-x64.zip + popd + + # Decompress arm64 build + rm -rf arm64 && mkdir arm64 && pushd arm64 + unzip ../ark-${{ inputs.version }}-${{ matrix.flavor }}-darwin-arm64.zip + popd + + # Create a universal binary + lipo -create x64/ark arm64/ark -output ark + + # Compress and bundle licenses + ARCHIVE="$GITHUB_WORKSPACE/ark-${{ inputs.version }}${{ env.DEBUG_FLAG }}-darwin-universal.zip" + [ -e LICENSE ] || cp "$GITHUB_WORKSPACE/LICENSE" LICENSE + [ -e NOTICE ] || cp "$GITHUB_WORKSPACE/crates/ark/NOTICE" NOTICE + zip -Xry $ARCHIVE ark LICENSE NOTICE + + - name: Upload client archive + uses: actions/upload-artifact@v4 + with: + name: ark-${{ matrix.flavor }}-darwin-universal-archive + path: ark-${{ inputs.version }}${{ env.DEBUG_FLAG }}-darwin-universal.zip diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1011fe312..04cf57cca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -114,15 +114,10 @@ jobs: steps: # Download all binaries - - name: Download macOS arm64 kernel (${{ matrix.flavor }}) + - name: Download macOS universal kernel (${{ matrix.flavor}}) uses: actions/download-artifact@v4 with: - name: ark-${{ matrix.flavor }}-darwin-arm64-archive - - - name: Download macOS x64 kernel (${{ matrix.flavor}}) - uses: actions/download-artifact@v4 - with: - name: ark-${{ matrix.flavor }}-darwin-x64-archive + name: ark-${{ matrix.flavor }}-darwin-universal-archive - name: Download Windows x64 kernel (${{ matrix.flavor}}) uses: actions/download-artifact@v4 @@ -134,29 +129,6 @@ jobs: with: name: ark-${{ matrix.flavor }}-linux-x64-archive - - # Combine macOS binaries to a single binary with lipo - - name: Create macOS universal binary - run: | - # Decompress x64 builds - rm -rf x64 && mkdir x64 && pushd x64 - unzip ../ark-${{ needs.get_version.outputs.ARK_VERSION }}-${{ matrix.flavor }}-darwin-x64.zip - popd - - # Decompress arm64 build - rm -rf arm64 && mkdir arm64 && pushd arm64 - unzip ../ark-${{ needs.get_version.outputs.ARK_VERSION }}-${{ matrix.flavor }}-darwin-arm64.zip - popd - - # Create a universal binary - lipo -create x64/ark arm64/ark -output ark - - # Compress and bundle licenses - ARCHIVE="$GITHUB_WORKSPACE/ark-${{ needs.get_version.outputs.ARK_VERSION }}${{ env.DEBUG_FLAG }}-darwin-universal.zip" - [ -e LICENSE ] || cp "$GITHUB_WORKSPACE/LICENSE" LICENSE - [ -e NOTICE ] || cp "$GITHUB_WORKSPACE/crates/ark/NOTICE" NOTICE - zip -Xry $ARCHIVE ark LICENSE NOTICE - - name: Upload macOS release artifact (universal) uses: actions/upload-release-asset@v1 env: