Repository navigation
105 lines (87 loc) · 2.94 KB
/
Copy pathrust.yml
File metadata and controls
105 lines (87 loc) · 2.94 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: Rust CI
on:
push:
branches: [ main ]
paths-ignore:
- 'docs/**'
- '**/*.md'
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches: [ main ]
paths-ignore:
- 'docs/**'
- '**/*.md'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
# Overrides target-cpu=native from .cargo/config.toml: cached build scripts
# compiled on one runner's CPU die with SIGILL on an older runner.
RUSTFLAGS: -C target-cpu=x86-64
jobs:
format-and-lint:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Read the pinned Rust version
id: rust-version
run: echo "channel=$(sed -n 's/^channel = "\(.*\)"$/\1/p' rust-toolchain.toml)" >> "$GITHUB_OUTPUT"
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.rust-version.outputs.channel }}
components: rustfmt, clippy
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.4
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', 'rust-toolchain.toml') }}
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
env:
RUSTC_WRAPPER: sccache
test:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Read the pinned Rust version
id: rust-version
run: echo "channel=$(sed -n 's/^channel = "\(.*\)"$/\1/p' rust-toolchain.toml)" >> "$GITHUB_OUTPUT"
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.rust-version.outputs.channel }}
components: clippy
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.4
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml', 'rust-toolchain.toml') }}
- name: Run all workspace tests
run: cargo test --workspace --locked
env:
RUSTC_WRAPPER: sccache
- name: Run system-bench tests with planeval
run: cargo test -p system-bench --features planeval --locked
env:
RUSTC_WRAPPER: sccache
- name: Lint system-bench without default features
run: cargo clippy -p system-bench --no-default-features --all-targets --locked -- -D warnings
env:
RUSTC_WRAPPER: sccache