-
Notifications
You must be signed in to change notification settings - Fork 14
84 lines (78 loc) · 2.49 KB
/
rust.yml
File metadata and controls
84 lines (78 loc) · 2.49 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
name: Rust - Continuous integration
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Set environment
# Setting `RUSTFLAGS` overrides any flags set on .cargo/config.toml, so we need to
# set the target flags instead which are cumulative.
# Track https://github.com/rust-lang/cargo/issues/5376
run: |
target=$(rustc -vV | awk '/^host/ { print $2 }' | tr [:lower:] [:upper:] | tr '-' '_')
echo "CARGO_TARGET_${target}_RUSTFLAGS=$FLAGS" >> $GITHUB_ENV
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
with:
key: lint
- name: Install cargo-workspaces
run: cargo install cargo-workspaces
- name: Check rustfmt
run: cargo fmt --all -- --check
- name: Check clippy
run: cargo ws exec cargo clippy --all-features --all-targets
- name: Check clippy (No features)
run: cargo ws exec cargo clippy --no-default-features --all-targets
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
key: test
- name: Run tests (all features)
run: cargo test --all-features
- name: Run tests (no default features)
run: cargo test --no-default-features
miri:
name: Miri
runs-on: ubuntu-latest
env:
# Catch pointer bugs and invalid memory access.
# Ignore errors from system calls that Miri doesn't support yet.
MIRIFLAGS: -Zmiri-strict-provenance -Zmiri-isolation-error=warn
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@nightly
with:
components: miri, rust-src
- uses: Swatinem/rust-cache@v2
with:
key: miri
- name: Set up Miri
run: cargo +nightly miri setup
- name: Run tests under Miri
run: cargo +nightly miri test -p oscars --all-features
docs:
name: Documentation
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -D warnings
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
key: docs
- name: Generate documentation
run: cargo doc -v --document-private-items --all-features