1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# pptx-rs CI 配置
#
# 触发条件:push 到 main/develop + 针对 main/develop 的 PR
# 矩阵:Ubuntu + Windows × Rust stable + 1.75 (MSRV)
# 检查项:rustfmt / clippy / test / doc
#
# 设计说明:
# - clippy 与 test 在同一矩阵下并行跑,确保跨平台 + 跨 Rust 版本兼容
# - doc job 暂不阻断 CI(21 个预先存在的链接警告待 Phase 1 清理)
# - 使用 dtolnay/rust-toolchain(actions-rs 已停止维护)
# - 使用 Swatinem/rust-cache 缓存 ~/.cargo 与 target 目录
name: CI
on:
push:
branches:
pull_request:
branches:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
# CI 环境关闭增量编译:更稳定的错误定位 + 更优的缓存复用
CARGO_INCREMENTAL: 0
jobs:
# ────────────────────────────────────────────────────────
# 1. Rustfmt:代码风格检查(仅 Ubuntu + stable,跨平台无意义)
# ────────────────────────────────────────────────────────
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: cargo fmt --check
run: cargo fmt --all -- --check
# ────────────────────────────────────────────────────────
# 2. Clippy:lint 检查(跨平台 + 跨 Rust 版本)
# ────────────────────────────────────────────────────────
clippy:
name: Clippy (${{ matrix.os }}, rust-${{ matrix.rust }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
rust:
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@${{ matrix.rust }}
with:
components: clippy
- uses: Swatinem/rust-cache@v2
with:
key: clippy-${{ matrix.os }}-${{ matrix.rust }}
- name: cargo clippy
run: cargo clippy --all-targets -- -D warnings
# ────────────────────────────────────────────────────────
# 3. Test:单元测试 + 集成测试 + doctest(跨平台 + 跨 Rust 版本)
# ────────────────────────────────────────────────────────
test:
name: Test (${{ matrix.os }}, rust-${{ matrix.rust }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
rust:
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@${{ matrix.rust }}
- uses: Swatinem/rust-cache@v2
with:
key: test-${{ matrix.os }}-${{ matrix.rust }}
- name: cargo test
run: cargo test --all --no-fail-fast
# ────────────────────────────────────────────────────────
# 4. Doc:文档构建验证(仅 Ubuntu + stable,非阻塞)
# ────────────────────────────────────────────────────────
# 说明:当前存在 9 个预先存在的 intra-doc link 警告,待 Phase 1
# ooxml-core 抽象时统一清理。本 job 仅验证 cargo doc 能成功生成
# 文档,不阻断 CI。
doc:
name: Doc build
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
key: doc-stable
- name: cargo doc
run: cargo doc --no-deps --document-private-items
# ────────────────────────────────────────────────────────
# 5. Build:release 构建冒烟测试(确保 release profile 不报错)
# ────────────────────────────────────────────────────────
build:
name: Release build smoke test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
key: build-release
- name: cargo build --release
run: cargo build --release --all-targets