Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ on:
- main

permissions:
contents: write
contents: read

jobs:
build-rust:
validate:
strategy:
fail-fast: false
matrix:
platform: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{matrix.platform}}
Expand Down Expand Up @@ -45,13 +46,29 @@ jobs:
- name: Lint rust sources
run: cargo clippy --workspace --all-targets --all-features -- -D warnings

- name: Execute rust tests
run: cargo nextest run --all-features --no-tests=pass
- name: Execute rust tests with coverage
run: cargo llvm-cov nextest --all-features --no-tests=pass --lcov --output-path lcov.info
- name: Upload coverage report
if: matrix.platform == 'ubuntu-latest'
uses: codecov/codecov-action@v4
with:
files: lcov.info
fail_ci_if_error: false

release:
if: startsWith(github.ref, 'refs/tags/')
needs: validate
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Generate a changelog
uses: orhun/git-cliff-action@v4
id: git-cliff
if: startsWith(github.ref, 'refs/tags/')
with:
config: cliff.toml
args: -vv --latest --strip header
Expand All @@ -60,6 +77,5 @@ jobs:

- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
body: ${{ steps.git-cliff.outputs.content }}
19 changes: 6 additions & 13 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,11 @@ dependencies = ["add"]

[tasks.cliff]
install_crate = "git-cliff"
command = "git"
args = ["cliff", "-o", "CHANGELOG.md"]
dependencies = ["commit"]
command = "git-cliff"
args = ["-o", "CHANGELOG.md"]

[tasks.release]
dependencies = ["commit", "cliff"]

[tasks.do]
dependencies = [
"format",
"deny",
"typos",
"check",
"clippy",
"test",
"commit",
"cliff"
]
dependencies = ["format", "deny", "typos", "check", "clippy", "test"]
24 changes: 15 additions & 9 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ No boilerplate setup. No repeated configuration. Just focus on building.

### 🔍 Code Quality

* `pre-commit` hooks
* `cargo clippy` + `cargo fmt`
* `typos` spell checking

Expand Down Expand Up @@ -84,7 +83,6 @@ rustup update stable

# for generate
cargo install cargo-generate
pip install pre-commit

# install dependencies
cargo install cargo-deny cargo-cliff typos-cli cargo-make cargo-nextest
Expand All @@ -104,30 +102,37 @@ cargo generate --git https://github.com/lhui-dev/rct --name my-app

```bash
cd my-app
pre-commit install
cargo build
```

### 4. Run full pipeline
### 4. Run validation pipeline

`cargo make do`

Run format → lint → test → commit → changelog in one command
Run format → lint → test in one command

```bash
cargo make release
```

Run commit + changelog separately.

---

## 🧩 Task Pipeline (cargo-make)

Built-in automation powered by cargo-make.

**Run everything**
**Run validation**

```bash
cargo make do

```

**Pipeline:** format → deny → typos → check → clippy → test → commit → cliff
**Pipeline:** format → deny → typos → check → clippy → test

**Release:** commit → changelog

**Run individually**

Expand Down Expand Up @@ -176,7 +181,6 @@ cargo deny check
├── cliff.toml
├── typos.toml
├── Makefile.toml
├── .pre-commit-config.yaml
├── README.en.md
├── README.md
└── LICENSE
Expand All @@ -186,7 +190,9 @@ cargo deny check

## ⚙️ Customization

Supports `cargo-generate.toml` for template variables.
Supports `cargo-generate.toml` for template variables like `description`.

After generating a project, update the repository URL in `cliff.toml` to match your own repository.

---

Expand Down
29 changes: 21 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ rustup update stable

# 项目生成工具
cargo install cargo-generate
pip install pre-commit

# 工程工具链
cargo install cargo-deny cargo-cliff typos-cli cargo-make cargo-nextest
Expand All @@ -102,27 +101,32 @@ cargo generate --git https://github.com/lhui-dev/rct --name my-app

```bash
cd my-app
pre-commit install
cargo build
```

---

### 4. 执行完整流程
### 4. 执行检查流程

```bash
cargo make do
```

一条命令完成:格式化 → 检查 → 测试 → 提交 → 生成 CHANGELOG
一条命令完成:格式化 → 检查 → 测试

```bash
cargo make release
```

单独执行提交和生成 CHANGELOG。

---

## 🧩 任务流水线(cargo-make)

内置基于 `cargo-make` 的自动化任务系统。

### 一键执行
### 一键检查

```bash
cargo make do
Expand All @@ -131,9 +135,17 @@ cargo make do
### 执行流程

```
format → deny → typos → check → clippy → test → commit → cliff
format → deny → typos → check → clippy → test
```

### 发布流程

```bash
cargo make release
```

commit → changelog

### 单独执行任务

```bash
Expand Down Expand Up @@ -183,7 +195,6 @@ cargo deny check
├── cliff.toml
├── typos.toml
├── Makefile.toml
├── .pre-commit-config.yaml
├── README.en.md
├── README.md
└── LICENSE
Expand All @@ -193,7 +204,9 @@ cargo deny check

## ⚙️ 模板自定义

支持通过 `cargo-generate.toml` 定义模板变量,实现初始化时动态替换。
支持通过 `cargo-generate.toml` 定义模板变量,实现初始化时动态替换,例如 `description`。

生成项目后,记得把 `cliff.toml` 里的仓库地址改成你自己的仓库地址。

---

Expand Down
11 changes: 10 additions & 1 deletion cargo-generate.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
[template]
exclude = ["cliff.toml"]
# Copy cliff.toml as-is so git-cliff's own `{{ }}` syntax is not treated as
# a cargo-generate template expression. Users should update the repository URL
# in the generated file after project creation.
exclude = ["cliff.toml"]
ignore = [".idea", "target", "CHANGELOG.md"]

[placeholders.description]
type = "string"
prompt = "What does your project do?"
default = "A Rust project."
2 changes: 1 addition & 1 deletion cliff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ commit_parsers = [
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" },
]
# Prevent commits that are breaking from being excluded by commit parsers.
protect_breaking_commits = false
protect_breaking_commits = true
# Exclude commits that are not matched by any commit parser.
filter_commits = false
# Regex to select git tags that represent releases.
Expand Down
Loading