mirror of
https://gitea.com/actions/setup-android.git
synced 2025-12-27 01:18:22 +00:00
Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
24b7e80ade | ||
|
|
57977119c1 | ||
|
|
2112bb34ef | ||
|
|
78611c05a8 | ||
|
|
c52a594b8a | ||
|
|
d22da3d6e9 | ||
|
|
1d816790f5 | ||
|
|
a4d56ab860 | ||
|
|
62ea653263 | ||
|
|
f7a7114037 | ||
|
|
87ec6df705 | ||
|
|
19571f1d06 | ||
|
|
f2fe6d103b | ||
|
|
9665d86acf | ||
|
|
01efde8e60 | ||
|
|
db3b072a6b | ||
|
|
469d66c201 | ||
|
|
f4de3ae372 | ||
|
|
c19969d881 | ||
|
|
a98b957810 | ||
|
|
a1f8a01619 | ||
|
|
3626142136 | ||
|
|
e79d88bfc6 | ||
|
|
2dc5b4642b | ||
|
|
e8799536cb | ||
|
|
7d6381ea3b | ||
|
|
9cc55a998e | ||
|
|
0e2d9d598a | ||
|
|
aae459b0a0 |
113
.eslintrc.json
113
.eslintrc.json
@@ -1,59 +1,54 @@
|
|||||||
{
|
{
|
||||||
"plugins": ["jest", "@typescript-eslint"],
|
"plugins": ["jest", "@typescript-eslint"],
|
||||||
"extends": ["plugin:github/es6"],
|
"extends": ["plugin:github/recommended"],
|
||||||
"parser": "@typescript-eslint/parser",
|
"parser": "@typescript-eslint/parser",
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"ecmaVersion": 9,
|
"ecmaVersion": 9,
|
||||||
"sourceType": "module",
|
"sourceType": "module",
|
||||||
"project": "./tsconfig.json"
|
"project": "./tsconfig.json"
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"eslint-comments/no-use": "off",
|
"eslint-comments/no-use": "off",
|
||||||
"import/no-namespace": "off",
|
"import/no-namespace": "off",
|
||||||
"no-unused-vars": "off",
|
"no-unused-vars": "off",
|
||||||
"@typescript-eslint/no-unused-vars": "error",
|
"@typescript-eslint/no-unused-vars": "error",
|
||||||
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
|
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
|
||||||
"@typescript-eslint/no-require-imports": "error",
|
"@typescript-eslint/no-require-imports": "error",
|
||||||
"@typescript-eslint/array-type": "error",
|
"@typescript-eslint/array-type": "error",
|
||||||
"@typescript-eslint/await-thenable": "error",
|
"@typescript-eslint/await-thenable": "error",
|
||||||
"@typescript-eslint/ban-ts-ignore": "error",
|
"@typescript-eslint/ban-ts-comment": "error",
|
||||||
"camelcase": "off",
|
"camelcase": "off",
|
||||||
"@typescript-eslint/camelcase": "error",
|
"@typescript-eslint/consistent-type-assertions": "error",
|
||||||
"@typescript-eslint/class-name-casing": "error",
|
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
|
||||||
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
|
"@typescript-eslint/func-call-spacing": ["error", "never"],
|
||||||
"@typescript-eslint/func-call-spacing": ["error", "never"],
|
"@typescript-eslint/no-array-constructor": "error",
|
||||||
"@typescript-eslint/generic-type-naming": ["error", "^[A-Z][A-Za-z]*$"],
|
"@typescript-eslint/no-empty-interface": "error",
|
||||||
"@typescript-eslint/no-array-constructor": "error",
|
"@typescript-eslint/no-explicit-any": "error",
|
||||||
"@typescript-eslint/no-empty-interface": "error",
|
"@typescript-eslint/no-extraneous-class": "error",
|
||||||
"@typescript-eslint/no-explicit-any": "error",
|
"@typescript-eslint/no-for-in-array": "error",
|
||||||
"@typescript-eslint/no-extraneous-class": "error",
|
"@typescript-eslint/no-inferrable-types": "error",
|
||||||
"@typescript-eslint/no-for-in-array": "error",
|
"@typescript-eslint/no-misused-new": "error",
|
||||||
"@typescript-eslint/no-inferrable-types": "error",
|
"@typescript-eslint/no-namespace": "error",
|
||||||
"@typescript-eslint/no-misused-new": "error",
|
"@typescript-eslint/no-non-null-assertion": "warn",
|
||||||
"@typescript-eslint/no-namespace": "error",
|
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
||||||
"@typescript-eslint/no-non-null-assertion": "warn",
|
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
||||||
"@typescript-eslint/no-object-literal-type-assertion": "error",
|
"@typescript-eslint/no-useless-constructor": "error",
|
||||||
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
"@typescript-eslint/no-var-requires": "error",
|
||||||
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
"@typescript-eslint/prefer-for-of": "warn",
|
||||||
"@typescript-eslint/no-useless-constructor": "error",
|
"@typescript-eslint/prefer-function-type": "warn",
|
||||||
"@typescript-eslint/no-var-requires": "error",
|
"@typescript-eslint/prefer-includes": "error",
|
||||||
"@typescript-eslint/prefer-for-of": "warn",
|
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
||||||
"@typescript-eslint/prefer-function-type": "warn",
|
"@typescript-eslint/promise-function-async": "error",
|
||||||
"@typescript-eslint/prefer-includes": "error",
|
"@typescript-eslint/require-array-sort-compare": "error",
|
||||||
"@typescript-eslint/prefer-interface": "error",
|
"@typescript-eslint/restrict-plus-operands": "error",
|
||||||
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
"semi": "off",
|
||||||
"@typescript-eslint/promise-function-async": "error",
|
"@typescript-eslint/semi": ["error", "never"],
|
||||||
"@typescript-eslint/require-array-sort-compare": "error",
|
"@typescript-eslint/type-annotation-spacing": "error",
|
||||||
"@typescript-eslint/restrict-plus-operands": "error",
|
"@typescript-eslint/unbound-method": "error"
|
||||||
"semi": "off",
|
},
|
||||||
"@typescript-eslint/semi": ["error", "never"],
|
"env": {
|
||||||
"@typescript-eslint/type-annotation-spacing": "error",
|
"node": true,
|
||||||
"@typescript-eslint/unbound-method": "error",
|
"es6": true,
|
||||||
"no-console": "off"
|
"jest/globals": true
|
||||||
},
|
}
|
||||||
"env": {
|
}
|
||||||
"node": true,
|
|
||||||
"es6": true,
|
|
||||||
"jest/globals": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
19
.github/android-lint-file-matcher.json
vendored
19
.github/android-lint-file-matcher.json
vendored
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
// Example:
|
|
||||||
// /path/to/file/file.class: Warning: checkClientTrusted is empty, which could cause insecure network traffic due to trusting arbitrary TLS/SSL certificates presented by peers [TrustAllX509TrustManager]
|
|
||||||
"problemMatcher": [
|
|
||||||
{
|
|
||||||
"owner": "android-lint-file",
|
|
||||||
"pattern": [
|
|
||||||
{
|
|
||||||
"regexp": "^(.+):\\s+(Warning|Error):\\s+(.+)\\s+\\[(.+)\\]$",
|
|
||||||
"file": 1,
|
|
||||||
"severity": 2,
|
|
||||||
"message": 3,
|
|
||||||
"code": 4,
|
|
||||||
"kind": "file"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
19
.github/android-lint-line-matcher.json
vendored
19
.github/android-lint-line-matcher.json
vendored
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
// Example:
|
|
||||||
// /path/to/file/build.gradle:55: Warning: A newer version of androidx.core:core-ktx than 1.2.0-beta01 is available: 1.2.0-rc01 [GradleDependency]
|
|
||||||
"problemMatcher": [
|
|
||||||
{
|
|
||||||
"owner": "android-lint-line",
|
|
||||||
"pattern": [
|
|
||||||
{
|
|
||||||
"regexp": "^(.+):(\\d+):\\s+(Warning|Error):\\s+(.+)\\s+\\[(.+)\\]$",
|
|
||||||
"file": 1,
|
|
||||||
"line": 2,
|
|
||||||
"severity": 3,
|
|
||||||
"message": 4,
|
|
||||||
"code": 5
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
23
.github/gradle-matcher.json
vendored
23
.github/gradle-matcher.json
vendored
@@ -1,23 +0,0 @@
|
|||||||
{
|
|
||||||
// Example:
|
|
||||||
// warning unused-exclude-by-conf the exclude dependency is not in your dependency graph, so has no effect
|
|
||||||
// app/build.gradle:45
|
|
||||||
"problemMatcher": [
|
|
||||||
{
|
|
||||||
"owner": "gradle",
|
|
||||||
"pattern": [
|
|
||||||
{
|
|
||||||
"regexp": "^(error|quiet|warning|lifecycle|info|debug)\\s+(\\S+)\\s+(.+)$",
|
|
||||||
"severity": 1,
|
|
||||||
"code": 2,
|
|
||||||
"message": 3
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"regexp": "^([^\\s]+):([\\d]+)$",
|
|
||||||
"file": 1,
|
|
||||||
"line": 2
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
19
.github/kotlin-error-matcher.json
vendored
19
.github/kotlin-error-matcher.json
vendored
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
// Example:
|
|
||||||
// e: /path/to/file/KotlinFile.kt: (14, 5): Val cannot be reassigned
|
|
||||||
"problemMatcher": [
|
|
||||||
{
|
|
||||||
"owner": "kotlin-error",
|
|
||||||
"pattern": [
|
|
||||||
{
|
|
||||||
"regexp": "^e:\\s+(\\S+):\\s+\\((\\d+),\\s+(\\d+)\\):\\s+(.+)$",
|
|
||||||
"file": 1,
|
|
||||||
"line": 2,
|
|
||||||
"column": 3,
|
|
||||||
"message": 4
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"severity": "error"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
19
.github/kotlin-warning-matcher.json
vendored
19
.github/kotlin-warning-matcher.json
vendored
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
// Example:
|
|
||||||
// w: /path/to/file/KotlinFile.kt: (14, 5): Parameter 'foo' is never used
|
|
||||||
"problemMatcher": [
|
|
||||||
{
|
|
||||||
"owner": "kotlin-warning",
|
|
||||||
"pattern": [
|
|
||||||
{
|
|
||||||
"regexp": "^w:\\s+(\\S+):\\s+\\((\\d+),\\s+(\\d+)\\):\\s+(.+)$",
|
|
||||||
"file": 1,
|
|
||||||
"line": 2,
|
|
||||||
"column": 3,
|
|
||||||
"message": 4
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"severity": "warning"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
51
.github/workflows/build-test.yml
vendored
51
.github/workflows/build-test.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: build-test
|
name: Build & Test
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -6,29 +6,64 @@ on:
|
|||||||
- '**.md'
|
- '**.md'
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- main
|
||||||
- releases/*
|
- releases/*
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '**.md'
|
- '**.md'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Setup node 12
|
- name: Setup node 12
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v2.1.1
|
||||||
with:
|
with:
|
||||||
node-version: 12.x
|
node-version: '12'
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
|
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
|
|
||||||
|
format-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup node 12
|
||||||
|
uses: actions/setup-node@v2.1.1
|
||||||
|
with:
|
||||||
|
node-version: '12'
|
||||||
|
|
||||||
|
- run: npm ci
|
||||||
|
|
||||||
- run: npm run format-check
|
- run: npm run format-check
|
||||||
|
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup node 12
|
||||||
|
uses: actions/setup-node@v2.1.1
|
||||||
|
with:
|
||||||
|
node-version: '12'
|
||||||
|
|
||||||
|
- run: npm ci
|
||||||
|
|
||||||
- run: npm test
|
- run: npm test
|
||||||
|
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup node 12
|
||||||
|
uses: actions/setup-node@v2.1.1
|
||||||
|
with:
|
||||||
|
node-version: '12'
|
||||||
|
|
||||||
|
- run: npm ci
|
||||||
|
|
||||||
|
- run: npm run lint
|
||||||
|
|||||||
@@ -1,47 +1,49 @@
|
|||||||
name: run-test
|
name: Run Android build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
paths-ignore:
|
paths:
|
||||||
- '**.md'
|
- 'dist/**.js'
|
||||||
push:
|
- '.github/*.json'
|
||||||
branches:
|
push:
|
||||||
- master
|
branches:
|
||||||
- releases/*
|
- main
|
||||||
paths-ignore:
|
- releases/*
|
||||||
- '**.md'
|
paths:
|
||||||
|
- 'dist/**.js'
|
||||||
jobs:
|
- '.github/*.json'
|
||||||
build:
|
|
||||||
runs-on: ${{ matrix.os }}
|
jobs:
|
||||||
strategy:
|
build:
|
||||||
matrix:
|
runs-on: ${{ matrix.os }}
|
||||||
os:
|
strategy:
|
||||||
- ubuntu-latest
|
matrix:
|
||||||
- windows-latest
|
os:
|
||||||
- macos-latest
|
- ubuntu-latest
|
||||||
steps:
|
- windows-latest
|
||||||
- uses: actions/checkout@v2
|
- macos-latest
|
||||||
with:
|
steps:
|
||||||
repository: daveol/SampleApplication
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
- uses: actions/checkout@v2
|
repository: daveol/SampleApplication
|
||||||
with:
|
|
||||||
path: ./build/
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
- name: Set up JDK 1.8
|
path: ./build/
|
||||||
uses: actions/setup-java@v1
|
|
||||||
with:
|
- name: Set up JDK 1.8
|
||||||
java-version: 1.8
|
uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
- name: Setup Android SDK
|
java-version: 1.8
|
||||||
id: 'setup-android'
|
|
||||||
uses: ./build/
|
- name: Setup Android SDK
|
||||||
|
id: 'setup-android'
|
||||||
- name: Build SampleApplication
|
uses: ./build/
|
||||||
if: runner.os != 'windows'
|
|
||||||
run: ./gradlew --no-daemon build
|
- name: Build SampleApplication
|
||||||
|
if: runner.os != 'windows'
|
||||||
- name: Build SampleApplication (Windows)
|
run: ./gradlew --no-daemon build
|
||||||
if: runner.os == 'windows'
|
|
||||||
run: .\gradlew.bat --no-daemon build
|
- name: Build SampleApplication (Windows)
|
||||||
|
if: runner.os == 'windows'
|
||||||
|
run: .\gradlew.bat --no-daemon build
|
||||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 Dave Olsthoorn
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
30
README.md
30
README.md
@@ -1,7 +1,33 @@
|
|||||||
# setup-android
|
# setup-android
|
||||||
For setting up the android sdk in a github-action
|
|
||||||
|
|
||||||
<!-- TODO: write readme -->
|

|
||||||
|
|
||||||
|
This action sets up the Android SDK tools by:
|
||||||
|
- Downloading the SDK commandline tools
|
||||||
|
- Accepting the SDK licenses
|
||||||
|
|
||||||
|
|
||||||
|
# Usage
|
||||||
|
|
||||||
|
See [action.yml](action.yml)
|
||||||
|
|
||||||
|
## Basic
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up JDK 1.8
|
||||||
|
uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 1.8
|
||||||
|
|
||||||
|
- name: Setup Android SDK
|
||||||
|
uses: android-actions/setup-android@v1
|
||||||
|
|
||||||
|
- name: Build SampleApplication
|
||||||
|
run: ./gradlew --no-daemon build
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
# Thanks
|
# Thanks
|
||||||
Based on the project [android-problem-matchers-action](https://github.com/jonasb/android-problem-matchers-action) from [@jonasb](https://github.com/jonasb)
|
Based on the project [android-problem-matchers-action](https://github.com/jonasb/android-problem-matchers-action) from [@jonasb](https://github.com/jonasb)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
describe('setup-android', () => {
|
describe('setup-android', () => {
|
||||||
it('has sanity', async () => {
|
it('has sanity', async () => {
|
||||||
expect(true)
|
expect(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,9 +4,7 @@ description: 'Setup the Android SDK Tools and add them to the path'
|
|||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
main: 'dist/main/index.js'
|
main: 'dist/index.js'
|
||||||
post: 'dist/post/index.js'
|
|
||||||
post-if: success()
|
|
||||||
|
|
||||||
branding:
|
branding:
|
||||||
icon: 'list'
|
icon: 'list'
|
||||||
|
|||||||
1
dist/index.js
vendored
Normal file
1
dist/index.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
dist/main/index.js
vendored
1
dist/main/index.js
vendored
File diff suppressed because one or more lines are too long
1
dist/post/index.js
vendored
1
dist/post/index.js
vendored
File diff suppressed because one or more lines are too long
72
matchers.json
Normal file
72
matchers.json
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
{
|
||||||
|
"problemMatcher": [
|
||||||
|
{
|
||||||
|
"owner": "android-lint-file",
|
||||||
|
"pattern": [
|
||||||
|
{
|
||||||
|
"regexp": "^(.+):\\s+(Warning|Error):\\s+(.+)\\s+\\[(.+)\\]$",
|
||||||
|
"file": 1,
|
||||||
|
"severity": 2,
|
||||||
|
"message": 3,
|
||||||
|
"code": 4,
|
||||||
|
"kind": "file"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"owner": "android-lint-line",
|
||||||
|
"pattern": [
|
||||||
|
{
|
||||||
|
"regexp": "^(.+):(\\d+):\\s+(Warning|Error):\\s+(.+)\\s+\\[(.+)\\]$",
|
||||||
|
"file": 1,
|
||||||
|
"line": 2,
|
||||||
|
"severity": 3,
|
||||||
|
"message": 4,
|
||||||
|
"code": 5
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"owner": "gradle",
|
||||||
|
"pattern": [
|
||||||
|
{
|
||||||
|
"regexp": "^(error|quiet|warning|lifecycle|info|debug)\\s+(\\S+)\\s+(.+)$",
|
||||||
|
"severity": 1,
|
||||||
|
"code": 2,
|
||||||
|
"message": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"regexp": "^([^\\s]+):([\\d]+)$",
|
||||||
|
"file": 1,
|
||||||
|
"line": 2
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"owner": "kotlin-error",
|
||||||
|
"pattern": [
|
||||||
|
{
|
||||||
|
"regexp": "^e:\\s+(\\S+):\\s+\\((\\d+),\\s+(\\d+)\\):\\s+(.+)$",
|
||||||
|
"file": 1,
|
||||||
|
"line": 2,
|
||||||
|
"column": 3,
|
||||||
|
"message": 4
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"severity": "error"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"owner": "kotlin-warning",
|
||||||
|
"pattern": [
|
||||||
|
{
|
||||||
|
"regexp": "^w:\\s+(\\S+):\\s+\\((\\d+),\\s+(\\d+)\\):\\s+(.+)$",
|
||||||
|
"file": 1,
|
||||||
|
"line": 2,
|
||||||
|
"column": 3,
|
||||||
|
"message": 4
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"severity": "warning"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
3684
package-lock.json
generated
3684
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
30
package.json
30
package.json
@@ -5,10 +5,10 @@
|
|||||||
"description": "setup android action",
|
"description": "setup android action",
|
||||||
"main": "lib/main.js",
|
"main": "lib/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "ncc build src/main.ts --out dist/main --minify && ncc build src/post.ts --out dist/post --minify",
|
"build": "ncc build src/main.ts --out dist/ --minify",
|
||||||
"format": "prettier --write **/*.ts",
|
"format": "prettier --write **/*.ts",
|
||||||
"format-check": "prettier --check **/*.ts",
|
"format-check": "prettier --check **/*.ts",
|
||||||
"lint": "eslint src/**/*.ts",
|
"lint": "eslint src/*.ts",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"all": "npm run format && npm run lint && npm run build && npm test"
|
"all": "npm run format && npm run lint && npm run build && npm test"
|
||||||
},
|
},
|
||||||
@@ -25,25 +25,23 @@
|
|||||||
"author": "daveol",
|
"author": "daveol",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^1.0.1",
|
"@actions/cache": "^1.0.2",
|
||||||
"@actions/core": "^1.2.0",
|
"@actions/core": "^1.2.0",
|
||||||
"@actions/tool-cache": "^1.5.5",
|
"@actions/tool-cache": "^1.6.0"
|
||||||
"axios": "^0.19.2",
|
|
||||||
"xml-js": "^1.6.11"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^24.0.23",
|
"@types/jest": "^26.0.10",
|
||||||
"@types/node": "^12.7.12",
|
"@types/node": "^14.6.0",
|
||||||
"@typescript-eslint/parser": "^2.8.0",
|
"@typescript-eslint/parser": "^3.9.1",
|
||||||
"@zeit/ncc": "^0.20.5",
|
"@zeit/ncc": "^0.22.3",
|
||||||
"eslint": "^5.16.0",
|
"eslint": "^7.7.0",
|
||||||
"eslint-plugin-github": "^2.0.0",
|
"eslint-plugin-github": "^4.1.1",
|
||||||
"eslint-plugin-jest": "^22.21.0",
|
"eslint-plugin-jest": "^23.20.0",
|
||||||
"jest": "^24.9.0",
|
"jest": "^24.9.0",
|
||||||
"jest-circus": "^24.9.0",
|
"jest-circus": "^26.4.0",
|
||||||
"js-yaml": "^3.13.1",
|
"js-yaml": "^3.13.1",
|
||||||
"prettier": "^1.19.1",
|
"prettier": "^2.0.5",
|
||||||
"ts-jest": "^24.2.0",
|
"ts-jest": "^24.2.0",
|
||||||
"typescript": "^3.6.4"
|
"typescript": "^3.9.7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
189
src/cache.ts
189
src/cache.ts
@@ -1,189 +0,0 @@
|
|||||||
import * as glob from '@actions/glob'
|
|
||||||
import * as cache from '@actions/cache'
|
|
||||||
import * as core from '@actions/core'
|
|
||||||
import * as crypto from 'crypto'
|
|
||||||
import * as fs from 'fs'
|
|
||||||
import {platform} from 'os'
|
|
||||||
import {
|
|
||||||
GRADLE_WRAPPER_GLOB,
|
|
||||||
GRADLE_CACHE_GLOB,
|
|
||||||
GRADLE_WRAPPER_DIR,
|
|
||||||
GRADLE_CACHE_DIR,
|
|
||||||
GRADLE_WRAPPER_KEY,
|
|
||||||
GRADLE_CACHE_KEY,
|
|
||||||
ANDROID_GLOB,
|
|
||||||
ANDROID_KEY,
|
|
||||||
COMMANDLINE_TOOLS_VERSION,
|
|
||||||
ANDROID_SDK_ROOT,
|
|
||||||
ANDROID_REPOSITORIES_CACHE,
|
|
||||||
ANDROID_REPOSITORIES_CFG,
|
|
||||||
VERSION
|
|
||||||
} from './constants'
|
|
||||||
|
|
||||||
async function hashFiles(globs: string[]): Promise<string | undefined> {
|
|
||||||
const globber = await glob.create(globs.join('\n'), {
|
|
||||||
followSymbolicLinks: false
|
|
||||||
})
|
|
||||||
const hashes: Buffer[] = []
|
|
||||||
|
|
||||||
for await (const file of globber.globGenerator()) {
|
|
||||||
// skip directories
|
|
||||||
if (fs.statSync(file).isDirectory()) continue
|
|
||||||
|
|
||||||
core.debug(`hashFiles: found ${file}`)
|
|
||||||
const hash = crypto.createHash('sha256')
|
|
||||||
fs.createReadStream(file).pipe(hash)
|
|
||||||
hashes.push(hash.digest())
|
|
||||||
}
|
|
||||||
|
|
||||||
// No files hashed
|
|
||||||
if (hashes.length === 0) {
|
|
||||||
core.debug('hashFiles: no hashes in array')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Loop trough files
|
|
||||||
const completeHash = crypto.createHash('sha256')
|
|
||||||
for (const hash of hashes) {
|
|
||||||
completeHash.update(hash)
|
|
||||||
}
|
|
||||||
completeHash.end()
|
|
||||||
return completeHash.digest('hex')
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function preGradleWrapper(): Promise<void> {
|
|
||||||
const wrapperHash = await hashFiles(GRADLE_WRAPPER_GLOB)
|
|
||||||
const wrapperKey = `gradle-wrapper-${platform}-${wrapperHash}`
|
|
||||||
const wrapperRestoreKeys = [`gradle-wrapper-${platform}-`, `gradle-wrapper-`]
|
|
||||||
|
|
||||||
// if no wrapper is present skip trying to retrieve it
|
|
||||||
if (!wrapperHash) {
|
|
||||||
core.info('A hash for the gradle wrapper could not be generated')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const wrapperCache = await cache.restoreCache(
|
|
||||||
[GRADLE_WRAPPER_DIR],
|
|
||||||
wrapperKey,
|
|
||||||
wrapperRestoreKeys
|
|
||||||
)
|
|
||||||
|
|
||||||
if (!wrapperCache) {
|
|
||||||
core.info(
|
|
||||||
'Gradle wrapper cache not found, expect a download from gradle wrapper.'
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wrapperCache !== wrapperKey) {
|
|
||||||
core.saveState(GRADLE_WRAPPER_KEY, wrapperKey)
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function postGradleWrapper(): Promise<void> {
|
|
||||||
const wrapperKey = core.getState(GRADLE_WRAPPER_KEY)
|
|
||||||
|
|
||||||
if (wrapperKey === '') {
|
|
||||||
core.info(
|
|
||||||
'A key for gradle wrapper was not defined, and thus there will not be a cache'
|
|
||||||
)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
await cache.saveCache([GRADLE_WRAPPER_DIR], wrapperKey)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function preGradleCache(): Promise<void> {
|
|
||||||
const cacheHash = await hashFiles(GRADLE_CACHE_GLOB)
|
|
||||||
const cacheKey = `gradle-cache-${platform}-${cacheHash}`
|
|
||||||
const cacheRestoreKeys = [`gradle-cache-${platform}-`, `gradle-cache-`]
|
|
||||||
|
|
||||||
if (!cacheHash) {
|
|
||||||
core.info('A hash for the gradle dependencies could not be generated')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const cacheCache = await cache.restoreCache(
|
|
||||||
[GRADLE_CACHE_DIR],
|
|
||||||
cacheKey,
|
|
||||||
cacheRestoreKeys
|
|
||||||
)
|
|
||||||
|
|
||||||
if (!cacheCache) {
|
|
||||||
core.info('Gradle cache not found, expect dependency downloads from gradle')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cacheCache !== cacheKey) {
|
|
||||||
core.saveState(GRADLE_CACHE_KEY, cacheKey)
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function postGradleCache(): Promise<void> {
|
|
||||||
const cacheKey = core.getState(GRADLE_CACHE_KEY)
|
|
||||||
|
|
||||||
if (cacheKey === '') {
|
|
||||||
core.info(
|
|
||||||
'A key for gradle cache was not defined, and thus there will not be a cache'
|
|
||||||
)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
await cache.saveCache([GRADLE_CACHE_DIR], cacheKey)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function preAndroidCache(): Promise<void> {
|
|
||||||
const androidHash = await hashFiles(ANDROID_GLOB)
|
|
||||||
const androidKey = `android-${VERSION}-${platform}-${COMMANDLINE_TOOLS_VERSION}-${androidHash}`
|
|
||||||
const androidRestoreKeys = [
|
|
||||||
`android-${VERSION}-${platform}-${COMMANDLINE_TOOLS_VERSION}-`,
|
|
||||||
`android-${VERSION}-${platform}-`
|
|
||||||
]
|
|
||||||
|
|
||||||
if (!androidHash) {
|
|
||||||
core.info('A hash for the android sdk could not be generated')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const androidCache = await cache.restoreCache(
|
|
||||||
[ANDROID_SDK_ROOT, ANDROID_REPOSITORIES_CACHE, ANDROID_REPOSITORIES_CFG],
|
|
||||||
androidKey,
|
|
||||||
androidRestoreKeys
|
|
||||||
)
|
|
||||||
|
|
||||||
if (!androidCache) {
|
|
||||||
core.info(
|
|
||||||
'Android cache not found, expect dependency downloads from gradle'
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (androidCache !== androidKey) {
|
|
||||||
core.saveState(ANDROID_KEY, androidKey)
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function postAndroidCache(): Promise<void> {
|
|
||||||
const androidKey = core.getState(ANDROID_KEY)
|
|
||||||
|
|
||||||
if (androidKey === '') {
|
|
||||||
core.info(
|
|
||||||
'A key for the android sdk was not defined, and thus there will not be a cache'
|
|
||||||
)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
await cache.saveCache(
|
|
||||||
[ANDROID_SDK_ROOT, ANDROID_REPOSITORIES_CACHE, ANDROID_REPOSITORIES_CFG],
|
|
||||||
androidKey
|
|
||||||
)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
import * as os from 'os'
|
|
||||||
import * as path from 'path'
|
|
||||||
|
|
||||||
export const ANNOTATION_MATCHERS = [
|
|
||||||
'android-lint-file-matcher.json',
|
|
||||||
'android-lint-line-matcher.json',
|
|
||||||
'gradle-matcher.json',
|
|
||||||
'kotlin-error-matcher.json',
|
|
||||||
'kotlin-warning-matcher.json'
|
|
||||||
]
|
|
||||||
|
|
||||||
export const HOME = os.homedir()
|
|
||||||
|
|
||||||
export const VERSION = 'v1'
|
|
||||||
|
|
||||||
// Gradle constants
|
|
||||||
// For caching the gradle cache in ~/.gradle/cache
|
|
||||||
export const GRADLE_CACHE_GLOB = [
|
|
||||||
'**/*.gradle',
|
|
||||||
'**.gradle',
|
|
||||||
'**/gradle.properties'
|
|
||||||
]
|
|
||||||
export const GRADLE_CACHE_DIR = path.join(HOME, '.gradle', 'cache')
|
|
||||||
export const GRADLE_CACHE_KEY = 'GRADLE_CACHE_KEY'
|
|
||||||
|
|
||||||
// For caching the gradle wrapper in ~/.gradle/wrapper
|
|
||||||
export const GRADLE_WRAPPER_GLOB = ['**/gradle/wrapper/**', '**/gradlew*']
|
|
||||||
export const GRADLE_WRAPPER_DIR = path.join(HOME, '.gradle', 'wrapper')
|
|
||||||
export const GRADLE_WRAPPER_KEY = 'GRADLE_WRAPPER_KEY'
|
|
||||||
|
|
||||||
// Android constants
|
|
||||||
export const ANDROID_SDK_ROOT = path.join(HOME, 'android')
|
|
||||||
export const ANDROID_GLOB = GRADLE_CACHE_GLOB
|
|
||||||
export const ANDROID_KEY = 'ANDROID_KEY'
|
|
||||||
|
|
||||||
export const ANDROID_REPOSITORIES_DIR = path.join(HOME, '.android')
|
|
||||||
export const ANDROID_REPOSITORIES_CFG = path.join(
|
|
||||||
ANDROID_REPOSITORIES_DIR,
|
|
||||||
'repositories.cfg'
|
|
||||||
)
|
|
||||||
export const ANDROID_REPOSITORIES_CACHE = path.join(
|
|
||||||
ANDROID_REPOSITORIES_DIR,
|
|
||||||
'cache'
|
|
||||||
)
|
|
||||||
|
|
||||||
export const COMMANDLINE_TOOLS_VERSION = '6609375'
|
|
||||||
export const COMMANDLINE_TOOLS_WIN_URL = `https://dl.google.com/android/repository/commandlinetools-win-${COMMANDLINE_TOOLS_VERSION}_latest.zip`
|
|
||||||
export const COMMANDLINE_TOOLS_MAC_URL = `https://dl.google.com/android/repository/commandlinetools-mac-${COMMANDLINE_TOOLS_VERSION}_latest.zip`
|
|
||||||
export const COMMANDLINE_TOOLS_LIN_URL = `https://dl.google.com/android/repository/commandlinetools-linux-${COMMANDLINE_TOOLS_VERSION}_latest.zip`
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
import * as fs from 'fs'
|
|
||||||
import * as path from 'path'
|
|
||||||
import * as core from '@actions/core'
|
|
||||||
import * as exec from '@actions/exec'
|
|
||||||
import * as tc from '@actions/tool-cache'
|
|
||||||
import {
|
|
||||||
ANDROID_SDK_ROOT,
|
|
||||||
COMMANDLINE_TOOLS_LIN_URL,
|
|
||||||
COMMANDLINE_TOOLS_MAC_URL,
|
|
||||||
COMMANDLINE_TOOLS_WIN_URL,
|
|
||||||
ANDROID_REPOSITORIES_CFG,
|
|
||||||
ANDROID_REPOSITORIES_DIR
|
|
||||||
} from './constants'
|
|
||||||
|
|
||||||
export async function install(): Promise<void> {
|
|
||||||
const licenseDir = path.join(ANDROID_SDK_ROOT, 'licenses')
|
|
||||||
|
|
||||||
// If the licences exist, the rest does too
|
|
||||||
if (fs.existsSync(licenseDir) && fs.existsSync(ANDROID_REPOSITORIES_CFG)) {
|
|
||||||
core.debug(`Skipping install, licenseDir found: ${licenseDir}`)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// create ~/.android/repositories.cfg
|
|
||||||
fs.mkdirSync(ANDROID_REPOSITORIES_DIR, {recursive: true})
|
|
||||||
fs.closeSync(fs.openSync(ANDROID_REPOSITORIES_CFG, 'w'))
|
|
||||||
|
|
||||||
const acceptBuffer = Buffer.from(
|
|
||||||
Array(10)
|
|
||||||
.fill('y')
|
|
||||||
.join('\n'),
|
|
||||||
'utf8'
|
|
||||||
)
|
|
||||||
let sdkManager = ''
|
|
||||||
|
|
||||||
if (process.platform === 'linux') {
|
|
||||||
const cmdlineToolsZip = await tc.downloadTool(COMMANDLINE_TOOLS_LIN_URL)
|
|
||||||
const cmdlineTools = await tc.extractZip(cmdlineToolsZip)
|
|
||||||
sdkManager = path.join(cmdlineTools, 'tools', 'bin', 'sdkmanager')
|
|
||||||
} else if (process.platform === 'darwin') {
|
|
||||||
const cmdlineToolsZip = await tc.downloadTool(COMMANDLINE_TOOLS_MAC_URL)
|
|
||||||
const cmdlineTools = await tc.extractZip(cmdlineToolsZip)
|
|
||||||
sdkManager = path.join(cmdlineTools, 'tools', 'bin', 'sdkmanager')
|
|
||||||
} else if (process.platform === 'win32') {
|
|
||||||
const cmdlineToolsZip = await tc.downloadTool(COMMANDLINE_TOOLS_WIN_URL)
|
|
||||||
const cmdlineTools = await tc.extractZip(cmdlineToolsZip)
|
|
||||||
sdkManager = path.join(cmdlineTools, 'tools', 'bin', 'sdkmanager.bat')
|
|
||||||
} else {
|
|
||||||
core.error(`Unsupported platform: ${process.platform}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
await exec.exec(
|
|
||||||
sdkManager,
|
|
||||||
['--licenses', `--sdk_root=${ANDROID_SDK_ROOT}`],
|
|
||||||
{input: acceptBuffer}
|
|
||||||
)
|
|
||||||
|
|
||||||
exec.exec(
|
|
||||||
sdkManager,
|
|
||||||
['--include_obsolete', `--sdk_root=${ANDROID_SDK_ROOT}`, 'tools'],
|
|
||||||
{input: acceptBuffer}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
107
src/main.ts
107
src/main.ts
@@ -1,26 +1,81 @@
|
|||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import * as path from 'path'
|
import * as tc from '@actions/tool-cache'
|
||||||
import {ANDROID_SDK_ROOT, ANNOTATION_MATCHERS} from './constants'
|
import * as exec from '@actions/exec'
|
||||||
import {preGradleCache, preAndroidCache, preGradleWrapper} from './cache'
|
import * as path from 'path'
|
||||||
import {install} from './install'
|
import * as fs from 'fs'
|
||||||
|
import * as os from 'os'
|
||||||
async function run(): Promise<void> {
|
|
||||||
// process all caching but wait for them to all complete
|
const COMMANDLINE_TOOLS_VERSION = '6609375'
|
||||||
await Promise.all([preGradleWrapper(), preGradleCache(), preAndroidCache()])
|
const COMMANDLINE_TOOLS_WIN_URL = `https://dl.google.com/android/repository/commandlinetools-win-${COMMANDLINE_TOOLS_VERSION}_latest.zip`
|
||||||
|
const COMMANDLINE_TOOLS_MAC_URL = `https://dl.google.com/android/repository/commandlinetools-mac-${COMMANDLINE_TOOLS_VERSION}_latest.zip`
|
||||||
await install()
|
const COMMANDLINE_TOOLS_LIN_URL = `https://dl.google.com/android/repository/commandlinetools-linux-${COMMANDLINE_TOOLS_VERSION}_latest.zip`
|
||||||
|
|
||||||
core.exportVariable('ANDROID_HOME', ANDROID_SDK_ROOT)
|
const HOME = os.homedir()
|
||||||
core.exportVariable('ANDROID_SDK_ROOT', ANDROID_SDK_ROOT)
|
const ANDROID_HOME_DIR = path.join(HOME, '.android')
|
||||||
|
const ANDROID_HOME_SDK_DIR = path.join(ANDROID_HOME_DIR, 'sdk')
|
||||||
core.addPath(path.join(ANDROID_SDK_ROOT, 'tools', 'bin'))
|
const ANDROID_REPOSITORIES_CFG = path.join(ANDROID_HOME_DIR, 'repositories.cfg')
|
||||||
core.addPath(path.join(ANDROID_SDK_ROOT, 'platform-tools'))
|
|
||||||
|
async function install(): Promise<string> {
|
||||||
core.debug('add matchers')
|
const ANDROID_SDK_ROOT =
|
||||||
const matchersPath = path.join(__dirname, '..', '..', '.github')
|
process.env['ANDROID_SDK_ROOT'] || ANDROID_HOME_SDK_DIR
|
||||||
for (const matcher of ANNOTATION_MATCHERS) {
|
const licenseDir = path.join(ANDROID_SDK_ROOT, 'licenses')
|
||||||
console.log(`##[add-matcher]${path.join(matchersPath, matcher)}`)
|
|
||||||
}
|
// If the licences exist, the rest does too
|
||||||
}
|
if (fs.existsSync(licenseDir) && fs.existsSync(ANDROID_REPOSITORIES_CFG)) {
|
||||||
|
core.debug(`Skipping install, licenseDir found: ${licenseDir}`)
|
||||||
run()
|
return ANDROID_SDK_ROOT
|
||||||
|
}
|
||||||
|
|
||||||
|
// create ~/.android/repositories.cfg
|
||||||
|
fs.mkdirSync(ANDROID_HOME_SDK_DIR, {recursive: true})
|
||||||
|
fs.closeSync(fs.openSync(ANDROID_REPOSITORIES_CFG, 'w'))
|
||||||
|
|
||||||
|
const acceptBuffer = Buffer.from(Array(10).fill('y').join('\n'), 'utf8')
|
||||||
|
let sdkManager = ''
|
||||||
|
|
||||||
|
if (process.platform === 'linux') {
|
||||||
|
const cmdlineToolsZip = await tc.downloadTool(COMMANDLINE_TOOLS_LIN_URL)
|
||||||
|
const cmdlineTools = await tc.extractZip(cmdlineToolsZip)
|
||||||
|
sdkManager = path.join(cmdlineTools, 'tools', 'bin', 'sdkmanager')
|
||||||
|
} else if (process.platform === 'darwin') {
|
||||||
|
const cmdlineToolsZip = await tc.downloadTool(COMMANDLINE_TOOLS_MAC_URL)
|
||||||
|
const cmdlineTools = await tc.extractZip(cmdlineToolsZip)
|
||||||
|
sdkManager = path.join(cmdlineTools, 'tools', 'bin', 'sdkmanager')
|
||||||
|
} else if (process.platform === 'win32') {
|
||||||
|
const cmdlineToolsZip = await tc.downloadTool(COMMANDLINE_TOOLS_WIN_URL)
|
||||||
|
const cmdlineTools = await tc.extractZip(cmdlineToolsZip)
|
||||||
|
sdkManager = path.join(cmdlineTools, 'tools', 'bin', 'sdkmanager.bat')
|
||||||
|
} else {
|
||||||
|
core.error(`Unsupported platform: ${process.platform}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
await exec.exec(
|
||||||
|
sdkManager,
|
||||||
|
['--licenses', `--sdk_root=${ANDROID_SDK_ROOT}`],
|
||||||
|
{input: acceptBuffer}
|
||||||
|
)
|
||||||
|
|
||||||
|
await exec.exec(
|
||||||
|
sdkManager,
|
||||||
|
['--include_obsolete', `--sdk_root=${ANDROID_SDK_ROOT}`, 'tools'],
|
||||||
|
{input: acceptBuffer}
|
||||||
|
)
|
||||||
|
|
||||||
|
return ANDROID_SDK_ROOT
|
||||||
|
}
|
||||||
|
|
||||||
|
async function run(): Promise<void> {
|
||||||
|
const ANDROID_SDK_ROOT = await install()
|
||||||
|
|
||||||
|
core.exportVariable('ANDROID_HOME', ANDROID_SDK_ROOT)
|
||||||
|
core.exportVariable('ANDROID_SDK_ROOT', ANDROID_SDK_ROOT)
|
||||||
|
|
||||||
|
core.addPath(path.join(ANDROID_SDK_ROOT, 'tools', 'bin'))
|
||||||
|
core.addPath(path.join(ANDROID_SDK_ROOT, 'platform-tools'))
|
||||||
|
|
||||||
|
core.debug('add matchers')
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log(`##[add-matcher]${path.join(__dirname, '..', 'matchers.json')}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
run()
|
||||||
|
|||||||
13
src/post.ts
13
src/post.ts
@@ -1,13 +0,0 @@
|
|||||||
import {postAndroidCache, postGradleCache, postGradleWrapper} from './cache'
|
|
||||||
|
|
||||||
async function run(): Promise<void> {
|
|
||||||
await Promise.all([
|
|
||||||
postGradleCache(),
|
|
||||||
postGradleWrapper(),
|
|
||||||
postAndroidCache()
|
|
||||||
])
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
run()
|
|
||||||
Reference in New Issue
Block a user