mirror of
https://gitea.com/actions/setup-android.git
synced 2025-12-24 07:58:22 +00:00
Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9fc6c4e906 | ||
|
|
edebe8927a | ||
|
|
2022e05939 | ||
|
|
f34c17e4f4 | ||
|
|
29d7cbabdd | ||
|
|
bb5134ce76 | ||
|
|
4b7c168f7a | ||
|
|
39fe32d9f9 | ||
|
|
9b404b77f3 | ||
|
|
b15b7e58c1 | ||
|
|
12a392d9f4 | ||
|
|
f3fd7c000f | ||
|
|
5baef82307 | ||
|
|
3963848dab | ||
|
|
c55407a479 | ||
|
|
4aaec39eee | ||
|
|
e1f5280adf | ||
|
|
961a5d9791 | ||
|
|
00854ea68c | ||
|
|
0d0e8c3af6 | ||
|
|
a9d7b728b4 | ||
|
|
93337aeebc | ||
|
|
c39b220a9b | ||
|
|
76b557c697 | ||
|
|
b7334e0985 | ||
|
|
8252dc7232 | ||
|
|
07976c6290 | ||
|
|
56927e38e2 | ||
|
|
eb7920b260 | ||
|
|
a86cdbf03d | ||
|
|
713cbf481b | ||
|
|
1297b09c09 |
33
.github/workflows/build-test.yml
vendored
33
.github/workflows/build-test.yml
vendored
@@ -1,13 +1,7 @@
|
||||
name: Build & Test
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/*
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
|
||||
@@ -63,8 +57,19 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ ubuntu-20.04, ubuntu-22.04, macos-11, macos-12, macos-13, windows-2019, windows-2022 ]
|
||||
os:
|
||||
- ubuntu-24.04
|
||||
- ubuntu-22.04
|
||||
- ubuntu-20.04
|
||||
- macos-14
|
||||
- macos-13
|
||||
- macos-12
|
||||
- windows-2022
|
||||
- windows-2019
|
||||
cmdline-tools-version:
|
||||
- 12266719
|
||||
- 11479570
|
||||
- 11076708
|
||||
- 10406996
|
||||
- 9862592
|
||||
- 9477386
|
||||
@@ -79,7 +84,7 @@ jobs:
|
||||
node-version: 20
|
||||
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: 17
|
||||
distribution: 'temurin'
|
||||
@@ -87,11 +92,13 @@ jobs:
|
||||
- run: npm ci
|
||||
- run: npm run build
|
||||
|
||||
- run: node dist/index.js
|
||||
env:
|
||||
INPUT_CMDLINE-TOOLS-VERSION: ${{ matrix.cmdline-tools-version }}
|
||||
INPUT_ACCEPT-ANDROID-SDK-LICENSES: 'true'
|
||||
INPUT_LOG-ACCEPTED-ANDROID-SDK-LICENSES: 'false'
|
||||
- name: Run setup-android
|
||||
uses: ./
|
||||
with:
|
||||
cmdline-tools-version: ${{ matrix.cmdline-tools-version }}
|
||||
log-accepted-android-sdk-licenses: 'false'
|
||||
|
||||
- run: sdkmanager --list_installed
|
||||
|
||||
- run: sdkmanager --list
|
||||
|
||||
|
||||
4
.github/workflows/codeql-analysis.yml
vendored
4
.github/workflows/codeql-analysis.yml
vendored
@@ -35,9 +35,9 @@ jobs:
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
languages: 'javascript'
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
uses: github/codeql-action/analyze@v3
|
||||
|
||||
11
.github/workflows/run.yml
vendored
11
.github/workflows/run.yml
vendored
@@ -1,17 +1,10 @@
|
||||
name: Run Android build
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'dist/**.js'
|
||||
- '.github/*.json'
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/*
|
||||
paths:
|
||||
- 'dist/**.js'
|
||||
- '.github/*.json'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -36,7 +29,7 @@ jobs:
|
||||
path: ./build/
|
||||
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: 17
|
||||
distribution: 'temurin'
|
||||
|
||||
36
README.md
36
README.md
@@ -3,10 +3,10 @@
|
||||

|
||||
|
||||
This action sets up the Android SDK tools by:
|
||||
- Downloading the SDK commandline tools, if the current version (11.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.
|
||||
- Installing `tools` and `platform-tools`.
|
||||
- Adding `platform-tools` (contains adb) and `cmdline-tools/11.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).
|
||||
|
||||
On Windows 2016 runners, this action also checks if `$ANDROID_SDK_ROOT` path contains spaces.
|
||||
@@ -39,12 +39,21 @@ steps:
|
||||
```
|
||||
|
||||
## Additional packages
|
||||
By default, sdkmanager installs "tools" and "platform-tools" packages. To install additional packages, call sdkmanager manually:
|
||||
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.
|
||||
|
||||
Additional packages can be installed at a later time by calling sdkmanager manually.
|
||||
|
||||
```yaml
|
||||
- name: Setup Android SDK
|
||||
uses: android-actions/setup-android@v3
|
||||
with:
|
||||
packages: ''
|
||||
|
||||
- run: sdkmanager "ndk;26.1.10909125" "cmake;3.22.1"
|
||||
# ...
|
||||
|
||||
- run: sdkmanager tools platform-tools
|
||||
```
|
||||
|
||||
## SDK Version selection
|
||||
@@ -52,7 +61,7 @@ By default, sdkmanager installs "tools" and "platform-tools" packages. To instal
|
||||
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.
|
||||
|
||||
By default, setup-android installs version 10406996 (short version 11.0).
|
||||
By default, setup-android installs version 12266719 (short version 16.0).
|
||||
|
||||
To install a different version, call setup-android with desired long version as the input parameter `cmdline-tools-version`:
|
||||
```yaml
|
||||
@@ -64,19 +73,22 @@ To install a different version, call setup-android with desired long version as
|
||||
|
||||
#### Version table
|
||||
| Short version | Long version |
|
||||
| --- | --- |
|
||||
| 11.0 | 10406996 |
|
||||
| 10.0 | 9862592 |
|
||||
| 9.0 | 9477386 |
|
||||
| 8.0 | 9123335 |
|
||||
| 7.0 | 8512546 |
|
||||
|---------------| --- |
|
||||
| 16.0 | 12266719 |
|
||||
| 13.0 | 11479570 |
|
||||
| 12.0 | 11076708 |
|
||||
| 11.0 | 10406996 |
|
||||
| 10.0 | 9862592 |
|
||||
| 9.0 | 9477386 |
|
||||
| 8.0 | 9123335 |
|
||||
| 7.0 | 8512546 |
|
||||
|
||||
Current cmdline tools version can be found at https://developer.android.com/studio#command-line-tools-only
|
||||
|
||||
|
||||
# Android SDK Licenses
|
||||
|
||||
Android SDK (unsurprisingly) is not public domain software, it comes with a license.
|
||||
Android SDK is not public domain software, it comes with a license.
|
||||
|
||||
Input parameter `accept-android-sdk-licenses` decides if Android SDK licenses should be agreed to on behalf of the user of this action.
|
||||
Default option is 'yes', because otherwise SDK is unusable until said licenses are agreed to.
|
||||
|
||||
@@ -6,7 +6,7 @@ inputs:
|
||||
cmdline-tools-version:
|
||||
description: 'cmdline-tools-version. See https://developer.android.com/studio#command-line-tools-only'
|
||||
required: false
|
||||
default: '10406996'
|
||||
default: '12266719'
|
||||
|
||||
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"'
|
||||
@@ -18,6 +18,11 @@ inputs:
|
||||
required: false
|
||||
default: 'true'
|
||||
|
||||
packages:
|
||||
description: 'Additional packages to install'
|
||||
required: false
|
||||
default: 'tools platform-tools'
|
||||
|
||||
runs:
|
||||
using: node20
|
||||
main: 'dist/index.js'
|
||||
|
||||
3344
dist/index.js
vendored
3344
dist/index.js
vendored
File diff suppressed because one or more lines are too long
6096
package-lock.json
generated
6096
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
18
package.json
18
package.json
@@ -25,24 +25,24 @@
|
||||
"author": "daveol",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@actions/cache": "^3.2.2",
|
||||
"@actions/cache": "^3.2.4",
|
||||
"@actions/core": "^1.10.1",
|
||||
"@actions/tool-cache": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.5",
|
||||
"@types/node": "^20.6.5",
|
||||
"@typescript-eslint/eslint-plugin": "^6.7.2",
|
||||
"@typescript-eslint/parser": "^6.7.2",
|
||||
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
||||
"@typescript-eslint/parser": "^7.18.0",
|
||||
"@vercel/ncc": "^0.38.0",
|
||||
"eslint": "^8.50.0",
|
||||
"eslint-plugin-github": "^4.10.0",
|
||||
"eslint-plugin-jest": "^27.4.0",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-plugin-github": "^5.0.1",
|
||||
"eslint-plugin-jest": "^28.6.0",
|
||||
"jest": "^29.7.0",
|
||||
"jest-circus": "^29.7.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"prettier": "^3.0.3",
|
||||
"ts-jest": "^29.1.1",
|
||||
"typescript": "^5.2.2"
|
||||
"prettier": "^3.3.2",
|
||||
"ts-jest": "^29.1.5",
|
||||
"typescript": "^5.5.4"
|
||||
}
|
||||
}
|
||||
|
||||
22
src/main.ts
22
src/main.ts
@@ -7,6 +7,12 @@ import * as os from 'os'
|
||||
|
||||
function getVersionShort(versionLong: string): string {
|
||||
switch (versionLong) {
|
||||
case '12266719':
|
||||
return '16.0'
|
||||
case '11479570':
|
||||
return '13.0'
|
||||
case '11076708':
|
||||
return '12.0'
|
||||
case '10406996':
|
||||
return '11.0'
|
||||
case '9862592':
|
||||
@@ -156,8 +162,20 @@ async function run(): Promise<void> {
|
||||
core.getBooleanInput('log-accepted-android-sdk-licenses')
|
||||
)
|
||||
}
|
||||
await callSdkManager(sdkManagerExe, 'tools')
|
||||
await callSdkManager(sdkManagerExe, 'platform-tools')
|
||||
|
||||
const packages = core
|
||||
.getInput('packages', {required: false})
|
||||
.split(' ')
|
||||
.map(function (str) {
|
||||
return str.trim()
|
||||
})
|
||||
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
||||
.filter(function (element, index, array) {
|
||||
return element
|
||||
})
|
||||
for (const pkg of packages) {
|
||||
await callSdkManager(sdkManagerExe, pkg)
|
||||
}
|
||||
|
||||
core.setOutput('ANDROID_COMMANDLINE_TOOLS_VERSION', VERSION_LONG)
|
||||
core.exportVariable('ANDROID_HOME', ANDROID_SDK_ROOT)
|
||||
|
||||
Reference in New Issue
Block a user