项目文件夹

文件
Olow304 9b7f5a62a1 Fix CI: use Cargo.toml hash for cache key instead of missing Cargo.lock
The previous cache key used hashFiles('**/Cargo.lock') but Cargo.lock is
gitignored in this library repo. This caused the cache to have an empty
hash suffix, restoring stale dependencies that didn't include tantivy,
wide, and other optional deps that were added recently.

Using Cargo.toml hash ensures the cache invalidates when dependencies change.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 10:33:37 -05:00

64 行
1.5 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust: [stable]
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
- name: Cache cargo
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose ${{ runner.os == 'Windows' && '-- --test-threads=1' || '' }}
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install components
run: rustup component add rustfmt clippy
- name: Check formatting
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy -- -D warnings -A clippy::non_std_lazy_statics