组件仓库模板 #379
ZCShou
started this conversation in
Code of Conduct
组件仓库模板
#379
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
组件模板说明文档
概述
本文档描述组件的完整目录结构、源码文件职责及标准模板规范,可作为其他 OS 组件的参考模板。
目录结构
配置文件
.github/config.json
组件配置文件,用于 CI/CD 流程读取组件信息:
{ "targets": [ "aarch64-unknown-none-softfloat" ], "rust_components": [ "rust-src", "clippy", "rustfmt" ] }targetsrust_componentsCargo.toml
.cargo/config.toml
rust-toolchain.toml
测试与代码检查
组件通过
scripts/下的脚本调用 axci 统一测试框架。首次运行时自动下载 axci 到scripts/.axci/目录。test.sh — 测试
支持的测试类型:
cargo test在宿主机运行./scripts/test.sh unit--suite axvisor-qemu-aarch64-arceos--suite axvisor-board-phytiumpi-arceos--suite starry-aarch64check.sh — 代码检查
GitHub Workflows
所有 CI 工作流通过调用 axci 的共享工作流实现(push.yml 除外)。
check.yml — 代码检查
触发条件:push 到任意分支(tag 除外)、PR、手动触发
功能:格式检查 (rustfmt)、静态分析 (clippy)、编译检查、文档生成检查
test.yml — 集成测试
触发条件:push 到任意分支(tag 除外)、PR、手动触发
功能:运行单元测试、QEMU / 开发板集成测试
release.yml — 发布
触发条件:push 版本 tag(
v*.*.*或v*.*.*-preview.*)流程:check + test 通过后执行 verify-tag → GitHub Release → crates.io publish
deploy.yml — 文档部署
触发条件:push 稳定版 tag(
v*.*.*,不含-preview.*)功能:生成 API 文档 (rustdoc) 并部署到 GitHub Pages
push.yml — 同步到父仓库
触发条件:push 到 main 分支(此工作流为独立实现,直接复制自 axci,不使用
uses:)功能:从父仓库
scripts/repo/repos.csv定位组件 subtree 路径,执行git subtree pull,创建或更新 PRCI 触发规则总览
v1.0.0v1.0.0-preview.1文档规范
API 文档 (rustdoc) — 必需
源码中使用
///注释生成面向组件使用者的 API 文档:///注释,说明用法、参数、返回值、错误条件//!说明模块职责示例:
设计文档 (mdBook) — 可选
可在
docs/目录使用 mdBook 构建设计文档:README
默认 README.md 为英文版本,同时提供 README_CN.md 中文版。基本模板:
API 文档
贡献
./scripts/check.sh./scripts/test.sh协议
Licensed under the Apache License, Version 2.0.
Beta Was this translation helpful? Give feedback.
All reactions