Skip to content

Commit

Permalink
Fix: run macOS GitHub actions on appropriate worker arches. (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanLennox authored Jun 5, 2024
1 parent 7fbe7e3 commit 06ec3e1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
19 changes: 6 additions & 13 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,17 @@ jobs:

mac_natives:
needs: test
runs-on: macos-latest
name: Mac Natives (${{ matrix.arch }}, OpenSSL ${{ matrix.libssl }})
name: Mac Natives (${{ matrix.arch.arch }}, OpenSSL ${{ matrix.libssl }})
strategy:
fail-fast: false
matrix:
libssl:
- "1.1"
- "3"
arch:
- x86_64
- arm64
- { arch: x86_64, runner: macos-13 }
- { arch: arm64, runner: macos-14 }
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

0 comments on commit 06ec3e1

Please sign in to comment.