mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-12-12 22:46:30 +08:00
76 lines
2.0 KiB
YAML
76 lines
2.0 KiB
YAML
name: Rust
|
|
|
|
on:
|
|
push:
|
|
branches: [ staging, trying ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
tests:
|
|
name: Tests on ${{ matrix.os }} with ${{ matrix.rust }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-18.04, macos-latest, windows-latest]
|
|
rust:
|
|
- stable
|
|
- beta
|
|
- nightly
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Cache dependencies
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo
|
|
./Cargo.lock
|
|
./target
|
|
key: ${{ matrix.os }}-${{ matrix.rust }}-${{ hashFiles('Cargo.toml') }}
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: ${{ matrix.rust }}
|
|
override: true
|
|
- name: Run cargo check
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: check
|
|
args: --all
|
|
- name: Run cargo test
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: test
|
|
args: --release
|
|
|
|
fmt:
|
|
name: Run Rustfmt
|
|
runs-on: ubuntu-18.04
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Cache dependencies
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo
|
|
./Cargo.lock
|
|
./target
|
|
key: ${{ matrix.os }}-${{ matrix.rust}}-${{ hashFiles('Cargo.toml') }}
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: nightly
|
|
override: true
|
|
components: rustfmt
|
|
- name: Run cargo fmt
|
|
# 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.
|
|
run: |
|
|
echo -ne "\n" > benchmarks/benches/datasets_paths.rs
|
|
cargo fmt --all -- --check
|