mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-24 21:50:07 +01:00
128 lines
3.3 KiB
YAML
128 lines
3.3 KiB
YAML
name: Rust
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
push:
|
|
# trying and staging branches are for Bors config
|
|
branches:
|
|
- trying
|
|
- staging
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
RUST_BACKTRACE: 1
|
|
RUSTFLAGS: "-D warnings"
|
|
|
|
jobs:
|
|
test-linux:
|
|
name: Tests on ubuntu-18.04
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
# Use ubuntu-18.04 to compile with glibc 2.27, which are the production expectations
|
|
image: ubuntu:18.04
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Install needed dependencies
|
|
run: |
|
|
apt-get update && apt-get install -y curl
|
|
apt-get install build-essential -y
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
override: true
|
|
- name: Cache dependencies
|
|
uses: Swatinem/rust-cache@v2.2.0
|
|
- name: Run cargo check without any default features
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: build
|
|
args: --locked --release --no-default-features
|
|
- name: Run cargo test
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: test
|
|
args: --locked --release
|
|
|
|
test-others:
|
|
name: Tests on ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [macos-12, windows-2022]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Cache dependencies
|
|
uses: Swatinem/rust-cache@v2.2.0
|
|
- name: Run cargo check without any default features
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: build
|
|
args: --locked --release --no-default-features
|
|
- name: Run cargo test
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: test
|
|
args: --locked --release
|
|
|
|
# We run tests in debug also, to make sure that the debug_assertions are hit
|
|
test-debug:
|
|
name: Run tests in debug
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
# Use ubuntu-18.04 to compile with glibc 2.27, which are the production expectations
|
|
image: ubuntu:18.04
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Install needed dependencies
|
|
run: |
|
|
apt-get update && apt-get install -y curl
|
|
apt-get install build-essential -y
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
override: true
|
|
- name: Cache dependencies
|
|
uses: Swatinem/rust-cache@v2.2.0
|
|
- name: Run tests in debug
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: test
|
|
args: --locked
|
|
|
|
clippy:
|
|
name: Run Clippy
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
components: clippy
|
|
- name: Cache dependencies
|
|
uses: Swatinem/rust-cache@v2.2.0
|
|
- name: Run cargo clippy
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: clippy
|
|
args: --all-targets -- --deny warnings
|
|
|
|
fmt:
|
|
name: Run Rustfmt
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: nightly
|
|
override: true
|
|
components: rustfmt
|
|
- name: Cache dependencies
|
|
uses: Swatinem/rust-cache@v2.2.0
|
|
- name: Run cargo fmt
|
|
run: cargo fmt --all -- --check
|