Skip to content

Commit

Permalink
ci: 👷 新增CI配置,用于GitHub Actions自动测试(测试性提交)
Browse files Browse the repository at this point in the history
  • Loading branch information
ARCJ137442 committed Sep 14, 2024
1 parent 2c73f1c commit ede16be
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CI
# 🔗CI语法参考:https://docs.github.com/zh/actions/writing-workflows/workflow-syntax-for-github-actions
# ! 📌【2024-09-13 23:41:22】不建议在`name`中附带空格:会影响到shields.io中的badge链接

on:
push: # 推送到特定分支
branches:
- main
- dev # ! ❌【2024-09-14 12:23:09】目前禁用:`dev`分支用于快速开发,没必要在推送时触发CI
- 'test**'
label: # 创建标签
types:
- created
pull_request: # 拉取请求

env:
CARGO_TERM_COLOR: always

jobs:
build_and_test:
name: Build and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: Swatinem/rust-cache@v2

- name: setup toolchain
uses: hecrj/setup-rust-action@v1
with:
rust-version: stable

# ! ❌【2024-09-14 15:42:55】暂时不用:该repo部分测试需要外部CIN运行时支持(如Python),尚未兼容各操作系统
# TODO: 🚧【2024-09-14 15:44:08】用类似「平台特定程序包」的方式 兼容远程与其它操作系统(预估难度:长期、复杂)
- name: cargo test
run: cargo test --all-features

- name: rustfmt
run: cargo fmt --all -- --check

- name: clippy
run: cargo clippy --all --all-features --tests -- -D warnings
# 📌【2024-08-25 00:23:12】暂不启用``参数:暂且不对clippy采取过于严格的限制
# 📝【2024-08-25 00:33:21】现在可在Cargo.toml中 允许特定clippy限制(诸如:放宽对文档注释的要求)

0 comments on commit ede16be

Please sign in to comment.