Skip to content

Commit

Permalink
Use mac arm runners on GHA (#1758)
Browse files Browse the repository at this point in the history
  • Loading branch information
rorbech authored Jun 11, 2024
1 parent 9d0267a commit 97f288c
Showing 1 changed file with 73 additions and 30 deletions.
103 changes: 73 additions & 30 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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() &&
Expand Down Expand Up @@ -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() &&
Expand Down Expand Up @@ -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() &&
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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'

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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() &&
Expand Down Expand Up @@ -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
Expand All @@ -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() &&
Expand Down Expand Up @@ -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
Expand All @@ -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() &&
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 97f288c

Please sign in to comment.