38 lines
843 B
YAML
38 lines
843 B
YAML
|
name: Rust
|
||
|
|
||
|
on:
|
||
|
push:
|
||
|
branches: [main]
|
||
|
pull_request:
|
||
|
|
||
|
jobs:
|
||
|
test:
|
||
|
runs-on: ubuntu-latest
|
||
|
steps:
|
||
|
- uses: actions/checkout@v3
|
||
|
- uses: dtolnay/rust-toolchain@stable
|
||
|
|
||
|
- name: Get Rust Version
|
||
|
id: rust-version
|
||
|
run: echo "::set-output name=version::$(cargo -V | head -n1 | awk '{print $2}')"
|
||
|
- uses: actions/cache@v3
|
||
|
with:
|
||
|
path: |
|
||
|
~/.cargo/git
|
||
|
~/.cargo/registry
|
||
|
target
|
||
|
key: ${{runner.os}}-rust-${{steps.rust-version.outputs.version}}
|
||
|
|
||
|
- run: cargo test
|
||
|
env:
|
||
|
RUST_BACKTRACE: 1
|
||
|
|
||
|
rustfmt:
|
||
|
runs-on: ubuntu-latest
|
||
|
steps:
|
||
|
- uses: actions/checkout@v3
|
||
|
- uses: dtolnay/rust-toolchain@nightly
|
||
|
with:
|
||
|
components: rustfmt
|
||
|
- run: cargo fmt --all -- --check
|