name: code testing
on:
merge_group:
types: [checks_requested]
workflow_call:
pull_request:
paths:
- ".github/workflows/testing.yml"
- "**/Cargo.toml"
- "**/Cargo.lock"
- "**.rs"
push:
branches:
- main
paths:
- ".github/workflows/testing.yml"
- "**/Cargo.toml"
- "**/Cargo.lock"
- "**.rs"
env:
RUSTFLAGS: "-Dwarnings"
jobs:
code-checking:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.ref }}-code-checking
cancel-in-progress: true
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: rustfmt,clippy
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-code-checking-${{ hashFiles('**/Cargo.lock') }}
- name: run lint
run: cargo fmt --all --check
- name: run check
run: cargo check --all-features --tests --workspace
- name: run clippy
run: cargo clippy --all-targets --all-features --tests --workspace
testing:
runs-on: ubuntu-latest
container: rust:1-bullseye
concurrency:
group: ${{ github.ref }}-mrml-cli-testing
cancel-in-progress: true
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-testing-${{ hashFiles('**/Cargo.lock') }}
- name: run tests
run: cargo test