From bd384a4f2f54b65b552188091ea8c4c107e4c1a7 Mon Sep 17 00:00:00 2001 From: Jonathan Lennox Date: Wed, 5 Jun 2024 14:36:44 -0400 Subject: [PATCH 1/5] Fix macOS GitHub actions when workers are arm64 (as they now are). --- .github/workflows/maven.yml | 6 ++---- resources/mac-cmake.sh | 9 +++++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 91f3083..ca3c973 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -119,13 +119,11 @@ jobs: - name: Install OpenSSL ${{ matrix.libssl }} if: matrix.arch == 'x86_64' - run: brew install openssl@${{ matrix.libssl }} + run: /usr/local/bin/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 + run: /opt/homebrew/bin/brew install openssl@${{ matrix.libssl }} - name: Build natives with CMake run: resources/mac-cmake.sh "${{ steps.install_java.outputs.path }}" "${{ matrix.arch }}" "${{ matrix.libssl }}" diff --git a/resources/mac-cmake.sh b/resources/mac-cmake.sh index 1aa8fb4..bb68fc0 100755 --- a/resources/mac-cmake.sh +++ b/resources/mac-cmake.sh @@ -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 From 686a7fc5625b2c712d3d7b886dccdcef703223fc Mon Sep 17 00:00:00 2001 From: Jonathan Lennox Date: Wed, 5 Jun 2024 14:52:09 -0400 Subject: [PATCH 2/5] Build each Mac lib natively on its appropriate arch. --- .github/workflows/maven.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index ca3c973..636d092 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -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 @@ -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.runner }} steps: - name: Checkout @@ -118,12 +118,7 @@ jobs: architecture: ${{ matrix.arch }} - name: Install OpenSSL ${{ matrix.libssl }} - if: matrix.arch == 'x86_64' - run: /usr/local/bin/brew install openssl@${{ matrix.libssl }} - - - name: Install OpenSSL ${{ matrix.libssl }} - if: matrix.arch == 'arm64' - run: /opt/homebrew/bin/brew install openssl@${{ matrix.libssl }} + run: brew install openssl@${{ matrix.libssl }} - name: Build natives with CMake run: resources/mac-cmake.sh "${{ steps.install_java.outputs.path }}" "${{ matrix.arch }}" "${{ matrix.libssl }}" From 1562d29f0c54e89eafd41e977d224655ad7d002e Mon Sep 17 00:00:00 2001 From: Jonathan Lennox Date: Wed, 5 Jun 2024 15:08:02 -0400 Subject: [PATCH 3/5] Fix github action syntax. --- .github/workflows/maven.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 636d092..db464df 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -97,7 +97,7 @@ jobs: arch: - { arch: x86_64, runner: macos-latest-large } - { arch: arm64, runner: macos-latest-xlarge } - runs-on: ${{ matrix.runner }} + runs-on: ${{ matrix.arch.runner }} steps: - name: Checkout @@ -115,13 +115,13 @@ jobs: with: distribution: zulu java-version: ${{ env.RELEASE_JAVA_VERSION }} - architecture: ${{ matrix.arch }} + architecture: ${{ matrix.arch.arch }} - name: Install OpenSSL ${{ matrix.libssl }} run: brew install openssl@${{ matrix.libssl }} - 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 From 78f49056e4ee03453750ceb79b367705017cf526 Mon Sep 17 00:00:00 2001 From: Jonathan Lennox Date: Wed, 5 Jun 2024 15:10:50 -0400 Subject: [PATCH 4/5] Use names of free runners. --- .github/workflows/maven.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index db464df..f7b78b6 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -95,8 +95,8 @@ jobs: - "1.1" - "3" arch: - - { arch: x86_64, runner: macos-latest-large } - - { arch: arm64, runner: macos-latest-xlarge } + - { arch: x86_64, runner: macos-13 } + - { arch: arm64, runner: macos-14 } runs-on: ${{ matrix.arch.runner }} steps: From c7527aa633cd4b9efe6943b096648815c6fa7117 Mon Sep 17 00:00:00 2001 From: Jonathan Lennox Date: Wed, 5 Jun 2024 15:16:42 -0400 Subject: [PATCH 5/5] Fix variable substitution in name of task. --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index f7b78b6..1ce920b 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -87,7 +87,7 @@ jobs: mac_natives: needs: test - name: Mac Natives (${{ matrix.arch }}, OpenSSL ${{ matrix.libssl }}) + name: Mac Natives (${{ matrix.arch.arch }}, OpenSSL ${{ matrix.libssl }}) strategy: fail-fast: false matrix: