Skip to content

Commit dab2b60

Browse files
committed
update workflow
1 parent ce49db1 commit dab2b60

File tree

1 file changed

+31
-12
lines changed

1 file changed

+31
-12
lines changed

.github/workflows/rust.yml

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,25 @@ jobs:
1919

2020
steps:
2121
- uses: actions/checkout@v3
22+
23+
# 新增:检查代码格式
24+
- name: fmt
25+
uses: actions-rs/cargo@v1
26+
with:
27+
command: fmt
28+
# --check 参数让命令在发现未格式化的代码时失败,而不是直接修改文件
29+
args: -- --check
30+
31+
# 新增:运行 Clippy lints
32+
- name: clippy
33+
uses: actions-rs/cargo@v1
34+
with:
35+
command: clippy
36+
# --all-features 确保检查所有特性门控后的代码
37+
# -- -D warnings 将所有 Clippy 警告(warnings)视为错误(Deny),导致 CI 失败
38+
args: --all-features -- -D warnings
39+
40+
# 原有的步骤保持不变
2241
- name: Install tools
2342
uses: actions-rs/cargo@v1
2443
with:
@@ -39,16 +58,16 @@ jobs:
3958
with:
4059
command: package
4160

42-
publish:
43-
runs-on: ubuntu-latest
44-
needs: [build]
45-
if: startsWith(github.ref, 'refs/tags/')
61+
# publish:
62+
# runs-on: ubuntu-latest
63+
# needs: [build]
64+
# if: startsWith(github.ref, 'refs/tags/')
4665

47-
steps:
48-
- uses: actions/checkout@v3
49-
- name: Publish to Crates.io
50-
uses: actions-rs/cargo@v1
51-
with:
52-
command: publish
53-
env:
54-
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
66+
# steps:
67+
# - uses: actions/checkout@v3
68+
# - name: Publish to Crates.io
69+
# uses: actions-rs/cargo@v1
70+
# with:
71+
# command: publish
72+
# env:
73+
# CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

0 commit comments

Comments
 (0)