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
|
2021-12-22 12:26:29 +01:00
|
|
|
RUST_BACKTRACE: 1
|
2022-05-04 15:20:45 +02:00
|
|
|
RUSTFLAGS: "-D warnings"
|
2021-02-24 10:31:28 +01:00
|
|
|
|
|
|
|
jobs:
|
2021-03-16 10:26:08 +01:00
|
|
|
tests:
|
2021-03-22 19:17:18 +01:00
|
|
|
name: Tests on ${{ matrix.os }}
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2022-08-29 18:26:01 +02:00
|
|
|
os: [ubuntu-20.04, macos-latest, windows-latest]
|
2021-03-22 19:17:18 +01:00
|
|
|
steps:
|
2022-06-28 22:21:41 +02:00
|
|
|
- uses: actions/checkout@v3
|
2021-07-07 17:07:20 +02:00
|
|
|
- name: Cache dependencies
|
2022-08-01 19:07:30 +02:00
|
|
|
uses: Swatinem/rust-cache@v2.0.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
|
|
|
|
args: --locked --release --no-default-features
|
2021-03-22 19:17:18 +01:00
|
|
|
- name: Run cargo test
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: test
|
|
|
|
args: --locked --release
|
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
|
2022-08-29 18:26:01 +02:00
|
|
|
runs-on: ubuntu-20.04
|
2022-03-16 17:13:49 +01:00
|
|
|
steps:
|
2022-06-28 22:21:41 +02:00
|
|
|
- uses: actions/checkout@v3
|
2022-03-16 17:13:49 +01:00
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
toolchain: stable
|
|
|
|
override: true
|
|
|
|
- name: Cache dependencies
|
2022-08-01 19:07:30 +02:00
|
|
|
uses: Swatinem/rust-cache@v2.0.0
|
2022-03-16 17:13:49 +01:00
|
|
|
- name: Run tests in debug
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: test
|
|
|
|
args: --locked
|
|
|
|
|
2021-03-22 19:17:18 +01:00
|
|
|
clippy:
|
|
|
|
name: Run Clippy
|
2022-08-29 18:26:01 +02:00
|
|
|
runs-on: ubuntu-20.04
|
2021-03-22 19:17:18 +01:00
|
|
|
steps:
|
2022-06-28 22:21:41 +02:00
|
|
|
- uses: actions/checkout@v3
|
2021-03-22 19:17:18 +01:00
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
toolchain: stable
|
|
|
|
override: true
|
|
|
|
components: clippy
|
2021-09-07 18:56:38 +02:00
|
|
|
- name: Cache dependencies
|
2022-08-01 19:07:30 +02:00
|
|
|
uses: Swatinem/rust-cache@v2.0.0
|
2021-03-22 19:17:18 +01:00
|
|
|
- name: Run cargo clippy
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: clippy
|
|
|
|
args: --all-targets -- --deny warnings
|
2021-06-29 15:25:18 +02:00
|
|
|
|
|
|
|
fmt:
|
|
|
|
name: Run Rustfmt
|
2022-08-29 18:26:01 +02:00
|
|
|
runs-on: ubuntu-20.04
|
2021-06-29 15:25:18 +02:00
|
|
|
steps:
|
2022-06-28 22:21:41 +02:00
|
|
|
- uses: actions/checkout@v3
|
2021-06-29 15:25:18 +02:00
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
2022-06-15 10:33:03 +02:00
|
|
|
toolchain: stable
|
2021-06-29 15:25:18 +02:00
|
|
|
override: true
|
|
|
|
components: rustfmt
|
2021-09-07 18:56:38 +02:00
|
|
|
- name: Cache dependencies
|
2022-08-01 19:07:30 +02:00
|
|
|
uses: Swatinem/rust-cache@v2.0.0
|
2021-06-29 15:25:18 +02:00
|
|
|
- name: Run cargo fmt
|
|
|
|
run: cargo fmt --all -- --check
|