-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathci-rust.yml
More file actions
81 lines (68 loc) · 1.98 KB
/
ci-rust.yml
File metadata and controls
81 lines (68 loc) · 1.98 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
name: CI (Rust)
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -Dwarnings
jobs:
build:
name: Build & Test (${{ matrix.toolchain }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
toolchain: [stable, nightly]
# Add MSRV (Minimum Supported Rust Version) if needed:
# toolchain: [stable, nightly, '1.70']
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: rustfmt, clippy
- name: Cache cargo registry and build
uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --all-targets --all-features
- name: Build
run: cargo build --all-features
- name: Run tests
run: cargo test --all-features
# Run documentation tests
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Check documentation
run: cargo doc --no-deps --all-features
env:
RUSTDOCFLAGS: -Dwarnings
# Optional: Upload coverage to Codecov
# coverage:
# name: Coverage
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: dtolnay/rust-toolchain@stable
# - uses: Swatinem/rust-cache@v2
# - name: Install cargo-tarpaulin
# run: cargo install cargo-tarpaulin
# - name: Generate coverage
# run: cargo tarpaulin --out xml
# - uses: codecov/codecov-action@v4
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# fail_ci_if_error: false