mirror of
https://github.com/reactivecircus/android-emulator-runner.git
synced 2026-09-03 10:59:32 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4a8a9af74c | |||
| a72b5eb6c0 | |||
| b39f1a9f8b | |||
| a4d07e10d7 | |||
| 6f6ca5ebc6 |
@@ -3,13 +3,15 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- main
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '**.md'
|
- '**.md'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
env:
|
||||||
|
JAVA_TOOL_OPTIONS: -Xmx4g
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@@ -49,9 +51,6 @@ jobs:
|
|||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 14
|
java-version: 14
|
||||||
- name: Clean cache
|
|
||||||
if: matrix.os == 'macos-latest'
|
|
||||||
run: mv ~/.gradle/caches ~/.gradle/.invalid_caches
|
|
||||||
- uses: actions/cache@v1
|
- uses: actions/cache@v1
|
||||||
with:
|
with:
|
||||||
path: ~/.gradle/caches
|
path: ~/.gradle/caches
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
|
## v2.11.0
|
||||||
|
|
||||||
|
* Support running multiple instances of the action sequentially in a single job - [#73](https://github.com/ReactiveCircus/android-emulator-runner/issues/73).
|
||||||
|
|
||||||
## v2.10.0
|
## v2.10.0
|
||||||
|
|
||||||
* Support Android 11 (API 30) system images.
|
* Support Android 11 (API 30) system images.
|
||||||
|
|||||||
@@ -116,15 +116,16 @@ These are some of the open-source projects using (or used) **Android Emulator Ru
|
|||||||
|
|
||||||
- [coil-kt/coil](https://github.com/coil-kt/coil/blob/master/.github/workflows/)
|
- [coil-kt/coil](https://github.com/coil-kt/coil/blob/master/.github/workflows/)
|
||||||
- [cashapp/sqldelight](https://github.com/cashapp/sqldelight/blob/master/.github/workflows/)
|
- [cashapp/sqldelight](https://github.com/cashapp/sqldelight/blob/master/.github/workflows/)
|
||||||
- [square/workflow](https://github.com/square/workflow/blob/master/.github/workflows/)
|
- [square/workflow](https://github.com/square/workflow/blob/main/.github/workflows/)
|
||||||
- [square/retrofit](https://github.com/square/retrofit/blob/master/.github/workflows/)
|
- [square/retrofit](https://github.com/square/retrofit/blob/master/.github/workflows/)
|
||||||
- [natario1/CameraView](https://github.com/natario1/CameraView/tree/master/.github/workflows)
|
- [natario1/CameraView](https://github.com/natario1/CameraView/tree/master/.github/workflows)
|
||||||
- [natario1/Transcoder](https://github.com/natario1/Transcoder/tree/master/.github/workflows)
|
- [natario1/Transcoder](https://github.com/natario1/Transcoder/tree/master/.github/workflows)
|
||||||
- [chrisbanes/insetter](https://github.com/chrisbanes/insetter/tree/master/.github/workflows)
|
- [chrisbanes/insetter](https://github.com/chrisbanes/insetter/tree/main/.github/workflows)
|
||||||
- [slackhq/keeper](https://github.com/slackhq/keeper/tree/master/.github/workflows)
|
- [slackhq/keeper](https://github.com/slackhq/keeper/tree/main/.github/workflows)
|
||||||
- [android/compose-samples](https://github.com/android/compose-samples/blob/master/.github/workflows/ci.yaml)
|
- [android/compose-samples](https://github.com/android/compose-samples/blob/master/.github/workflows/ci.yaml)
|
||||||
- [ReactiveCircus/streamlined](https://github.com/ReactiveCircus/streamlined/tree/master/.github/workflows)
|
- [ReactiveCircus/streamlined](https://github.com/ReactiveCircus/streamlined/tree/main/.github/workflows)
|
||||||
- [ReactiveCircus/FlowBinding](https://github.com/ReactiveCircus/FlowBinding)
|
- [ReactiveCircus/FlowBinding](https://github.com/ReactiveCircus/FlowBinding)
|
||||||
|
- [JakeWharton/RxBinding](https://github.com/JakeWharton/RxBinding/tree/master/.github/workflows)
|
||||||
- [vinaygaba/Learn-Jetpack-Compose-By-Example](https://github.com/vinaygaba/Learn-Jetpack-Compose-By-Example/)
|
- [vinaygaba/Learn-Jetpack-Compose-By-Example](https://github.com/vinaygaba/Learn-Jetpack-Compose-By-Example/)
|
||||||
- [ashishb/adb-enhanced](https://github.com/ashishb/adb-enhanced/tree/master/.github/workflows)
|
- [ashishb/adb-enhanced](https://github.com/ashishb/adb-enhanced/tree/master/.github/workflows)
|
||||||
- [vgaidarji/ci-matters](https://github.com/vgaidarji/ci-matters/blob/master/.github/workflows/main.yaml)
|
- [vgaidarji/ci-matters](https://github.com/vgaidarji/ci-matters/blob/master/.github/workflows/main.yaml)
|
||||||
|
|||||||
+3
-3
@@ -4,7 +4,7 @@ Refer to the [recommendeations for versioning and releasing actions](https://git
|
|||||||
|
|
||||||
## New major release
|
## New major release
|
||||||
|
|
||||||
- From `master` branch, run `npm run build && npm test --clean && npm run lint` to make sure `lib/*.js` are up-to-date.
|
- From `main` branch, run `npm run build && npm test --clean && npm run lint` to make sure `lib/*.js` are up-to-date.
|
||||||
- Update `CHANGELOG.md`, push change with "Prepare for release X.Y.Z." (where X.Y.Z is the new version).
|
- Update `CHANGELOG.md`, push change with "Prepare for release X.Y.Z." (where X.Y.Z is the new version).
|
||||||
- Create a new branch e.g. `release/v1`, comment out `node_modules/` in `.gitignore`, commit the change (do not commit yet `node_modules`).
|
- Create a new branch e.g. `release/v1`, comment out `node_modules/` in `.gitignore`, commit the change (do not commit yet `node_modules`).
|
||||||
- Run `npm prune --production`.
|
- Run `npm prune --production`.
|
||||||
@@ -17,9 +17,9 @@ Refer to the [recommendeations for versioning and releasing actions](https://git
|
|||||||
|
|
||||||
## New minor / patch release
|
## New minor / patch release
|
||||||
|
|
||||||
- From `master` branch, run `npm run build && npm test --clean && npm run lint` to make sure `lib/*.js` are up-to-date.
|
- From `main` branch, run `npm run build && npm test --clean && npm run lint` to make sure `lib/*.js` are up-to-date.
|
||||||
- Update `CHANGELOG.md`, push change with "Prepare for release X.Y.Z." (where X.Y.Z is the new version).
|
- Update `CHANGELOG.md`, push change with "Prepare for release X.Y.Z." (where X.Y.Z is the new version).
|
||||||
- Merge from `master` into the release branch e.g. `release/v1`.
|
- Merge from `main` into the release branch e.g. `release/v1`.
|
||||||
- Run `npm prune --production`.
|
- Run `npm prune --production`.
|
||||||
- Commit merged changes (and the pruned `node_modules`).
|
- Commit merged changes (and the pruned `node_modules`).
|
||||||
- Push to remote.
|
- Push to remote.
|
||||||
|
|||||||
+24
-15
@@ -17,6 +17,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
const exec = __importStar(require("@actions/exec"));
|
const exec = __importStar(require("@actions/exec"));
|
||||||
|
const io = __importStar(require("@actions/io"));
|
||||||
|
const fs = __importStar(require("fs"));
|
||||||
const BUILD_TOOLS_VERSION = '30.0.0';
|
const BUILD_TOOLS_VERSION = '30.0.0';
|
||||||
const CMDLINE_TOOLS_URL_MAC = 'https://dl.google.com/android/repository/commandlinetools-mac-6514223_latest.zip';
|
const CMDLINE_TOOLS_URL_MAC = 'https://dl.google.com/android/repository/commandlinetools-mac-6514223_latest.zip';
|
||||||
const CMDLINE_TOOLS_URL_LINUX = 'https://dl.google.com/android/repository/commandlinetools-linux-6514223_latest.zip';
|
const CMDLINE_TOOLS_URL_LINUX = 'https://dl.google.com/android/repository/commandlinetools-linux-6514223_latest.zip';
|
||||||
@@ -27,31 +29,38 @@ const CMDLINE_TOOLS_URL_LINUX = 'https://dl.google.com/android/repository/comman
|
|||||||
function installAndroidSdk(apiLevel, target, arch, emulatorBuild, ndkVersion, cmakeVersion) {
|
function installAndroidSdk(apiLevel, target, arch, emulatorBuild, ndkVersion, cmakeVersion) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const isOnMac = process.platform === 'darwin';
|
const isOnMac = process.platform === 'darwin';
|
||||||
console.log('Installing new cmdline-tools.');
|
|
||||||
const sdkUrl = isOnMac ? CMDLINE_TOOLS_URL_MAC : CMDLINE_TOOLS_URL_LINUX;
|
|
||||||
yield exec.exec(`sudo mkdir ${process.env.ANDROID_HOME}/cmdline-tools`);
|
|
||||||
yield exec.exec(`curl -fo commandlinetools.zip ${sdkUrl}`);
|
|
||||||
yield exec.exec(`sudo unzip -q commandlinetools.zip -d ${process.env.ANDROID_HOME}/cmdline-tools`);
|
|
||||||
yield exec.exec(`sudo rm -f commandlinetools.zip`);
|
|
||||||
// add paths for commandline-tools and platform-tools
|
|
||||||
core.addPath(`${process.env.ANDROID_HOME}/cmdline-tools/tools:${process.env.ANDROID_HOME}/cmdline-tools/tools/bin:${process.env.ANDROID_HOME}/platform-tools`);
|
|
||||||
// additional permission and license requirements for Linux
|
|
||||||
if (!isOnMac) {
|
if (!isOnMac) {
|
||||||
yield exec.exec(`sh -c \\"sudo chown $USER:$USER ${process.env.ANDROID_HOME} -R`);
|
yield exec.exec(`sh -c \\"sudo chown $USER:$USER ${process.env.ANDROID_HOME} -R`);
|
||||||
yield exec.exec(`sh -c \\"echo -e '\n84831b9409646a918e30573bab4c9c91346d8abd' > ${process.env.ANDROID_HOME}/licenses/android-sdk-preview-license"`);
|
}
|
||||||
|
const cmdlineToolsPath = `${process.env.ANDROID_HOME}/cmdline-tools`;
|
||||||
|
if (!fs.existsSync(cmdlineToolsPath)) {
|
||||||
|
console.log('Installing new cmdline-tools.');
|
||||||
|
const sdkUrl = isOnMac ? CMDLINE_TOOLS_URL_MAC : CMDLINE_TOOLS_URL_LINUX;
|
||||||
|
yield io.mkdirP(`${process.env.ANDROID_HOME}/cmdline-tools`);
|
||||||
|
yield exec.exec(`curl -fo commandlinetools.zip ${sdkUrl}`);
|
||||||
|
yield exec.exec(`unzip -q commandlinetools.zip -d ${cmdlineToolsPath}`);
|
||||||
|
yield io.rmRF('commandlinetools.zip');
|
||||||
|
// add paths for commandline-tools and platform-tools
|
||||||
|
core.addPath(`${cmdlineToolsPath}/tools:${cmdlineToolsPath}/tools/bin:${process.env.ANDROID_HOME}/platform-tools`);
|
||||||
|
}
|
||||||
|
// additional permission and license requirements for Linux
|
||||||
|
const sdkPreviewLicensePath = `${process.env.ANDROID_HOME}/licenses/android-sdk-preview-license`;
|
||||||
|
if (!isOnMac && !fs.existsSync(sdkPreviewLicensePath)) {
|
||||||
|
yield exec.exec(`sh -c \\"echo -e '\n84831b9409646a918e30573bab4c9c91346d8abd' > ${sdkPreviewLicensePath}"`);
|
||||||
}
|
}
|
||||||
// license required for API 30 system images
|
// license required for API 30 system images
|
||||||
if (apiLevel == 30) {
|
const sdkArmDbtLicensePath = `${process.env.ANDROID_HOME}/licenses/android-sdk-arm-dbt-license`;
|
||||||
yield exec.exec(`sh -c \\"echo -e '\n859f317696f67ef3d7f30a50a5560e7834b43903' > ${process.env.ANDROID_HOME}/licenses/android-sdk-arm-dbt-license"`);
|
if (apiLevel == 30 && !fs.existsSync(sdkArmDbtLicensePath)) {
|
||||||
|
yield exec.exec(`sh -c \\"echo -e '\n859f317696f67ef3d7f30a50a5560e7834b43903' > ${sdkArmDbtLicensePath}"`);
|
||||||
}
|
}
|
||||||
console.log('Installing latest build tools, platform tools, and platform.');
|
console.log('Installing latest build tools, platform tools, and platform.');
|
||||||
yield exec.exec(`sh -c \\"sdkmanager --install 'build-tools;${BUILD_TOOLS_VERSION}' platform-tools 'platforms;android-${apiLevel}' > /dev/null"`);
|
yield exec.exec(`sh -c \\"sdkmanager --install 'build-tools;${BUILD_TOOLS_VERSION}' platform-tools 'platforms;android-${apiLevel}' > /dev/null"`);
|
||||||
if (emulatorBuild) {
|
if (emulatorBuild) {
|
||||||
console.log(`Installing emulator build ${emulatorBuild}.`);
|
console.log(`Installing emulator build ${emulatorBuild}.`);
|
||||||
yield exec.exec(`curl -fo emulator.zip https://dl.google.com/android/repository/emulator-${isOnMac ? 'darwin' : 'linux'}-${emulatorBuild}.zip`);
|
yield exec.exec(`curl -fo emulator.zip https://dl.google.com/android/repository/emulator-${isOnMac ? 'darwin' : 'linux'}-${emulatorBuild}.zip`);
|
||||||
yield exec.exec(`sudo rm -rf ${process.env.ANDROID_HOME}/emulator`);
|
yield io.rmRF(`${process.env.ANDROID_HOME}/emulator`);
|
||||||
yield exec.exec(`sudo unzip -q emulator.zip -d ${process.env.ANDROID_HOME}`);
|
yield exec.exec(`unzip -q emulator.zip -d ${process.env.ANDROID_HOME}`);
|
||||||
yield exec.exec(`sudo rm -f emulator.zip`);
|
yield io.rmRF('emulator.zip');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log('Installing latest emulator.');
|
console.log('Installing latest emulator.');
|
||||||
|
|||||||
+28
-16
@@ -1,5 +1,7 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
|
import * as io from '@actions/io';
|
||||||
|
import * as fs from 'fs';
|
||||||
|
|
||||||
const BUILD_TOOLS_VERSION = '30.0.0';
|
const BUILD_TOOLS_VERSION = '30.0.0';
|
||||||
const CMDLINE_TOOLS_URL_MAC = 'https://dl.google.com/android/repository/commandlinetools-mac-6514223_latest.zip';
|
const CMDLINE_TOOLS_URL_MAC = 'https://dl.google.com/android/repository/commandlinetools-mac-6514223_latest.zip';
|
||||||
@@ -11,24 +13,34 @@ const CMDLINE_TOOLS_URL_LINUX = 'https://dl.google.com/android/repository/comman
|
|||||||
*/
|
*/
|
||||||
export async function installAndroidSdk(apiLevel: number, target: string, arch: string, emulatorBuild?: string, ndkVersion?: string, cmakeVersion?: string): Promise<void> {
|
export async function installAndroidSdk(apiLevel: number, target: string, arch: string, emulatorBuild?: string, ndkVersion?: string, cmakeVersion?: string): Promise<void> {
|
||||||
const isOnMac = process.platform === 'darwin';
|
const isOnMac = process.platform === 'darwin';
|
||||||
console.log('Installing new cmdline-tools.');
|
|
||||||
const sdkUrl = isOnMac ? CMDLINE_TOOLS_URL_MAC : CMDLINE_TOOLS_URL_LINUX;
|
|
||||||
await exec.exec(`sudo mkdir ${process.env.ANDROID_HOME}/cmdline-tools`);
|
|
||||||
await exec.exec(`curl -fo commandlinetools.zip ${sdkUrl}`);
|
|
||||||
await exec.exec(`sudo unzip -q commandlinetools.zip -d ${process.env.ANDROID_HOME}/cmdline-tools`);
|
|
||||||
await exec.exec(`sudo rm -f commandlinetools.zip`);
|
|
||||||
|
|
||||||
// add paths for commandline-tools and platform-tools
|
|
||||||
core.addPath(`${process.env.ANDROID_HOME}/cmdline-tools/tools:${process.env.ANDROID_HOME}/cmdline-tools/tools/bin:${process.env.ANDROID_HOME}/platform-tools`);
|
|
||||||
|
|
||||||
// additional permission and license requirements for Linux
|
|
||||||
if (!isOnMac) {
|
if (!isOnMac) {
|
||||||
await exec.exec(`sh -c \\"sudo chown $USER:$USER ${process.env.ANDROID_HOME} -R`);
|
await exec.exec(`sh -c \\"sudo chown $USER:$USER ${process.env.ANDROID_HOME} -R`);
|
||||||
await exec.exec(`sh -c \\"echo -e '\n84831b9409646a918e30573bab4c9c91346d8abd' > ${process.env.ANDROID_HOME}/licenses/android-sdk-preview-license"`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const cmdlineToolsPath = `${process.env.ANDROID_HOME}/cmdline-tools`;
|
||||||
|
if (!fs.existsSync(cmdlineToolsPath)) {
|
||||||
|
console.log('Installing new cmdline-tools.');
|
||||||
|
const sdkUrl = isOnMac ? CMDLINE_TOOLS_URL_MAC : CMDLINE_TOOLS_URL_LINUX;
|
||||||
|
await io.mkdirP(`${process.env.ANDROID_HOME}/cmdline-tools`);
|
||||||
|
await exec.exec(`curl -fo commandlinetools.zip ${sdkUrl}`);
|
||||||
|
await exec.exec(`unzip -q commandlinetools.zip -d ${cmdlineToolsPath}`);
|
||||||
|
await io.rmRF('commandlinetools.zip');
|
||||||
|
|
||||||
|
// add paths for commandline-tools and platform-tools
|
||||||
|
core.addPath(`${cmdlineToolsPath}/tools:${cmdlineToolsPath}/tools/bin:${process.env.ANDROID_HOME}/platform-tools`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// additional permission and license requirements for Linux
|
||||||
|
const sdkPreviewLicensePath = `${process.env.ANDROID_HOME}/licenses/android-sdk-preview-license`;
|
||||||
|
if (!isOnMac && !fs.existsSync(sdkPreviewLicensePath)) {
|
||||||
|
await exec.exec(`sh -c \\"echo -e '\n84831b9409646a918e30573bab4c9c91346d8abd' > ${sdkPreviewLicensePath}"`);
|
||||||
|
}
|
||||||
|
|
||||||
// license required for API 30 system images
|
// license required for API 30 system images
|
||||||
if (apiLevel == 30) {
|
const sdkArmDbtLicensePath = `${process.env.ANDROID_HOME}/licenses/android-sdk-arm-dbt-license`;
|
||||||
await exec.exec(`sh -c \\"echo -e '\n859f317696f67ef3d7f30a50a5560e7834b43903' > ${process.env.ANDROID_HOME}/licenses/android-sdk-arm-dbt-license"`);
|
if (apiLevel == 30 && !fs.existsSync(sdkArmDbtLicensePath)) {
|
||||||
|
await exec.exec(`sh -c \\"echo -e '\n859f317696f67ef3d7f30a50a5560e7834b43903' > ${sdkArmDbtLicensePath}"`);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Installing latest build tools, platform tools, and platform.');
|
console.log('Installing latest build tools, platform tools, and platform.');
|
||||||
@@ -37,9 +49,9 @@ export async function installAndroidSdk(apiLevel: number, target: string, arch:
|
|||||||
if (emulatorBuild) {
|
if (emulatorBuild) {
|
||||||
console.log(`Installing emulator build ${emulatorBuild}.`);
|
console.log(`Installing emulator build ${emulatorBuild}.`);
|
||||||
await exec.exec(`curl -fo emulator.zip https://dl.google.com/android/repository/emulator-${isOnMac ? 'darwin' : 'linux'}-${emulatorBuild}.zip`);
|
await exec.exec(`curl -fo emulator.zip https://dl.google.com/android/repository/emulator-${isOnMac ? 'darwin' : 'linux'}-${emulatorBuild}.zip`);
|
||||||
await exec.exec(`sudo rm -rf ${process.env.ANDROID_HOME}/emulator`);
|
await io.rmRF(`${process.env.ANDROID_HOME}/emulator`);
|
||||||
await exec.exec(`sudo unzip -q emulator.zip -d ${process.env.ANDROID_HOME}`);
|
await exec.exec(`unzip -q emulator.zip -d ${process.env.ANDROID_HOME}`);
|
||||||
await exec.exec(`sudo rm -f emulator.zip`);
|
await io.rmRF('emulator.zip');
|
||||||
} else {
|
} else {
|
||||||
console.log('Installing latest emulator.');
|
console.log('Installing latest emulator.');
|
||||||
await exec.exec(`sh -c \\"sdkmanager --install emulator > /dev/null"`);
|
await exec.exec(`sh -c \\"sdkmanager --install emulator > /dev/null"`);
|
||||||
|
|||||||
Reference in New Issue
Block a user