Skip to content

improve continuous integration #72

improve continuous integration

improve continuous integration #72

Workflow file for this run

on:
push:
branches:
- master
- ci
pull_request:
branches:
- master
- ci
name: Rust
jobs:
runner-matrix:
name: format, lint, test
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
# build with latest stable, but reset CI cache when new versions of Rust are released
- name: Determine build cache key
id: vars
run: |
RUST_VERSION=$(rustc -V | grep -Po '(?<=^rustc )\S+')
echo "rustc-version=$RUST_VERSION" >> $GITHUB_OUTPUT
# Don't include target/ -- only cache building 3rd-party libraries.
- name: Use build cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ steps.vars.outputs.rustc-version }}-${{ hashFiles('**/Cargo.lock') }}
- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test