diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cbeaa2288..06c078931 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,42 +18,32 @@ jobs: timeout-minutes: 15 strategy: matrix: - os: [ubuntu-latest] - api-level: [23, 29] - target: [default, google_apis] - arch: [x86] - exclude: - - target: google_apis - api-level: 16 - - target: google_apis - api-level: 23 - - target: google_apis - api-level: 29 include: - - os: ubuntu-latest + - os: ubuntu-22.04 + api-level: 23 + target: default + arch: x86 + - os: ubuntu-24.04 api-level: 24 target: playstore arch: x86 - - os: ubuntu-latest - api-level: 30 - target: aosp_atd - arch: x86 - - os: macos-latest + - os: macos-13 api-level: 31 - target: google_apis + target: default arch: x86_64 - - os: ubuntu-latest + - os: ubuntu-24.04 api-level: 34 target: aosp_atd arch: x86_64 + - os: ubuntu-lastest + api-level: 35 + target: google_apis + arch: x86_64 steps: - name: checkout uses: actions/checkout@v4 - - name: validate gradle wrapper - uses: gradle/wrapper-validation-action@v2 - - name: build, test and lint run: | npm install @@ -64,7 +54,7 @@ jobs: - uses: actions/setup-java@v4 with: distribution: 'zulu' - java-version: 21 + java-version: 23 - uses: actions/cache@v4 id: avd-cache @@ -73,9 +63,9 @@ jobs: ~/.android/avd/* ~/.android/adb* ~/.android/debug.keystore - key: avd-${{ matrix.api-level }}-${{ matrix.os }}-${{ matrix.target }} + key: avd-${{ matrix.api-level }}-${{ matrix.os }}-${{ matrix.target }}-${{ matrix.arch }} - - uses: gradle/actions/setup-gradle@v3 + - uses: gradle/actions/setup-gradle@v4 - name: assemble tests working-directory: test-fixture diff --git a/.github/workflows/manually.yml b/.github/workflows/manually.yml index 9b8f9722a..a74e1b3dd 100644 --- a/.github/workflows/manually.yml +++ b/.github/workflows/manually.yml @@ -9,14 +9,14 @@ on: api-level: description: 'API level of the platform and system image' required: true - default: '30' + default: '34' target: description: 'target of the system image - default, google_apis, google_apis_playstore, aosp_atd, google_atd, android-wear, android-wear-cn, android-tv or google-tv' required: true default: 'default' arch: description: 'CPU architecture of the system image - x86, x86_64 or arm64-v8a' - default: 'x86' + default: 'x86_64' emulator-options: description: 'command-line options used when launching the emulator' default: '-no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim' @@ -41,9 +41,6 @@ jobs: - name: checkout uses: actions/checkout@v4 - - name: validate gradle wrapper - uses: gradle/wrapper-validation-action@v2 - - name: build, test and lint run: | npm install @@ -54,11 +51,9 @@ jobs: - uses: actions/setup-java@v4 with: distribution: 'zulu' - java-version: 21 + java-version: 23 - - uses: gradle/actions/setup-gradle@v3 - with: - gradle-home-cache-cleanup: true + - uses: gradle/actions/setup-gradle@v4 - name: enable KVM for linux runners if: runner.os == 'Linux' diff --git a/CHANGELOG.md b/CHANGELOG.md index 15037d6af..eaad8f0e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## v2.33.0 + +* Fix missing AVD directory in `ubuntu-24.04` runner. - [415](https://github.com/ReactiveCircus/android-emulator-runner/pull/415) +* Update SDK build tools to `35.0.0`, update SDK command-line tools to `16.0`. - [#356](https://github.com/ReactiveCircus/android-emulator-runner/pull/356) +* Stop changing owner of the SDK directory. - [406](https://github.com/ReactiveCircus/android-emulator-runner/pull/406) [#409](https://github.com/ReactiveCircus/android-emulator-runner/pull/409) +* Upgrade to latest npm dependencies. - [#401](https://github.com/ReactiveCircus/android-emulator-runner/pull/401) + ## v2.32.0 * Add `port` parameter for customizing the emulator port to use. - [#383](https://github.com/ReactiveCircus/android-emulator-runner/pull/383) diff --git a/README.md b/README.md index f245ff388..980879213 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ jobs: We can significantly reduce emulator startup time by setting up AVD snapshot caching: -1. add a `gradle/actions/setup-gradle@v3` step for caching Gradle, more details see [#229](https://github.com/ReactiveCircus/android-emulator-runner/issues/229) +1. add a `gradle/actions/setup-gradle@v4` step for caching Gradle, more details see [#229](https://github.com/ReactiveCircus/android-emulator-runner/issues/229) 2. add an `actions/cache@v4` step for caching the `avd` 3. add a `reactivecircus/android-emulator-runner@v2` step to generate a clean snapshot - specify `emulator-options` without `no-snapshot` 4. add another `reactivecircus/android-emulator-runner@v2` step to run your tests using existing AVD / snapshot - specify `emulator-options` with `no-snapshot-save` diff --git a/lib/sdk-installer.js b/lib/sdk-installer.js index c57dea955..fe7f51385 100644 --- a/lib/sdk-installer.js +++ b/lib/sdk-installer.js @@ -38,10 +38,10 @@ const exec = __importStar(require("@actions/exec")); const io = __importStar(require("@actions/io")); const tc = __importStar(require("@actions/tool-cache")); const fs = __importStar(require("fs")); -const BUILD_TOOLS_VERSION = '34.0.0'; -// SDK command-line tools 11.0 -const CMDLINE_TOOLS_URL_MAC = 'https://dl.google.com/android/repository/commandlinetools-mac-10406996_latest.zip'; -const CMDLINE_TOOLS_URL_LINUX = 'https://dl.google.com/android/repository/commandlinetools-linux-10406996_latest.zip'; +const BUILD_TOOLS_VERSION = '35.0.0'; +// SDK command-line tools 16.0 +const CMDLINE_TOOLS_URL_MAC = 'https://dl.google.com/android/repository/commandlinetools-mac-12266719_latest.zip'; +const CMDLINE_TOOLS_URL_LINUX = 'https://dl.google.com/android/repository/commandlinetools-linux-12266719_latest.zip'; /** * Installs & updates the Android SDK for the macOS platform, including SDK platform for the chosen API level, latest build tools, platform tools, Android Emulator, * and the system image for the chosen API level, CPU arch, and target. @@ -52,9 +52,6 @@ function installAndroidSdk(apiLevel, target, arch, channelId, emulatorBuild, ndk console.log(`::group::Install Android SDK`); const isOnMac = process.platform === 'darwin'; const isArm = process.arch === 'arm64'; - if (!isOnMac) { - yield exec.exec(`sh -c \\"sudo chown $USER:$USER ${process.env.ANDROID_HOME} -R`); - } const cmdlineToolsPath = `${process.env.ANDROID_HOME}/cmdline-tools`; if (!fs.existsSync(cmdlineToolsPath)) { console.log('Installing new cmdline-tools.'); @@ -66,6 +63,7 @@ function installAndroidSdk(apiLevel, target, arch, channelId, emulatorBuild, ndk // add paths for commandline-tools and platform-tools core.addPath(`${cmdlineToolsPath}/latest:${cmdlineToolsPath}/latest/bin:${process.env.ANDROID_HOME}/platform-tools`); // set standard AVD path + yield io.mkdirP(`${process.env.HOME}/.android/avd`); core.exportVariable('ANDROID_AVD_HOME', `${process.env.HOME}/.android/avd`); // accept all Android SDK licenses yield exec.exec(`sh -c \\"yes | sdkmanager --licenses > /dev/null"`); diff --git a/package-lock.json b/package-lock.json index 7e590dcbc..e0a68d9b9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2105,12 +2105,12 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -3053,9 +3053,9 @@ } }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, "dependencies": { "to-regex-range": "^5.0.1" @@ -7802,12 +7802,12 @@ } }, "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, "requires": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" } }, "browserslist": { @@ -8505,9 +8505,9 @@ } }, "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, "requires": { "to-regex-range": "^5.0.1" diff --git a/src/sdk-installer.ts b/src/sdk-installer.ts index 164fb3953..f87028a6f 100644 --- a/src/sdk-installer.ts +++ b/src/sdk-installer.ts @@ -4,10 +4,10 @@ import * as io from '@actions/io'; import * as tc from '@actions/tool-cache'; import * as fs from 'fs'; -const BUILD_TOOLS_VERSION = '34.0.0'; -// SDK command-line tools 11.0 -const CMDLINE_TOOLS_URL_MAC = 'https://dl.google.com/android/repository/commandlinetools-mac-10406996_latest.zip'; -const CMDLINE_TOOLS_URL_LINUX = 'https://dl.google.com/android/repository/commandlinetools-linux-10406996_latest.zip'; +const BUILD_TOOLS_VERSION = '35.0.0'; +// SDK command-line tools 16.0 +const CMDLINE_TOOLS_URL_MAC = 'https://dl.google.com/android/repository/commandlinetools-mac-12266719_latest.zip'; +const CMDLINE_TOOLS_URL_LINUX = 'https://dl.google.com/android/repository/commandlinetools-linux-12266719_latest.zip'; /** * Installs & updates the Android SDK for the macOS platform, including SDK platform for the chosen API level, latest build tools, platform tools, Android Emulator, @@ -19,10 +19,6 @@ export async function installAndroidSdk(apiLevel: string, target: string, arch: const isOnMac = process.platform === 'darwin'; const isArm = process.arch === 'arm64'; - if (!isOnMac) { - await exec.exec(`sh -c \\"sudo chown $USER:$USER ${process.env.ANDROID_HOME} -R`); - } - const cmdlineToolsPath = `${process.env.ANDROID_HOME}/cmdline-tools`; if (!fs.existsSync(cmdlineToolsPath)) { console.log('Installing new cmdline-tools.'); @@ -36,6 +32,7 @@ export async function installAndroidSdk(apiLevel: string, target: string, arch: core.addPath(`${cmdlineToolsPath}/latest:${cmdlineToolsPath}/latest/bin:${process.env.ANDROID_HOME}/platform-tools`); // set standard AVD path + await io.mkdirP(`${process.env.HOME}/.android/avd`); core.exportVariable('ANDROID_AVD_HOME', `${process.env.HOME}/.android/avd`); // accept all Android SDK licenses diff --git a/test-fixture/app/build.gradle b/test-fixture/app/build.gradle index 6e324c4c6..70f49e352 100644 --- a/test-fixture/app/build.gradle +++ b/test-fixture/app/build.gradle @@ -4,13 +4,13 @@ apply plugin: 'kotlin-android' android { namespace = "com.example.testapp" - compileSdkVersion 34 - buildToolsVersion "34.0.0" + compileSdkVersion 35 + buildToolsVersion "35.0.0" defaultConfig { applicationId "com.example.testapp" - minSdkVersion 15 - targetSdkVersion 34 + minSdkVersion 21 + targetSdkVersion 35 versionCode 1 versionName "1.0" @@ -30,8 +30,7 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { } dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'androidx.appcompat:appcompat:1.6.1' - androidTestImplementation 'androidx.test.ext:junit:1.1.5' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' + implementation 'androidx.appcompat:appcompat:1.7.0' + androidTestImplementation 'androidx.test.ext:junit:1.2.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1' } diff --git a/test-fixture/build.gradle b/test-fixture/build.gradle index fdc214646..aaea38ec7 100644 --- a/test-fixture/build.gradle +++ b/test-fixture/build.gradle @@ -6,8 +6,8 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.2.0' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.21" + classpath 'com.android.tools.build:gradle:8.7.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.20" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/test-fixture/gradle/wrapper/gradle-wrapper.properties b/test-fixture/gradle/wrapper/gradle-wrapper.properties index 1af9e0930..df97d72b8 100644 --- a/test-fixture/gradle/wrapper/gradle-wrapper.properties +++ b/test-fixture/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME