ci: 加入自动单元测试、代码检查、发版
This commit is contained in:
43
.github/workflows/check.yaml
vendored
Normal file
43
.github/workflows/check.yaml
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
name: Check
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- "**"
|
||||
|
||||
concurrency:
|
||||
# Allow only one workflow per any non-`main` branch.
|
||||
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'main' && github.sha || 'anysha' }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
CARGO_INCREMENTAL: 0
|
||||
RUST_BACKTRACE: 1
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: Run Clippy and tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- run: rustup toolchain install nightly --profile minimal
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: swatinem/rust-cache@v2
|
||||
with:
|
||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||
|
||||
- name: cargo fmt check
|
||||
run: cargo fmt --check
|
||||
|
||||
- name: cargo clippy
|
||||
run: cargo clippy
|
||||
|
||||
- name: cargo test
|
||||
run: cargo test
|
||||
Reference in New Issue
Block a user