2021-06-21 19:54:43 +02:00
|
|
|
name: Rust
|
|
|
|
|
|
|
|
on:
|
2022-04-25 18:40:57 +02:00
|
|
|
schedule:
|
|
|
|
- cron: '0 5 * * MON' # Every Monday at 5:00am
|
2021-06-21 19:54:43 +02:00
|
|
|
push:
|
2022-04-25 18:40:57 +02:00
|
|
|
branches: [ staging, trying ] # For Bors
|
2021-06-21 19:54:43 +02:00
|
|
|
pull_request:
|
|
|
|
|
|
|
|
env:
|
|
|
|
CARGO_TERM_COLOR: always
|
2022-04-21 14:19:39 +02:00
|
|
|
RUSTFLAGS: "-D warnings"
|
2021-06-21 19:54:43 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
tests:
|
2022-04-26 17:36:04 +02:00
|
|
|
name: Tests on ${{ matrix.os }}
|
2021-06-21 19:54:43 +02:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2022-09-08 14:58:06 +02:00
|
|
|
os: [ubuntu-20.04, macos-latest, windows-latest]
|
2021-06-21 19:54:43 +02:00
|
|
|
steps:
|
2022-09-06 16:08:51 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-04-25 18:40:57 +02:00
|
|
|
- name: Run test with Rust nightly
|
|
|
|
if: github.event_name == 'schedule'
|
|
|
|
uses: actions-rs/toolchain@v1
|
2021-06-21 19:54:43 +02:00
|
|
|
with:
|
|
|
|
profile: minimal
|
2022-04-25 18:40:57 +02:00
|
|
|
toolchain: nightly
|
|
|
|
override: true
|
|
|
|
- name: Run test with Rust stable
|
|
|
|
if: github.event_name != 'schedule'
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
toolchain: stable
|
2021-06-21 19:54:43 +02:00
|
|
|
override: true
|
2021-09-07 16:35:16 +03:00
|
|
|
- name: Cache dependencies
|
2022-12-01 10:02:54 +00:00
|
|
|
uses: Swatinem/rust-cache@v2.2.0
|
2021-06-21 19:54:43 +02:00
|
|
|
- name: Run cargo check
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: check
|
2022-11-15 10:25:02 +01:00
|
|
|
args: --workspace --all-targets --release
|
2021-06-21 19:54:43 +02:00
|
|
|
- name: Run cargo test
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: test
|
2022-10-31 18:38:48 +01:00
|
|
|
args: --release --all
|
2021-06-21 19:54:43 +02:00
|
|
|
|
2022-11-04 08:52:54 +09:00
|
|
|
clippy:
|
|
|
|
name: Run Clippy
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
2022-11-24 16:26:48 +01:00
|
|
|
toolchain: stable
|
2022-10-28 22:14:12 +09:00
|
|
|
override: true
|
|
|
|
components: clippy
|
|
|
|
- name: Cache dependencies
|
2022-12-01 10:02:54 +00:00
|
|
|
uses: Swatinem/rust-cache@v2.2.0
|
2022-10-28 22:14:12 +09:00
|
|
|
- name: Run cargo clippy
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: clippy
|
2023-01-31 11:13:47 +01:00
|
|
|
args: -- --allow clippy::uninlined_format_args
|
2022-10-28 22:14:12 +09:00
|
|
|
|
2021-06-21 19:54:43 +02:00
|
|
|
fmt:
|
|
|
|
name: Run Rustfmt
|
2022-09-08 14:58:06 +02:00
|
|
|
runs-on: ubuntu-20.04
|
2021-06-21 19:54:43 +02:00
|
|
|
steps:
|
2022-09-06 16:08:51 +00:00
|
|
|
- uses: actions/checkout@v3
|
2021-06-21 19:54:43 +02:00
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
2022-11-24 16:54:40 +01:00
|
|
|
toolchain: nightly
|
2021-06-21 19:54:43 +02:00
|
|
|
override: true
|
|
|
|
components: rustfmt
|
2021-09-07 16:35:16 +03:00
|
|
|
- name: Cache dependencies
|
2022-12-01 10:02:54 +00:00
|
|
|
uses: Swatinem/rust-cache@v2.2.0
|
2021-06-21 19:54:43 +02:00
|
|
|
- name: Run cargo fmt
|
2021-06-23 10:21:16 +02:00
|
|
|
# Since we never ran the `build.rs` script in the benchmark directory we are missing one auto-generated import file.
|
|
|
|
# Since we want to trigger (and fail) this action as fast as possible, instead of building the benchmark crate
|
|
|
|
# we are going to create an empty file where rustfmt expects it.
|
2021-06-21 19:54:43 +02:00
|
|
|
run: |
|
|
|
|
echo -ne "\n" > benchmarks/benches/datasets_paths.rs
|
|
|
|
cargo fmt --all -- --check
|