|
1 | 1 |
|
| 2 | +name: Lint Rust Code |
| 3 | + |
2 | 4 | on: |
3 | 5 | pull_request: |
4 | 6 | paths: |
5 | | - - crates/** |
6 | | - - docs/source/src/rust/** |
7 | | - - examples/** |
8 | | - - py-polars/src/** |
9 | | - - py-polars/Cargo.toml |
10 | | - - Cargo.toml |
11 | | - - .github/workflows/lint-rust.yml |
| 7 | + - "rust/**/*.rs" |
| 8 | + - "Cargo.toml" |
| 9 | + - "noxfile.py" |
| 10 | + - ".github/workflows/lint-rust.yml" |
12 | 11 | push: |
13 | 12 | branches: |
14 | 13 | - main |
15 | 14 | - master |
16 | 15 | paths: |
17 | | - - crates/** |
18 | | - - docs/source/src/rust/** |
19 | | - - examples/** |
20 | | - - py-polars/src/** |
21 | | - - py-polars/Cargo.toml |
22 | | - - Cargo.toml |
23 | | - - .github/workflows/lint-rust.yml |
24 | | - |
25 | | -concurrency: |
26 | | - group: ${{ github.workflow }}-${{ github.ref }} |
27 | | - cancel-in-progress: true |
| 16 | + - "rust/**/*.rs" |
| 17 | + - "Cargo.toml" |
| 18 | + - "noxfile.py" |
| 19 | + - ".github/workflows/lint-rust.yml" |
28 | 20 |
|
29 | | -env: |
30 | | - RUSTFLAGS: -C debuginfo=0 # Do not produce debug symbols to keep memory usage down |
| 21 | + workflow_dispatch: |
31 | 22 |
|
32 | 23 | jobs: |
33 | | - clippy-nightly: |
| 24 | + lint-rust: |
| 25 | + name: Run Rust Linting Checks |
34 | 26 | runs-on: ubuntu-latest |
35 | | - steps: |
36 | | - - uses: actions/checkout@v4 |
37 | 27 |
|
38 | | - - name: Set up Rust |
39 | | - run: rustup component add clippy |
40 | | - |
41 | | - - name: Cache Rust |
42 | | - uses: Swatinem/rust-cache@v2 |
43 | | - with: |
44 | | - save-if: ${{ github.ref_name == 'main' }} |
45 | | - |
46 | | - - name: Run cargo clippy with all features enabled |
47 | | - run: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings -D clippy::dbg_macro |
48 | | - |
49 | | - # Default feature set should compile on the stable toolchain |
50 | | - clippy-stable: |
51 | | - runs-on: ubuntu-latest |
52 | 28 | steps: |
53 | | - - uses: actions/checkout@v4 |
| 29 | + - name: Checkout code |
| 30 | + uses: actions/checkout@v4 |
54 | 31 |
|
55 | 32 | - name: Set up Rust |
56 | | - run: rustup override set stable && rustup update |
| 33 | + run: | |
| 34 | + rustup component add rustfmt clippy |
57 | 35 |
|
58 | | - - name: Install clippy |
59 | | - run: rustup component add clippy |
| 36 | + - name: Set up uv |
| 37 | + uses: astral-sh/setup-uv@v6 |
60 | 38 |
|
61 | | - - name: Cache Rust |
62 | | - uses: Swatinem/rust-cache@v2 |
| 39 | + - name: Set up Python |
| 40 | + uses: actions/setup-python@v5 |
63 | 41 | with: |
64 | | - save-if: ${{ github.ref_name == 'main' }} |
65 | | - |
66 | | - - name: Run cargo clippy |
67 | | - run: cargo clippy --all-targets --locked -- -D warnings -D clippy::dbg_macro |
68 | | - |
69 | | - rustfmt: |
70 | | - if: github.ref_name != 'main' |
71 | | - runs-on: ubuntu-latest |
72 | | - steps: |
73 | | - - uses: actions/checkout@v4 |
74 | | - |
75 | | - - name: Set up Rust |
76 | | - run: rustup component add rustfmt |
77 | | - |
78 | | - - name: Run cargo fmt |
79 | | - run: cargo fmt --all --check |
80 | | - |
81 | | - miri: |
82 | | - if: github.ref_name != 'main' |
83 | | - runs-on: ubuntu-latest |
84 | | - steps: |
85 | | - - uses: actions/checkout@v4 |
86 | | - |
87 | | - - name: Set up Rust |
88 | | - run: rustup component add miri |
| 42 | + python-version-file: ".github/workflows/.python-version" |
89 | 43 |
|
90 | | - - name: Set up miri |
91 | | - run: cargo miri setup |
| 44 | + - name: Run Rust format check |
| 45 | + run: uvx nox -s format-rust |
92 | 46 |
|
93 | | - - name: Run miri |
94 | | - env: |
95 | | - MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-ignore-leaks -Zmiri-disable-stacked-borrows |
96 | | - POLARS_ALLOW_EXTENSION: '1' |
97 | | - run: > |
98 | | - cargo miri test |
99 | | - --features object |
100 | | - -p polars-core |
101 | | -# -p polars-arrow |
| 47 | + - name: Run Rust lint check |
| 48 | + run: uvx nox -s lint-rust |
0 commit comments