meilisearch/.github/workflows/rust.yml

70 lines
1.9 KiB
YAML
Raw Normal View History

2021-06-22 01:54:43 +08:00
name: Rust
on:
schedule:
- cron: '0 5 * * MON' # Every Monday at 5:00am
2021-06-22 01:54:43 +08:00
push:
branches: [ staging, trying ] # For Bors
2021-06-22 01:54:43 +08:00
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
tests:
2022-04-26 23:36:04 +08:00
name: Tests on ${{ matrix.os }}
2021-06-22 01:54:43 +08:00
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
2021-07-07 19:47:25 +08:00
os: [ubuntu-18.04, macos-latest, windows-latest]
2021-06-22 01:54:43 +08:00
steps:
- uses: actions/checkout@v2
- name: Run test with Rust nightly
if: github.event_name == 'schedule'
uses: actions-rs/toolchain@v1
2021-06-22 01:54:43 +08:00
with:
profile: minimal
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-22 01:54:43 +08:00
override: true
- name: Cache dependencies
uses: Swatinem/rust-cache@v1.3.0
2021-06-22 01:54:43 +08:00
- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check
args: --workspace --all-targets
2021-06-22 01:54:43 +08:00
- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
2021-07-07 19:47:25 +08:00
args: --release
2021-06-22 01:54:43 +08:00
fmt:
name: Run Rustfmt
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt
- name: Cache dependencies
uses: Swatinem/rust-cache@v1.3.0
2021-06-22 01:54:43 +08:00
- name: Run cargo fmt
2021-06-23 16:21:16 +08: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-22 01:54:43 +08:00
run: |
echo -ne "\n" > benchmarks/benches/datasets_paths.rs
cargo fmt --all -- --check