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
name: Rust CI
on:
push:
branches:
pull_request:
branches:
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
# Set debuginfo to 0 (none) to minimize memory usage during linking
RUSTFLAGS: "-C debuginfo=0"
jobs:
build_and_test:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --all -- --check
- name: Build Library
# Adding --lib ensures we only build the core library first,
# avoiding the heavy linking of examples.
run: cargo build --lib --verbose
- name: Run tests
# Adding --lib only runs unit tests inside src/.
# If you have a tests/ folder, use --tests instead of --examples.
run: cargo test --lib --tests --verbose
- name: Lint with Clippy
# Again, focus only on the library and tests to save memory
run: cargo clippy --lib --tests -- -D warnings