Skip to content

Commit b15b46d

Browse files
author
Maxim Lobanov
committed
add readme
1 parent 30dbc2e commit b15b46d

File tree

7 files changed

+93
-8
lines changed

7 files changed

+93
-8
lines changed

.github/workflows/workflow.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ jobs:
2424
- name: Build
2525
run: npm run build
2626

27-
#- name: Run tests
28-
# run: npm run test
27+
- name: Run tests
28+
run: npm run test
2929

30-
#- name: Lint
31-
# run: npm run lint
30+
- name: Lint
31+
run: npm run lint

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
The MIT License (MIT)
3+
4+
Copyright (c) 2020 Maxim Lobanov and contributors
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in
14+
all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
THE SOFTWARE.

README.md

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,58 @@
1-
# setup-android
2-
Set up Android tools in GitHub Actions workflow with cache
1+
# setup-android-tools
2+
This action is intended to install Android tools on Hosted images in GitHub Actions.
3+
It wraps `sdkmanager` and automate [caching](https://docs.github.com/en/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows) of installed packages.
4+
5+
### Available parameters
6+
|Parameter|Description|
7+
|-|-|
8+
|`packages`|Specify the package or list of packages to install [Mandatory parameter]If package is already installed, and update is available, action will update it|
9+
|`cache`|Enable to cache installed packages (see details below)(`true` or `false`)(`false` by default)|
10+
11+
### Usage
12+
Install the single package:
13+
```
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: setup-android-tools
19+
uses: maxim-lobanov/setup-android-tools@1.0
20+
with:
21+
packages: ndk;19.2.5345600
22+
```
23+
24+
Install multiple packages:
25+
```
26+
jobs:
27+
build:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: maxim-lobanov/setup-android-tools@1.0
31+
with:
32+
packages: |
33+
platforms;android-29
34+
platforms;android-30
35+
system-images;android-30;google_apis;x86
36+
```
37+
38+
Install package with enabled cache:
39+
```
40+
jobs:
41+
build:
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: maxim-lobanov/setup-android-tools@1.0
45+
with:
46+
packages: ndk;19.2.5345600
47+
cache: true
48+
```
49+
50+
### Cache packages
51+
With `cache: true`, action will automatically cache all downloaded packages via [@actions/cache](https://github.com/actions/toolkit/tree/main/packages/cache). In some cases, it could significantly speed up your builds.
52+
> Note that GitHub will remove any cache entries that have not been accessed in over 7 days. There is no limit on the number of caches you can store, but the total size of all caches in a repository is limited to 5 GB. If you exceed this limit, GitHub will save your cache but will begin evicting caches until the total size is less than 5 GB.
53+
54+
See "[Caching dependencies to speed up workflows](https://help.github.com/github/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows)" for how caching works.
55+
56+
57+
### License
58+
The scripts and documentation in this project are released under the [MIT License](LICENSE)

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: 'Setup Android tools'
22
author: 'Maxim Lobanov'
3-
description: 'Set up Android tools in GitHub Actions workflow with cache'
3+
description: 'Set up Android tools in GitHub Actions workflow with caching'
44
inputs:
55
packages:
66
description: 'Packages to install'

dist/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47608,6 +47608,9 @@ const run = async () => {
4760847608
core.info(" Package is already installed and update is not required");
4760947609
continue;
4761047610
}
47611+
if (foundPackage.update) {
47612+
core.info(" Package is already installed but update is required");
47613+
}
4761147614
if (enableCache) {
4761247615
if (await restoreCache(sdkmanager, foundPackage)) {
4761347616
core.info(" Package is restored from cache");

src/setup-android-tools.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ const run = async(): Promise<void> => {
6868
continue;
6969
}
7070

71+
if (foundPackage.update) {
72+
core.info(" Package is already installed but update is required");
73+
}
74+
7175
if (enableCache) {
7276
if (await restoreCache(sdkmanager, foundPackage)) {
7377
core.info(" Package is restored from cache");

src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ export const getBooleanInput = (inputName: string): boolean => {
1616

1717
export const getPackageCacheKey = (packageInfo: AndroidPackageInfo): string => {
1818
return `${packageInfo.name} ${packageInfo.remoteVersion}/1`;
19-
}
19+
};

0 commit comments

Comments
 (0)