mirror of
https://github.com/android-actions/setup-android.git
synced 2026-10-02 18:16:07 +03:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
035682743a | ||
|
|
be39fa8340 | ||
|
|
1f87d5b2a1 | ||
|
|
138b5fb1cf | ||
|
|
5ed526629f | ||
|
|
ca5c9e054e | ||
|
|
927cbf9b1d | ||
|
|
76ffd60ae0 | ||
|
|
7731365548 | ||
|
|
4d90f94363 |
No files matched your search
@@ -9,7 +9,7 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
|
|
||||||
- name: Setup node 24
|
- name: Setup node 24
|
||||||
uses: actions/setup-node@v6
|
uses: actions/setup-node@v6
|
||||||
@@ -26,7 +26,7 @@ jobs:
|
|||||||
format-check:
|
format-check:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
|
|
||||||
- name: Setup node 24
|
- name: Setup node 24
|
||||||
uses: actions/setup-node@v6
|
uses: actions/setup-node@v6
|
||||||
@@ -40,7 +40,7 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
|
|
||||||
- name: Setup node 24
|
- name: Setup node 24
|
||||||
uses: actions/setup-node@v6
|
uses: actions/setup-node@v6
|
||||||
@@ -66,6 +66,7 @@ jobs:
|
|||||||
- windows-2025
|
- windows-2025
|
||||||
- windows-2022
|
- windows-2022
|
||||||
cmdline-tools-version:
|
cmdline-tools-version:
|
||||||
|
- 15859902
|
||||||
- 14742923
|
- 14742923
|
||||||
- 12266719
|
- 12266719
|
||||||
- 11479570
|
- 11479570
|
||||||
@@ -76,7 +77,7 @@ jobs:
|
|||||||
- 9123335
|
- 9123335
|
||||||
- 8512546
|
- 8512546
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
|
|
||||||
- name: Setup node 24
|
- name: Setup node 24
|
||||||
uses: actions/setup-node@v6
|
uses: actions/setup-node@v6
|
||||||
@@ -105,7 +106,7 @@ jobs:
|
|||||||
lint:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
|
|
||||||
- name: Setup node 24
|
- name: Setup node 24
|
||||||
uses: actions/setup-node@v6
|
uses: actions/setup-node@v6
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v7
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ jobs:
|
|||||||
if: ${{ false }}
|
if: ${{ false }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
with:
|
with:
|
||||||
repository: daveol/SampleApplication
|
repository: daveol/SampleApplication
|
||||||
|
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v7
|
||||||
with:
|
with:
|
||||||
path: ./build/
|
path: ./build/
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
This action sets up the Android SDK tools by:
|
This action sets up the Android SDK tools by:
|
||||||
- Downloading the SDK commandline tools, if the current version (16.0) is not found in either `$ANDROID_SDK_ROOT` or `$HOME/.android/sdk`.
|
- Downloading the SDK commandline tools, if the current version (16.0) is not found in either `$ANDROID_SDK_ROOT` or `$HOME/.android/sdk`.
|
||||||
- Accepting the SDK licenses.
|
- Accepting the SDK licenses.
|
||||||
- Installing `tools` and `platform-tools`.
|
- Installing `platform-tools`.
|
||||||
- Adding `platform-tools` (contains adb) and `cmdline-tools/16.0/bin` (contains sdkmanager) to `$PATH`.
|
- Adding `platform-tools` (contains adb) and `cmdline-tools/16.0/bin` (contains sdkmanager) to `$PATH`.
|
||||||
- Setting up problem [matchers](/matchers.json).
|
- Setting up problem [matchers](/matchers.json).
|
||||||
|
|
||||||
@@ -23,16 +23,16 @@ See [action.yml](action.yml)
|
|||||||
## Basic
|
## Basic
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v7
|
||||||
|
|
||||||
- name: Set up JDK 17
|
- name: Set up JDK 17
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v6
|
||||||
with:
|
with:
|
||||||
java-version: '17'
|
java-version: '17'
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
|
|
||||||
- name: Setup Android SDK
|
- name: Setup Android SDK
|
||||||
uses: android-actions/setup-android@v3
|
uses: android-actions/setup-android@v4
|
||||||
|
|
||||||
- name: Build SampleApplication
|
- name: Build SampleApplication
|
||||||
run: ./gradlew --no-daemon build
|
run: ./gradlew --no-daemon build
|
||||||
@@ -41,27 +41,51 @@ steps:
|
|||||||
## Additional packages
|
## Additional packages
|
||||||
Input parameter `packages` controls which packages this action will install from Android SDK.
|
Input parameter `packages` controls which packages this action will install from Android SDK.
|
||||||
|
|
||||||
Default value is `tools platform-tools`, supply an empty string to skip installing additional packages.
|
Default value is `platform-tools`, supply an empty string to skip installing additional packages.
|
||||||
|
|
||||||
Additional packages can be installed at a later time by calling sdkmanager manually.
|
Additional packages can be installed at a later time by calling sdkmanager manually.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup Android SDK
|
- name: Setup Android SDK
|
||||||
uses: android-actions/setup-android@v3
|
uses: android-actions/setup-android@v4
|
||||||
with:
|
with:
|
||||||
packages: ''
|
packages: ''
|
||||||
|
|
||||||
# ...
|
# ...
|
||||||
|
|
||||||
- run: sdkmanager tools platform-tools
|
- run: sdkmanager platform-tools
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## The deprecated `tools` package
|
||||||
|
|
||||||
|
Google no longer serves the `tools` package, see [tools#tools-sdk](https://developer.android.com/tools#tools-sdk).
|
||||||
|
Asking for it fails with `Failed to find package 'tools'`, so it is no longer part of the default value of `packages`.
|
||||||
|
If it is requested explicitly, this action skips it with a warning rather than failing the build.
|
||||||
|
|
||||||
|
Most of what `tools` provided now lives in the command line tools, which this action installs and adds to `$PATH`
|
||||||
|
regardless of the `packages` input, so these need no install step at all:
|
||||||
|
|
||||||
|
`apkanalyzer` `avdmanager` `lint` `screenshot2` `sdkmanager` `retrace` `resourceshrinker` `profgen` `d8` `r8`
|
||||||
|
|
||||||
|
The emulator was split out of `tools` into its own package, request it explicitly if you need it:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Setup Android SDK
|
||||||
|
uses: android-actions/setup-android@v4
|
||||||
|
with:
|
||||||
|
packages: 'platform-tools emulator'
|
||||||
|
```
|
||||||
|
|
||||||
|
The remaining `tools` contents have no replacement in the current SDK: `android` was superseded by `sdkmanager` and
|
||||||
|
`avdmanager`, ProGuard by [R8](https://developer.android.com/build/shrink-code), and `monitor`, `ddms`, `monkeyrunner`
|
||||||
|
and `uiautomatorviewer` were dropped without one.
|
||||||
|
|
||||||
## SDK Version selection
|
## SDK Version selection
|
||||||
|
|
||||||
Command line tools are versioned using two variables - short and long.
|
Command line tools are versioned using two variables - short and long.
|
||||||
Long one is the build number, used in the zip URL, short one is the human friendly version name.
|
Long one is the build number, used in the zip URL, short one is the human friendly version name.
|
||||||
|
|
||||||
By default, setup-android installs version 14742923 (short version 20.0).
|
By default, setup-android installs version 15859902 (short version 22.0).
|
||||||
|
|
||||||
To install a different version, call setup-android with desired long version as the input parameter `cmdline-tools-version`:
|
To install a different version, call setup-android with desired long version as the input parameter `cmdline-tools-version`:
|
||||||
```yaml
|
```yaml
|
||||||
@@ -74,6 +98,7 @@ To install a different version, call setup-android with desired long version as
|
|||||||
#### Version table
|
#### Version table
|
||||||
| Short version | Long version |
|
| Short version | Long version |
|
||||||
|---------------| --- |
|
|---------------| --- |
|
||||||
|
| 22.0 | 15859902 |
|
||||||
| 20.0 | 14742923 |
|
| 20.0 | 14742923 |
|
||||||
| 16.0 | 12266719 |
|
| 16.0 | 12266719 |
|
||||||
| 13.0 | 11479570 |
|
| 13.0 | 11479570 |
|
||||||
|
|||||||
+2
-2
@@ -6,7 +6,7 @@ inputs:
|
|||||||
cmdline-tools-version:
|
cmdline-tools-version:
|
||||||
description: 'cmdline-tools-version. See https://developer.android.com/studio#command-line-tools-only'
|
description: 'cmdline-tools-version. See https://developer.android.com/studio#command-line-tools-only'
|
||||||
required: false
|
required: false
|
||||||
default: '14742923'
|
default: '15859902'
|
||||||
|
|
||||||
accept-android-sdk-licenses:
|
accept-android-sdk-licenses:
|
||||||
description: 'Android SDK is usable only after the license agreement. Should setup-android agree to the licences, provided by "sdkmanager --licenses"'
|
description: 'Android SDK is usable only after the license agreement. Should setup-android agree to the licences, provided by "sdkmanager --licenses"'
|
||||||
@@ -21,7 +21,7 @@ inputs:
|
|||||||
packages:
|
packages:
|
||||||
description: 'Additional packages to install'
|
description: 'Additional packages to install'
|
||||||
required: false
|
required: false
|
||||||
default: 'tools platform-tools'
|
default: 'platform-tools'
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: node24
|
using: node24
|
||||||
|
|||||||
Vendored
+645
-188
File diff suppressed because it is too large.
Load diff
Generated
+3310
-2725
File diff suppressed because it is too large.
Load diff
+14
-14
@@ -25,24 +25,24 @@
|
|||||||
"author": "daveol",
|
"author": "daveol",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^3.0.0",
|
"@actions/core": "^3.0.1",
|
||||||
"@actions/tool-cache": "^4.0.0"
|
"@actions/tool-cache": "^4.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^30.0.0",
|
"@types/jest": "^30.0.0",
|
||||||
"@types/node": "^24.0.0",
|
"@types/node": "^24.13.5",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.57.2",
|
"@typescript-eslint/eslint-plugin": "^8.70.0",
|
||||||
"@typescript-eslint/parser": "^8.57.2",
|
"@typescript-eslint/parser": "^8.70.0",
|
||||||
"esbuild": "^0.28.0",
|
"esbuild": "^0.28.2",
|
||||||
"eslint": "^10.1.0",
|
"eslint": "^10.10.0",
|
||||||
"eslint-plugin-check-file": "^3.3.1",
|
"eslint-plugin-check-file": "^3.3.2",
|
||||||
"eslint-plugin-jest": "^29.15.1",
|
"eslint-plugin-jest": "^29.16.6",
|
||||||
"globals": "^17.4.0",
|
"globals": "^17.12.0",
|
||||||
"jest": "^30.3.0",
|
"jest": "^30.5.1",
|
||||||
"jest-circus": "^30.3.0",
|
"jest-circus": "^30.3.0",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^5.4.2",
|
||||||
"prettier": "^3.3.2",
|
"prettier": "^3.9.7",
|
||||||
"ts-jest": "^29.1.5",
|
"ts-jest": "^29.4.12",
|
||||||
"typescript": "^5.9.3"
|
"typescript": "^6.0.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+21
-1
@@ -7,6 +7,8 @@ import * as os from 'os'
|
|||||||
|
|
||||||
function getVersionShort(versionLong: string): string {
|
function getVersionShort(versionLong: string): string {
|
||||||
switch (versionLong) {
|
switch (versionLong) {
|
||||||
|
case '15859902':
|
||||||
|
return '22.0'
|
||||||
case '14742923':
|
case '14742923':
|
||||||
return '20.0'
|
return '20.0'
|
||||||
case '12266719':
|
case '12266719':
|
||||||
@@ -41,6 +43,7 @@ const VERSION_SHORT = getVersionShort(VERSION_LONG)
|
|||||||
|
|
||||||
const COMMANDLINE_TOOLS_WIN_URL = `https://dl.google.com/android/repository/commandlinetools-win-${VERSION_LONG}_latest.zip`
|
const COMMANDLINE_TOOLS_WIN_URL = `https://dl.google.com/android/repository/commandlinetools-win-${VERSION_LONG}_latest.zip`
|
||||||
const COMMANDLINE_TOOLS_MAC_URL = `https://dl.google.com/android/repository/commandlinetools-mac-${VERSION_LONG}_latest.zip`
|
const COMMANDLINE_TOOLS_MAC_URL = `https://dl.google.com/android/repository/commandlinetools-mac-${VERSION_LONG}_latest.zip`
|
||||||
|
const COMMANDLINE_TOOLS_MAC_ARM64_URL = `https://dl.google.com/android/repository/commandlinetools-mac_arm64-${VERSION_LONG}_latest.zip`
|
||||||
const COMMANDLINE_TOOLS_LIN_URL = `https://dl.google.com/android/repository/commandlinetools-linux-${VERSION_LONG}_latest.zip`
|
const COMMANDLINE_TOOLS_LIN_URL = `https://dl.google.com/android/repository/commandlinetools-linux-${VERSION_LONG}_latest.zip`
|
||||||
|
|
||||||
const ANDROID_HOME_SDK_DIR = path.join(os.homedir(), '.android', 'sdk')
|
const ANDROID_HOME_SDK_DIR = path.join(os.homedir(), '.android', 'sdk')
|
||||||
@@ -105,7 +108,11 @@ async function installSdkManager(): Promise<string> {
|
|||||||
if (process.platform === 'linux') {
|
if (process.platform === 'linux') {
|
||||||
cmdlineToolsURL = COMMANDLINE_TOOLS_LIN_URL
|
cmdlineToolsURL = COMMANDLINE_TOOLS_LIN_URL
|
||||||
} else if (process.platform === 'darwin') {
|
} else if (process.platform === 'darwin') {
|
||||||
cmdlineToolsURL = COMMANDLINE_TOOLS_MAC_URL
|
if (Number(VERSION_LONG) >= 15859902) {
|
||||||
|
cmdlineToolsURL = COMMANDLINE_TOOLS_MAC_ARM64_URL
|
||||||
|
} else {
|
||||||
|
cmdlineToolsURL = COMMANDLINE_TOOLS_MAC_URL
|
||||||
|
}
|
||||||
} else if (process.platform === 'win32') {
|
} else if (process.platform === 'win32') {
|
||||||
cmdlineToolsURL = COMMANDLINE_TOOLS_WIN_URL
|
cmdlineToolsURL = COMMANDLINE_TOOLS_WIN_URL
|
||||||
} else {
|
} else {
|
||||||
@@ -175,6 +182,19 @@ async function run(): Promise<void> {
|
|||||||
.filter(function (element, index, array) {
|
.filter(function (element, index, array) {
|
||||||
return element
|
return element
|
||||||
})
|
})
|
||||||
|
.filter(function (pkg) {
|
||||||
|
// The 'tools' package is deprecated and no longer served by Google,
|
||||||
|
// asking sdkmanager for it fails the whole action.
|
||||||
|
// Its replacement, cmdline-tools, is already installed by this action.
|
||||||
|
if (pkg === 'tools') {
|
||||||
|
core.warning(
|
||||||
|
"Skipping deprecated package 'tools', it is no longer available in the Android SDK repository. " +
|
||||||
|
'The command line tools installed by this action replace it, see https://developer.android.com/tools#tools-sdk'
|
||||||
|
)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
})
|
||||||
for (const pkg of packages) {
|
for (const pkg of packages) {
|
||||||
await callSdkManager(sdkManagerExe, pkg)
|
await callSdkManager(sdkManagerExe, pkg)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
"lib": [
|
"lib": [
|
||||||
"ES2024"
|
"ES2024"
|
||||||
],
|
],
|
||||||
|
"types": ["node", "jest"],
|
||||||
"outDir": "./lib",
|
"outDir": "./lib",
|
||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
|
|||||||
Reference in new issue
Block a user