meilisearch/.github/workflows/rust.yml

93 lines
2.2 KiB
YAML
Raw Normal View History

2021-02-24 17:31:28 +08:00
name: Rust
2021-03-16 17:26:08 +08:00
on:
2021-05-11 18:18:10 +08:00
workflow_dispatch:
2021-03-16 17:26:08 +08:00
pull_request:
push:
# trying and staging branches are for Bors config
branches:
- trying
- staging
2021-02-24 17:31:28 +08:00
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
2022-05-04 21:20:45 +08:00
RUSTFLAGS: "-D warnings"
2021-02-24 17:31:28 +08:00
jobs:
2021-03-16 17:26:08 +08:00
tests:
name: Tests on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-18.04, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v3
2022-10-06 20:03:04 +08:00
# - name: Cache dependencies
# uses: Swatinem/rust-cache@v2.0.0
2021-04-27 18:36:36 +08:00
- name: Run cargo check without any default features
uses: actions-rs/cargo@v1
with:
2021-04-29 21:19:48 +08:00
command: build
args: --locked --release --no-default-features
- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: --locked --release
2021-02-24 17:31:28 +08:00
2022-03-17 00:13:49 +08: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-18.04
2022-03-17 00:13:49 +08:00
steps:
- uses: actions/checkout@v3
2022-03-17 00:13:49 +08:00
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
2022-10-06 20:03:04 +08:00
# - name: Cache dependencies
# uses: Swatinem/rust-cache@v2.0.0
2022-03-17 00:13:49 +08:00
- name: Run tests in debug
uses: actions-rs/cargo@v1
with:
command: test
args: --locked
clippy:
name: Run Clippy
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: clippy
2022-10-06 20:03:04 +08:00
# - name: Cache dependencies
# uses: Swatinem/rust-cache@v2.0.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-18.04
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
2022-06-15 16:33:03 +08:00
toolchain: stable
override: true
components: rustfmt
2022-10-06 20:03:04 +08:00
# - name: Cache dependencies
# uses: Swatinem/rust-cache@v2.0.0
- name: Run cargo fmt
run: cargo fmt --all -- --check