MeiliSearch/.github/workflows/rust.yml

133 lines
3.7 KiB
YAML
Raw Normal View History

2021-02-24 10:31:28 +01:00
name: Rust
2021-03-16 10:26:08 +01:00
on:
2021-05-11 12:18:10 +02:00
workflow_dispatch:
2021-03-16 10:26:08 +01:00
pull_request:
push:
# trying and staging branches are for Bors config
branches:
- trying
- staging
2021-02-24 10:31:28 +01:00
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
2022-05-04 15:20:45 +02:00
RUSTFLAGS: "-D warnings"
2021-02-24 10:31:28 +01:00
jobs:
test-linux:
name: Tests on ubuntu-18.04
runs-on: ubuntu-latest
container:
2022-12-19 18:46:27 +01:00
# 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
2023-01-19 17:25:21 +01:00
args: --locked --release --no-default-features --all
- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
2023-01-19 17:25:21 +01:00
args: --locked --release --all
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
2022-10-06 19:02:29 +02:00
- name: Cache dependencies
uses: Swatinem/rust-cache@v2.2.0
2021-04-27 12:36:36 +02:00
- name: Run cargo check without any default features
uses: actions-rs/cargo@v1
with:
2021-04-29 15:19:48 +02:00
command: build
2023-01-19 17:25:21 +01:00
args: --locked --release --no-default-features --all
- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
2023-01-19 17:25:21 +01:00
args: --locked --release --all
2021-02-24 10:31:28 +01:00
2022-03-16 17:13:49 +01:00
# 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:
2022-12-19 18:46:27 +01:00
# Use ubuntu-18.04 to compile with glibc 2.27, which are the production expectations
image: ubuntu:18.04
2022-03-16 17:13:49 +01:00
steps:
- uses: actions/checkout@v3
- name: Install needed dependencies
run: |
apt-get update && apt-get install -y curl
apt-get install build-essential -y
2022-03-16 17:13:49 +01:00
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
2022-10-06 19:02:29 +02:00
- name: Cache dependencies
uses: Swatinem/rust-cache@v2.2.0
2022-03-16 17:13:49 +01:00
- name: Run tests in debug
uses: actions-rs/cargo@v1
with:
command: test
2023-01-19 17:25:21 +01:00
args: --locked --all
2022-03-16 17:13:49 +01:00
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
2022-10-06 19:02:29 +02:00
- 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
2022-12-08 11:51:13 +01:00
toolchain: nightly
override: true
components: rustfmt
2022-10-06 19:02:29 +02:00
- name: Cache dependencies
uses: Swatinem/rust-cache@v2.2.0
- name: Run cargo fmt
2023-01-17 16:26:03 +01: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.
run: |
echo -ne "\n" > benchmarks/benches/datasets_paths.rs
cargo fmt --all -- --check