-
Notifications
You must be signed in to change notification settings - Fork 93
105 lines (86 loc) · 2.76 KB
/
Copy pathci.yml
File metadata and controls
105 lines (86 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: CI
on:
pull_request:
branches:
- main
- v2-stable
push:
branches:
- main
- v2-stable
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
# Enable more efficient cargo builds
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUST_LOG: info
jobs:
# Single job that runs all checks for each feature set
ci:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
feature: [sync, async]
name: CI ${{ matrix.feature }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.95.0
with:
components: rustfmt, clippy
# Use Swatinem's Rust cache for better performance
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.feature }}
cache-on-failure: true
# Cache target directory for each feature set separately
cache-targets: true
# Clean cache if it gets too large
cache-all-crates: true
# Combine format check (run once per matrix to catch issues early)
- name: Check formatting
run: cargo fmt -- --check
# Build with optimizations for faster subsequent steps
- name: Build
run: cargo build --features ${{ matrix.feature }}
# Run clippy before tests to catch issues early
- name: Run clippy
run: cargo clippy --all-targets --features ${{ matrix.feature }} -- -D warnings
# Run tests
- name: Run tests
run: cargo test --features ${{ matrix.feature }}
# Build examples (only if previous steps pass)
- name: Build examples
run: cargo build --examples --features ${{ matrix.feature }}
# Build documentation
- name: Build documentation
run: cargo doc --no-deps --features ${{ matrix.feature }}
# Check that benches compile (if any exist)
- name: Check benches compile
run: cargo check --benches --features ${{ matrix.feature }} || true
# Separate minimal job for basic checks that don't need feature matrix
basic-checks:
runs-on: ubuntu-latest
name: Basic checks
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.95.0
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
key: basic-checks
# Check that Cargo.toml is properly formatted and valid
- name: Check Cargo.toml
run: |
cargo metadata --format-version 1 > /dev/null
# Audit dependencies for security vulnerabilities
- name: Security audit
run: |
cargo install cargo-audit || true
cargo audit || true