Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: run macOS GitHub actions on appropriate worker arches. #55

Merged
merged 5 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ jobs:

mac_natives:
needs: test
runs-on: macos-latest
name: Mac Natives (${{ matrix.arch }}, OpenSSL ${{ matrix.libssl }})
strategy:
fail-fast: false
Expand All @@ -96,8 +95,9 @@ jobs:
- "1.1"
- "3"
arch:
- x86_64
- arm64
- { arch: x86_64, runner: macos-latest-large }
- { arch: arm64, runner: macos-latest-xlarge }
runs-on: ${{ matrix.arch.runner }}

steps:
- name: Checkout
Expand All @@ -115,20 +115,13 @@ jobs:
with:
distribution: zulu
java-version: ${{ env.RELEASE_JAVA_VERSION }}
architecture: ${{ matrix.arch }}
architecture: ${{ matrix.arch.arch }}

- name: Install OpenSSL ${{ matrix.libssl }}
if: matrix.arch == 'x86_64'
run: brew install openssl@${{ matrix.libssl }}

- name: Install OpenSSL ${{ matrix.libssl }}
if: matrix.arch == 'arm64'
run: |
brew uninstall --ignore-dependencies openssl@${{ matrix.libssl }} || true
brew fetch --force --bottle-tag=arm64_monterey openssl@${{ matrix.libssl }} | grep "Downloaded to:" | awk '{ print $3 }' | xargs -n 1 brew install

- name: Build natives with CMake
run: resources/mac-cmake.sh "${{ steps.install_java.outputs.path }}" "${{ matrix.arch }}" "${{ matrix.libssl }}"
run: resources/mac-cmake.sh "${{ steps.install_java.outputs.path }}" "${{ matrix.arch.arch }}" "${{ matrix.libssl }}"

- name: Upload lib as artifact
uses: actions/upload-artifact@v3
Expand Down
9 changes: 7 additions & 2 deletions resources/mac-cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,22 @@ case $ARCH in
"x86-64"|"x86_64")
INSTALL_PREFIX_ARCH=x86-64
OSX_ARCH=x86_64
HOMEBREW_ROOT=/usr/local
;;
"arm64"|"aarch64")
INSTALL_PREFIX_ARCH=aarch64
OSX_ARCH=arm64
HOMEBREW_ROOT=/opt/homebrew
;;
esac

# For reasons that are not clear, this needs to be an environment
# variable rather than a cmake command-line define
export OPENSSL_ROOT_DIR="$HOMEBREW_ROOT/opt/openssl@$OPENSSL_VERSION"

cmake -B cmake-build \
-DJITSI_SRTP_LIBSSL_VERSION="$OPENSSL_VERSION" \
-DJAVA_HOME="$JAVA_HOME" \
-DCMAKE_INSTALL_PREFIX="src/main/resources/darwin-$INSTALL_PREFIX_ARCH" \
-DCMAKE_OSX_ARCHITECTURES="$OSX_ARCH" \
-DOPENSSL_ROOT_DIR="/usr/local/opt/openssl@$OPENSSL_VERSION"
-DCMAKE_OSX_ARCHITECTURES="$OSX_ARCH"
cmake --build cmake-build --config Release --target install
Loading