Skip to content

Commit

Permalink
Merge pull request #498 from posit-dev/bugfix/release
Browse files Browse the repository at this point in the history
Fix broken macOS release builds
  • Loading branch information
lionel- authored Aug 30, 2024
2 parents 5331e46 + 836b293 commit 1d43ee3
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 43 deletions.
83 changes: 72 additions & 11 deletions .github/workflows/release-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ on:
workflow_call:
inputs:
version:
required: false
required: true
description: "The Ark version"
default: ${{ github.sha }}
type: string
workflow_dispatch:
inputs:
version:
required: false
description: "The Ark version"
default: dev
type: string

jobs:
# Build ARK for macOS. Both arm64 (Apple Silicon) and x64 (Intel) hosts.
Expand All @@ -23,7 +28,7 @@ jobs:
strategy:
matrix:
arch: [arm64, x64]
flavor: [debug, release]
flavor: [release, debug]
include:
- arch: arm64
arch_terminal: arm64
Expand Down Expand Up @@ -53,12 +58,6 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v4

- name: Install zeromq dependencies
id: install_zeromq_dependencies
run: |
arch -${{matrix.arch_terminal}} /bin/bash -c "${{matrix.homebrew_folder}}/bin/brew install pkg-config"
arch -${{matrix.arch_terminal}} /bin/bash -c "${{matrix.homebrew_folder}}/bin/brew install libsodium"
# Zeromq calls whatever pkg-config version is findable on the PATH to be able to locate
# libsodium, so we have to ensure the x86_64 version is first on the PATH when compiling for
# that architecture, so that it finds the x86_64 version of libsodium for zeromq to link against.
Expand Down Expand Up @@ -87,7 +86,7 @@ jobs:
pushd target/${{ matrix.rust_target_prefix }}-apple-darwin/${{ matrix.flavor }}
# Compress the kernel to an archive
ARCHIVE="$GITHUB_WORKSPACE/ark-${{ needs.get_version.outputs.ARK_VERSION }}-${{ matrix.flavor }}-darwin-${{ matrix.arch }}.zip"
ARCHIVE="$GITHUB_WORKSPACE/ark-${{ inputs.version }}-${{ matrix.flavor }}-darwin-${{ matrix.arch }}.zip"
zip -Xry $ARCHIVE ark
popd
Expand All @@ -97,4 +96,66 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: ark-${{ matrix.flavor }}-darwin-${{ matrix.arch }}-archive
path: ark-${{ needs.get_version.outputs.ARK_VERSION }}-${{ matrix.flavor }}-darwin-${{ matrix.arch }}.zip
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: [release, debug]

steps:
- name: Checkout sources to get copies of LICENSE and NOTICE
uses: actions/checkout@v4
with:
sparse-checkout: |
LICENSE
crates/ark/NOTICE
- 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

# 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
4 changes: 2 additions & 2 deletions .github/workflows/release-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ jobs:
# Compress the kernel to an archive
$params = @{
Path = "target\${{ matrix.rust_target_prefix }}-pc-windows-msvc\${{ matrix.flavor }}\ark.exe", "LICENSE", "crates\ark\NOTICE"
DestinationPath = "ark-${{ needs.get_version.outputs.ARK_VERSION }}-${{ matrix.flavor }}-windows-${{ matrix.arch }}.zip"
DestinationPath = "ark-${{ inputs.version }}-${{ matrix.flavor }}-windows-${{ matrix.arch }}.zip"
}
Compress-Archive @params
- name: Upload client archive
uses: actions/upload-artifact@v4
with:
name: ark-${{ matrix.flavor }}-windows-${{ matrix.arch }}-archive
path: ark-${{ needs.get_version.outputs.ARK_VERSION }}-${{ matrix.flavor }}-windows-${{ matrix.arch }}.zip
path: ark-${{ inputs.version }}-${{ matrix.flavor }}-windows-${{ matrix.arch }}.zip
32 changes: 2 additions & 30 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 1d43ee3

Please sign in to comment.