Skip to content

Commit

Permalink
ci[rust]: Improve Rust build/test workflows (#4817)
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego committed Sep 11, 2022
1 parent 7d0ba98 commit 26d38f8
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 72 deletions.
Original file line number Diff line number Diff line change
@@ -1,94 +1,120 @@
name: Build and test rust
name: Build and test Rust

on:
pull_request:
paths:
- 'polars/**'
- '.github/workflows/build-test.yaml'
- '.github/workflows/build-test-rust.yaml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
examples:
name: Examples
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
run: rustup update stable
- uses: Swatinem/rust-cache@v1
- name: "check"

- name: Set up Rust
uses: dtolnay/rust-toolchain@stable

- name: Cache Rust
uses: Swatinem/rust-cache@v2

- name: Run cargo check
working-directory: examples
run: cargo check

features:
name: Features
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2022-08-22
- uses: Swatinem/rust-cache@v1

- name: Cache Rust
uses: Swatinem/rust-cache@v2

- name: Install dependencies
run: |
cargo install cargo-hack
- name: Feature test
run: cargo install cargo-hack

- name: Run cargo hack
working-directory: polars
run: cargo hack check --each-feature --no-dev-deps --features private

test-rust:
name: Build and test Rust
lint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: polars

steps:
- uses: actions/checkout@v3

- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2022-08-22
components: rustfmt, clippy, miri
- name: Cache Cargo
uses: actions/cache@v3
with:
# these represent dependencies downloaded by cargo
# and thus do not depend on the OS, arch nor rust version.
path: /github/home/.cargo
key: cargo-cache-
- name: Cache Rust dependencies
uses: actions/cache@v3

- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
# these represent compiled steps of both dependencies and arrow
# and thus are specific for a particular OS, arch and rust version.
path: /github/home/target
key: ubuntu-x86-64-target-cache-nightly
- name: Install dependencies
run: |
rm -f dprint-x86_64-unknown-linux-gnu.zip
- name: Run formatting checks
run: |
cargo fmt --all -- --check
- name: Run linting checks
workspaces: polars

- name: Run rustfmt
run: cargo fmt --all -- --check

- name: Run clippy
env:
RUSTFLAGS: -C debuginfo=0 # Do not produce debug symbols to keep memory usage down
working-directory: polars
run : |
cargo clippy --all-features \
-p polars-core \
-p polars-io \
-p polars-lazy \
-- -D warnings
-p polars-core \
-p polars-io \
-p polars-lazy \
-- -D warnings
cargo clippy -- -D warnings
- name: Run tests
env:
RUSTFLAGS: -C debuginfo=0 # Do not produce debug symbols to keep memory usage down
working-directory: polars
run: make test && make integration-tests
- name: Run miri
working-directory: polars
run: |
cargo miri setup
cargo clean
make miri
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
defaults:
run:
working-directory: polars

steps:
- uses: actions/checkout@v3

- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2022-08-22

- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
workspaces: polars

- name: Run tests
env:
RUSTFLAGS: -C debuginfo=0 # Do not produce debug symbols to keep memory usage down
run: make test

- name: Run integration tests
env:
RUSTFLAGS: -C debuginfo=0 # Do not produce debug symbols to keep memory usage down
run: make integration-tests
27 changes: 0 additions & 27 deletions .github/workflows/test-windows.yaml

This file was deleted.

0 comments on commit 26d38f8

Please sign in to comment.