| Name | Date | Size | #Lines | LOC | ||
|---|---|---|---|---|---|---|
| .. | - | - | ||||
| ci/ | 06-May-2025 | - | 1,026 | 625 | ||
| compile-tool/ | 06-May-2025 | - | 1,969 | 1,643 | ||
| screenshots/ | 06-May-2025 | - | ||||
| test-tool/ | 06-May-2025 | - | 508 | 400 | ||
| README.md | D | 06-May-2025 | 3.9 KiB | 100 | 74 | |
| deplydoc.md | D | 06-May-2025 | 8.4 KiB | 307 | 211 |
README.md
1# 流水线预测试工具 2 3## 介绍 4 5本示例主要展示了流水线预测试工具的使用示例,主要介绍了自动化构建及测试的实现原理。 6 7## 效果预览 8 9 10 11## 安装教程 12 13按照[部署文档](./deplydoc.md)安装部署项目。 14 15## 使用说明 16 171. 打开浏览器访问127.0.0.1:3000/swagger。 18 192. 在`/sn`下点击`Try it out`,再点击`Execute`,即可获得`/sn`接口返回的连接开发板的sn号。 20 213. 在`/hap-build/{PRId}`下点击`Try it out`,输入想要构建、测试的PRId,再点击`Execute`等待构建、测试任务结束可以看到接口返回构建和测试的结果,同时在PR下方的评论区也会有评论。 22 23## 工程目录 24 25``` 26|-- HapBuild 27| |--ci // PR修改文件处理模块 28| |-- config.dev.ts 29| `-- src 30| |-- app.controller.ts // /sn接口 31| |-- hap-build 32| | |-- hap-build.controller.ts // /hap-build/{PRId}接口 33| | `-- utils 34| | |-- buildListProject.ts // 安装测试应用 35| | |-- checkProjectIfInFull.ts // 判断涉及项目使用SDk类型 36| | |-- editLinuxContains.ts // 修改配置文件 37| | |-- getModifyFileList.ts // 下载PR修改文件 38| | `-- getProjectPath.ts // 获取PR修改项目路径 39| |-- main.ts 40| `-- util 41| `-- index.ts // 发送评论、执行脚本工具函数 42| |--compile-tool // 编译工具 43| |-- bin 44| |-- compile-ohpm-ci.sh // 编译脚本 45| |-- compile-ut-ohpm.sh // 初始化目录结构以及拉取代码脚本 46| |-- init-sdk.sh // 初始化SDK脚本 47| |-- update-sdk.sh // 更新SDK脚本 48| |-- config // 配置文件 49| |-- init_sdk.config 50| |-- samples_master.config 51| |-- ut_samples_master.config 52| |-- ut_samples_master_ohpm.config 53| `-- tool 54| |-- sign-tool // 签名工具 55|-- deplydoc.md // 部署文档 56|-- screenshots // 文档截图 57`-- test-tool 58 |-- CombinationConfig.json // 联合测试应用列表 59 |-- FA_Model_And_Lower_Case_List.json // FA模型应用列表 60 |-- InstallAndTestSpecial_ci.py // 安装测试应用脚本 61 |-- LinuxContains.py // 安装测试配置文件 62 |-- install_list_capability.json // 特殊安装配置文件 63 `-- special_list.json // 特殊安装应用列表 64``` 65 66## 具体实现 67 681. 执行hdc命令`hdc list targets`获取当前连接开发板sn号,[源码参考](./ci/src/app.controller.ts)。 69 702. 使用gitee官方web hook读取PR修改文件列表并将修改写入本地sample仓中,再根据修改文件路径找出对应的项目,使用[编译工具](./compile-tool)中`compile-ohpm-ci.sh`脚本编译项目中的`entry`及`ohostest`包。 71 723. [InstallAndTestSpecial_ci.py](./test-tool//InstallAndTestSpecial_ci.py)脚本来安装entry包、ohosTest测试包以及拉起自动化测试用例。 73 74## 相关权限 75 76不涉及 77 78## 依赖 79 80- Ubuntu22.04.02 LTS 81- Node16及以上 82- Java jdk11 83- Python3 84 85## 约束与限制 86 87本示例需要按照[部署文档](./deplydoc.md)成功搭建环境才可顺利运行。 88 89## 下载 90 91如需单独下载本工程,执行如下命令: 92 93``` 94git init 95git config core.sparsecheckout true 96echo code/Project/HapBuild > .git/info/sparse-checkout 97git remote add origin https://gitee.com/openharmony/applications_app_samples.git 98git pull origin master 99``` 100