# Introduction
This repository contains an [Azure DevOps Task](https://docs.microsoft.com/en-us/azure/devops/pipelines/process/tasks?view=azure-devops&tabs=yaml) and a [GitHub Workflow Action](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idsteps). See below usage examples to start using this in your CI.
These are the minimal checks we run on our own PRs for [SwiftKey](https://play.google.com/store/apps/details?id=com.touchtype.swiftkey), however we're happy to accept contributions. See [contributing section](#contributing) below if you would like to expand this action's features.
## Usage examples
- In a Azure DevOps Pipeline
```yml
- task: android-app-size-diff@1
inputs:
baseAppPath: test/assets/test.apk
targetAppPath: test/assets/test.apk
summaryOutputPath: summary.md
displayName: Run APK size comparision
```
- In a GitHub Workflow
```yml
- uses: microsoft/android-app-size-diff@v1
name: Run APK size comparision
with:
baseAppPath: test/assets/test.apk
targetAppPath: test/assets/test.apk
summaryOutputPath: summary.md
```
## Usage API
The API to use the GitHub action or Azure DevOps task is similar
### Inputs
- `baseAppPath`: Path to base apk. This is the app before changes
- required: true
- default: 'base.apk'
- `baseAppLabel`: Label to use for the base app in the report
- required: false
- default: 'Base APK'
- `targetAppPath`: Path to target apk. This is the app after changes
- required: true
- default: 'target.apk'
- `targetAppLabel`: Label to use for the base app in the report
- required: false
- default: 'Target APK'
- `summaryOutputPath`: Output file where comparision summary should be written to
- required: true
- default: 'summary.md'
- `metrics`: A comma seperated list of size metrics to include in the summary. Possible values are `apkSize`, `installSize`, `dexFiles`, `arscFile`, `nativeLibs`
- required: false
- default: 'apkSize, installSize, dexFiles, arscFile, nativeLibs'
- `thresholds`: A comma seperated list of thresholds for each of the metrics in bytes. If this is empty, no thresholding will apply. When this is not empty, the task will fail when any of the given thresholds are crossed
- required: false
- default: ''
- `telemetryEnabled`: Set to `false` to disable telemetry
- required: false
- default: 'true'
# Data Collection
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft's privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
To disable data collection when using this extension, set the `telemetryEnabled` input to `false`
# Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
## Setting up development
Starting by cloning the repository. If your changes are small, feel free to open a PR with changes and the CI will take care of testing that everything still works with your changes. For something more long term or local testing, read on.
### Installations
- Install all global dependencies
```shell
npm install -g typescript
npm install -g ts-node
npm install -g mocha
# Only if you are compiling the GitHub plugin
npm install -g @zeit/ncc
# Only if you are publishing to ADO. Not required for most scenarios
npm install -g tfx-cli
```
- Install all project dependencies
`npm install`
### Running
See `package.json` for full list of npm tasks. The below should be sufficient to get you started
- Build code `npm run build`
- Run ADO plugin locally `npm run adoTask`
- See [ADO Custom Task docs](https://docs.microsoft.com/en-us/azure/devops/extend/develop/add-build-task?view=azure-devops#run-the-task) to understand what variables to set - basically all task inputs
- Run all tests `npm run test`
- Likely a better way to test your changes
- Bundle all plugins `npm run bundle`
没有合适的资源?快使用搜索试试~ 我知道了~
在 CI 中 测量 Android 应用程序大小_typescript _代码_相关文件_下载
共46个文件
ts:19个
yml:8个
json:7个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 142 浏览量
2022-07-11
23:08:33
上传
评论
收藏 892KB ZIP 举报
温馨提示
输入 baseAppPath: 基础 apk 的路径。这是更改前的应用程序 要求:真 默认值:'base.apk' baseAppLabel:用于报告中基本应用程序的标签 必需:假 默认值:“基础 APK” targetAppPath: 目标 apk 的路径。这是更改后的应用程序 要求:真 默认值:'target.apk' targetAppLabel:用于报告中基本应用程序的标签 必需:假 默认值:'目标 APK' summaryOutputPath: 应写入比较摘要的输出文件 要求:真 默认值:'summary.md' metrics:要包含在摘要中的大小指标的逗号分隔列表。可能的值为apkSize, installSize, dexFiles, arscFile,nativeLibs 必需:假 默认值:'apkSize、installSize、dexFiles、arscFile、nativeLibs' thresholds:以逗号分隔的每个指标的阈值列表(以字节为单位)。如果为空,则不应用阈值。 更多详情、使用方法,请下载后阅读README.md文件
资源推荐
资源详情
资源评论
收起资源包目录
android-app-size-diff-main.zip (46个子文件)
android-app-size-diff-main
package.json 2KB
copyFiles.ts 246B
.github
workflows
ci-tests.yml 639B
gh-action-test.yml 656B
test
assets
test.apk 782KB
adoTask
success.ts 687B
_suite.ts 930B
ado-extension.json 1KB
threat_model
azure_devops.png 61KB
github_ci.png 58KB
android_appsize_diff.tm7 611KB
SECURITY.md 3KB
action.yml 1KB
LICENSE 1KB
package-lock.json 135KB
bumpVersion.ts 2KB
src
apkAnalyzer
MetaMfParser.ts 2KB
reporter
MarkdownReporter.ts 1KB
IReporter.ts 189B
model
ComparisionReport.ts 320B
ApkSizeSummary.ts 113B
ComparisionReportGenerator.ts 2KB
CiRunner.ts 7KB
ThresholdChecker.ts 1KB
FilesSizeCalculator.ts 675B
ApkAnalyzer.ts 2KB
assets
appSizeChangesIcon.png 9KB
overview.md 1KB
githubAction
GithubActionRunner.ts 1KB
ado-index.ts 80B
gh-action-index.ts 100B
typings
typings.d.ts 0B
adoTask
adoTaskRunner.ts 1KB
task.json 3KB
tsconfig.json 6KB
.gitignore 121B
.mocharc.json 202B
CODE_OF_CONDUCT.md 453B
dist_gh_action
index.js 227KB
lib.json 3KB
README.md 5KB
azure-devops
ado-task-test.yml 480B
templates
credscan.yml 1KB
component-governance.yml 193B
release.yml 2KB
security-checks.yml 367B
共 46 条
- 1
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9154
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功