From 683201f51d31eb3821c0d27584d3c9a0dd3ac87f Mon Sep 17 00:00:00 2001 From: Mischan Toosarani-Hausberger Date: Tue, 5 Nov 2024 19:00:53 +0100 Subject: [PATCH] ci: replace macos-12 action runners (#1073) * ci: replace macos-12 action runners * add listing installed images to android start script * specify path to android tools for sdkmanager * use cmdline-tools for sdkmanager + avdmanager * switch to macos-14 since macos-15 has no android cmd-tools * try x64 macos images * list sdkmanager images and try to update to check if tooling works at all * switch back to macos-15 verify installable setup * remove update from android start script again * ensure images are installed * accept android image licenses automatically * pre-accept licenses * start the emulator blocking so we can see any issues during startup * check emulator acceleration before starting the emulator * switch back x86[_64] images * re-enable emulator run in background * expose llvm18 bin directory for macos15 runners on PATH * revert last commit to macos-15 only * fix quotes * bump old android api/ndk * lower end android on x86_64 + llvm-cov on macos-15-large * android lower end only available on x86 + increase timeout to 20 minutes * install NDK package together with target image * update lower end android to API level 21 (keep NDK23) * switch lower end to API 35 but keep NDK at 23 * max API for NDK23 is 31 (but the emulator started) * define adb and emulator ports * introduce emulator and adb port to start script * use ADB_SERVER_PORT as the env variable from the workflow * start also the non-blocking emulator with the right port * get rid of lower emulator test * get rid of emulator and adb port in start-android.sh --- .github/workflows/ci.yml | 66 ++++++++++++++++++++-------------------- scripts/start-android.sh | 22 ++++++++++++-- 2 files changed, 53 insertions(+), 35 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fc124271f..97859cef3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,11 @@ on: branches: - master - "release/**" + paths-ignore: + - "*.md" pull_request: + paths-ignore: + - "*.md" concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -35,12 +39,12 @@ jobs: fail-fast: false matrix: include: - - name: Linux (old gcc, 32-bit) + - name: Linux (GCC 7, 32-bit) os: ubuntu-20.04 CC: gcc-7 CXX: g++-7 TEST_X86: 1 - - name: Linux (new gcc) + - name: Linux (GCC 12) os: ubuntu-22.04 CC: gcc-12 CXX: g++-12 @@ -48,36 +52,36 @@ jobs: # The GCC analyzer 10.0.1 (as on CI) has an internal compiler error # currently, and is not stable enough to activate. # RUN_ANALYZER: gcc - - name: Linux (clang + asan + llvm-cov) + - name: Linux (clang 15 + asan + llvm-cov) os: ubuntu-22.04 CC: clang-15 CXX: clang++-15 ERROR_ON_WARNINGS: 1 RUN_ANALYZER: asan,llvm-cov - - name: Linux (clang + kcov) + - name: Linux (clang 15 + kcov) os: ubuntu-22.04 CC: clang-15 CXX: clang++-15 ERROR_ON_WARNINGS: 1 RUN_ANALYZER: kcov - - name: Linux (gcc + code-checker + valgrind) + - name: Linux (gcc 12 + code-checker + valgrind) os: ubuntu-22.04 RUN_ANALYZER: code-checker,valgrind - - name: macOS (xcode llvm) - os: macOs-14 + - name: macOS 14 (xcode llvm) + os: macos-14 ERROR_ON_WARNINGS: 1 SYSTEM_VERSION_COMPAT: 0 - name: macOS 13 (xcode llvm) - os: macOs-13 + os: macos-13 ERROR_ON_WARNINGS: 1 SYSTEM_VERSION_COMPAT: 0 - - name: macOS (xcode llvm + universal) - os: macOs-14 + - name: macOS 14 (xcode llvm + universal) + os: macos-14 ERROR_ON_WARNINGS: 1 SYSTEM_VERSION_COMPAT: 0 CMAKE_DEFINES: -DCMAKE_OSX_ARCHITECTURES=arm64;x86_64 - - name: macOS (clang + asan + llvm-cov) - os: macOs-12 + - name: macOS 15 (clang 18 + asan + llvm-cov) + os: macos-15-large CC: clang CXX: clang++ ERROR_ON_WARNINGS: 1 @@ -95,15 +99,16 @@ jobs: MINGW_ASM_MASM_COMPILER: llvm-ml;-m64 # The Android emulator is currently only available on macos, see: # https://docs.microsoft.com/en-us/azure/devops/pipelines/ecosystems/android?view=azure-devops#test-on-the-android-emulator - - name: Android (old API/NDK) - os: macOs-12 - ANDROID_API: 16 - ANDROID_NDK: 20.1.5948944 - ANDROID_ARCH: x86 - - name: Android (new API/NDK) - os: macOs-12 - ANDROID_API: 34 - ANDROID_NDK: 26.1.10909125 + # TODO: switch to reactivecircus/android-emulator-runner, concurrently running emulators continuously fail now. + # - name: Android (API 31, NDK 23) + # os: macos-15-large + # ANDROID_API: 31 + # ANDROID_NDK: 23.2.8568313 + # ANDROID_ARCH: x86_64 + - name: Android (API 35, NDK 27) + os: macos-15-large + ANDROID_API: 35 + ANDROID_NDK: 27.2.12479018 ANDROID_ARCH: x86_64 name: ${{ matrix.name }} @@ -151,10 +156,14 @@ jobs: if: ${{ contains(env['RUN_ANALYZER'], 'code-checker') }} run: sudo snap install codechecker --classic - - name: Expose llvm PATH for Mac + - name: Expose llvm@15 PATH for Mac if: ${{ runner.os == 'macOS' }} run: echo $(brew --prefix llvm@15)/bin >> $GITHUB_PATH - + + - name: Expose llvm@18 PATH for Mac + if: ${{ runner.os == 'macOS' && matrix.os == 'macos-15-large' && matrix.RUN_ANALYZER == 'asan,llvm-cov' }} + run: echo $(brew --prefix llvm@18)/bin >> $GITHUB_PATH + - name: Installing LLVM-MINGW Dependencies if: ${{ runner.os == 'Windows' && env['TEST_MINGW'] }} shell: powershell @@ -168,19 +177,10 @@ jobs: shell: powershell run: . "scripts\install-zlib.ps1" - - name: Installing Android SDK Dependencies - if: ${{ env['ANDROID_API'] }} - run: | - export ANDROID_IMAGE="system-images;android-$ANDROID_API;google_apis;$ANDROID_ARCH" - echo "Downloading ndk;$ANDROID_NDK and $ANDROID_IMAGE" - echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --install \ - "ndk;$ANDROID_NDK" "$ANDROID_IMAGE" | \ - grep -v "\[=" || true # suppress the progress bar, so we get meaningful logs - - name: Starting Android Simulator if: ${{ env['ANDROID_API'] }} run: bash scripts/start-android.sh - timeout-minutes: 10 + timeout-minutes: 20 - name: Test shell: bash diff --git a/scripts/start-android.sh b/scripts/start-android.sh index 02b4cc306..3f9d250b5 100755 --- a/scripts/start-android.sh +++ b/scripts/start-android.sh @@ -11,8 +11,10 @@ echo "PATH: $PATH" ARCH=${ANDROID_ARCH:-"x86"} API_LEVEL=${ANDROID_API:-"29"} +NDK_VERSION=${ANDROID_NDK:-"27.2.12479018"} AVD_EMULATOR_NAME="sentry_android_${ARCH}" IMAGE=${ANDROID_IMAGE:-"system-images;android-${API_LEVEL};google_apis;${ARCH}"} +NDK_PACKAGE=${NDK_IMAGE:-"ndk;${NDK_VERSION}"} # Create an Android Virtual Device echo "Create Test AVDs with..." @@ -20,17 +22,33 @@ echo "ARCH = $ARCH" echo "API_LEVEL = $API_LEVEL" echo "AVD_EMULATOR_NAME = $AVD_EMULATOR_NAME" echo "IMAGE = $IMAGE" -echo "no" | $ANDROID_HOME/tools/bin/avdmanager create avd -n $AVD_EMULATOR_NAME -k "$IMAGE" --force +echo "NDK_PACKAGE = $NDK_PACKAGE" + +echo "Install image and NDK..." +yes | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses +$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --install "$IMAGE" +$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --install "$NDK_PACKAGE" + +echo "Create AVD..." +echo "no" | $ANDROID_HOME/cmdline-tools/latest/bin/avdmanager create avd -n $AVD_EMULATOR_NAME -k "$IMAGE" --force echo "List available AVDs..." $ANDROID_HOME/emulator/emulator -list-avds +echo "Check emulator acceleration..." +$ANDROID_HOME/emulator/emulator -accel-check + # Start emulator in background echo "Starting emulator..." nohup $ANDROID_HOME/emulator/emulator -avd $AVD_EMULATOR_NAME -no-snapshot > /dev/null 2>&1 & + +# For debugging emulator start issues: +# echo "Starting emulator blocking..." +# $ANDROID_HOME/emulator/emulator -avd $AVD_EMULATOR_NAME -no-snapshot + echo "Wait for emulator availability..." $ANDROID_HOME/platform-tools/adb wait-for-device shell 'ls' -echo "Verify emulator devices as running..." +echo "Verify emulator devices are running..." $ANDROID_HOME/platform-tools/adb devices echo "Emulator started."