name: CI on: push: branches: [main] pull_request: branches: [main] env: CARGO_TERM_COLOR: always jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: submodules: true - uses: dtolnay/rust-toolchain@stable with: components: clippy, rustfmt - uses: Swatinem/rust-cache@v2 # .cargo/config.toml 依赖 sccache(rustc-wrapper)与 mold(-fuse-ld=mold), # 两者均在 Ubuntu 仓库中。CI 同样受益:sccache 配合 rust-cache 命中缓存, # mold 并行链接。 - name: Install sccache and mold run: sudo apt-get update -y && sudo apt-get install -y sccache mold - name: Check formatting run: cargo fmt --all -- --check - name: Clippy run: cargo clippy --all-targets -- -D warnings - name: Build run: cargo build --verbose - name: Test run: cargo test --verbose