From 97f288c4d00e6c8f0fb28e1a595bdc5c08ecdaec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Tue, 11 Jun 2024 11:24:03 +0200 Subject: [PATCH] Use mac arm runners on GHA (#1758) --- .github/workflows/pr.yml | 103 +++++++++++++++++++++++++++------------ 1 file changed, 73 insertions(+), 30 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 4a67c1f0a4..cf1ec975d8 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -229,7 +229,7 @@ jobs: retention-days: 1 build-jvm-macos-native-lib: - runs-on: macos-12 + runs-on: macos-14 needs: [check-cache, build-jni-swig-stub] if: | always() && @@ -317,6 +317,8 @@ jobs: build-kotlin-metadata-package: runs-on: ubuntu-latest needs: [check-cache] + env: + NDK_VERSION: 23.2.8568313 if: | always() && !cancelled() && @@ -395,8 +397,10 @@ jobs: # This task is also responsible for creating the Gradle and Compiler Plugin as well as # all Kotlin Multiplatform Metadata build-jvm-packages: - runs-on: macos-12 + runs-on: macos-14 needs: [check-cache, build-jvm-linux-native-lib, build-jvm-windows-native-lib, build-jvm-macos-native-lib] + env: + NDK_VERSION: 23.2.8568313 if: | always() && !cancelled() && @@ -410,11 +414,11 @@ jobs: with: submodules: "recursive" - - name: Setup Java 11 + - name: Setup Java 17 uses: actions/setup-java@v3 with: distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }} - java-version: ${{ vars.VERSION_JAVA }} + java-version: '17' - name: Setup Gradle and task/dependency caching uses: gradle/gradle-build-action@v2 @@ -437,6 +441,9 @@ jobs: key: 'jvm-package' max-size: '2.0G' + - name: Install SWIG + run: brew install swig + - name: Prepend ccache executables to the PATH run: echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH @@ -448,11 +455,11 @@ jobs: echo '#!/bin/bash\nccache clang "$@"%"' > /usr/local/bin/ccache-clang echo '#!/bin/bash\nccache clang++ "$@"%"' > /usr/local/bin/ccache-clang++ - # TODO This matches 23.2.8568313, but what happens if we a define specific ndk version in our build? - - name: Setup NDK - uses: nttld/setup-ndk@v1 - with: - ndk-version: r23c + - name: Setup Android SDK + uses: android-actions/setup-android@v2 + + - name: Install NDK + run: sdkmanager --install "ndk;${{ env.NDK_VERSION }}" # We cannot use artifacts as they cannot be shared between workflows, so use cache instead. - name: Setup build cache @@ -494,6 +501,8 @@ jobs: build-android-packages: runs-on: ubuntu-latest needs: check-cache + env: + NDK_VERSION: 23.2.8568313 outputs: baas-container-id: ${{ steps.baas_cli_start.outputs.baas_container_id }} if: | @@ -571,11 +580,11 @@ jobs: echo '#!/bin/bash\nccache clang "$@"%"' > /usr/local/bin/ccache-clang echo '#!/bin/bash\nccache clang++ "$@"%"' > /usr/local/bin/ccache-clang++ - # TODO This matches 23.2.8568313, but what happens if we a define specific ndk version in our build? - - name: Setup NDK - uses: nttld/setup-ndk@v1 - with: - ndk-version: r23c + - name: Setup Android SDK + uses: android-actions/setup-android@v2 + + - name: Install NDK + run: sdkmanager --install "ndk;${{ env.NDK_VERSION }}" - name: Build Android Base Test Apk working-directory: packages @@ -638,7 +647,7 @@ jobs: # TODO: ccache is not being used by this build for some reason build-macos-x64-packages: - runs-on: macos-12 + runs-on: macos-14 # x64 builds fine on an arm64 node needs: check-cache if: always() && !cancelled() && needs.check-cache.outputs.packages-macos-x64-cache-hit != 'true' @@ -675,6 +684,9 @@ jobs: key: 'macos-x64-package' max-size: '2.0G' + - name: Install SWIG + run: brew install swig + - name: Prepend ccache executables to the PATH run: echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH @@ -706,7 +718,7 @@ jobs: retention-days: 1 build-macos-arm64-packages: - runs-on: macos-12 + runs-on: macos-14 needs: check-cache # needs: static-analysis if: always() && !cancelled() && needs.check-cache.outputs.packages-macos-arm64-cache-hit != 'true' @@ -744,6 +756,9 @@ jobs: key: 'macos-arm64-package' max-size: '2.0G' + - name: Install SWIG + run: brew install swig + - name: Prepend ccache executables to the PATH run: echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH @@ -774,7 +789,7 @@ jobs: retention-days: 1 build-ios-x64-packages: - runs-on: macos-12 + runs-on: macos-14 # x64 builds fine on an arm64 node needs: check-cache # needs: static-analysis if: always() && !cancelled() && needs.check-cache.outputs.packages-ios-x64-cache-hit != 'true' @@ -812,6 +827,9 @@ jobs: key: 'ios-x64-package' max-size: '2.0G' + - name: Install SWIG + run: brew install swig + - name: Prepend ccache executables to the PATH run: echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH @@ -843,7 +861,7 @@ jobs: retention-days: 1 build-ios-arm64-packages: - runs-on: macos-12 + runs-on: macos-14 needs: check-cache # needs: static-analysis if: always() && !cancelled() && needs.check-cache.outputs.packages-ios-arm64-cache-hit != 'true' @@ -881,6 +899,9 @@ jobs: key: 'ios-arm64-package' max-size: '2.0G' + - name: Install SWIG + run: brew install swig + - name: Prepend ccache executables to the PATH run: echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH @@ -931,7 +952,7 @@ jobs: - type: sync test-title: Unit Test Results - Android Sync (Emulator) - runs-on: macos-12 + runs-on: macos-12 # android emulator does not run on arm64 - https://github.com/ReactiveCircus/android-emulator-runner/issues/350 needs: [check-cache, build-android-packages, build-jvm-packages, build-kotlin-metadata-package] if: | always() && @@ -1175,7 +1196,7 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-12] # , macos-arm] + os: [macos-12, macos-14] type: [base, sync] include: - os: macos-12 @@ -1188,14 +1209,21 @@ jobs: os-id: macos package-prefix: macos-x64 test-title: Unit Test Results - MacOS x64 Sync - # - os: macos-arm - # package-prefix: macos-arm64 - # test-title: Results - MacOS arm64 Base + - os: macos-14 + type: base + os-id: macos + package-prefix: macos-arm64 + test-title: Unit Test Results - MacOS arm64 Base + - os: macos-14 + type: sync + os-id: macos + package-prefix: macos-arm64 + test-title: Unit Test Results - MacOS arm64 Sync runs-on: ${{ matrix.os }} # TODO Unclear why MacOS needs the metadata package when the Android Tests do not # Disable macos-arm for now as the host needs to have the Android SDK installed even though it isn't really using it. - needs: [check-cache, build-macos-x64-packages, build-kotlin-metadata-package] #, build-macos-arm64-packages] + needs: [check-cache, build-kotlin-metadata-package, build-macos-x64-packages, build-macos-arm64-packages] if: | always() && !cancelled() && @@ -1297,7 +1325,7 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-12] # , macos-arm] + os: [macos-12, macos-14] type: [base, sync] include: - os: macos-12 @@ -1310,14 +1338,21 @@ jobs: package-prefix: x64 test-title: Unit Test Results - iOS x64 Sync test-task: iosTest - # - os: macos-arm - # package-prefix: macos-arm64 - # test-title: Results - MacOS arm64 Base + - os: macos-14 + type: base + package-prefix: arm64 + test-title: Unit Test Results - iOS arm64 Base + test-task: iosTest + - os: macos-14 + type: sync + package-prefix: arm64 + test-title: Unit Test Results - iOS arm64 Sync + test-task: iosTest runs-on: ${{ matrix.os }} # TODO Unclear why MacOS needs the metadata package when the Android Tests do not # Disable macos-arm for now as the host needs to have the Android SDK installed even though it isn't really using it. - needs: [check-cache, build-ios-x64-packages, build-kotlin-metadata-package] # , build-ios-arm64-packages] + needs: [check-cache, build-kotlin-metadata-package, build-ios-x64-packages, build-ios-arm64-packages] if: | always() && !cancelled() && @@ -1419,13 +1454,17 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-12, ubuntu-latest, windows-latest] # TODO Should we also test om MacOS arm64? + os: [macos-12, macos-14, ubuntu-latest, windows-latest] type: [base, sync] include: - os: macos-12 os-id: mac type: base test-title: Unit Test Results - Base JVM MacOS x64 + - os: macos-14 + os-id: mac + type: base + test-title: Unit Test Results - Base JVM MacOS arm64 - os: ubuntu-latest os-id: ubu type: base @@ -1438,6 +1477,10 @@ jobs: os-id: mac type: sync test-title: Unit Test Results - Sync JVM MacOS x64 + - os: macos-14 + os-id: mac + type: sync + test-title: Unit Test Results - Sync JVM MacOS arm64 - os: ubuntu-latest os-id: ubu type: sync