Merge pull request #34 from SoptikHa2/setup-ci #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build | |
run: cargo build --verbose | |
- name: Run tests | |
run: cargo test --verbose | |
lint: | |
name: Check code style | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout repository | |
- uses: dtolnay/rust-toolchain@master | |
name: Set up toolchain | |
with: | |
toolchain: stable | |
components: rustfmt, clippy | |
- uses: Swatinem/rust-cache@v2 | |
name: Cache toolchain and dependencies | |
- uses: actions-rs/cargo@v1 | |
name: Check code with cargo fmt | |
with: | |
command: fmt | |
args: --all -- --check | |
- uses: actions-rs/cargo@v1 | |
name: Check code with cargo clippy | |
with: | |
command: clippy | |
args: --all-targets -- -D warnings |