Sorted consumption #100
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 tests | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
install: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the source code | |
uses: actions/checkout@v3 | |
- name: Install & display rust toolchain | |
run: | | |
rustup show | |
rustup toolchain install nightly | |
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu | |
rustup component add clippy --toolchain nightly-x86_64-unknown-linux-gnu | |
rustup show | |
- name: Check targets are installed correctly | |
run: rustup target list --installed | |
format: | |
needs: install | |
runs-on: ubuntu-latest | |
steps: | |
- name: Use cashed cargo | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo | |
key: ${{ runner.os }}-rust-${{ hashFiles('rust-toolchain.toml') }} | |
- name: Checkout the source code | |
uses: actions/checkout@v3 | |
- name: Ensure the rust code is formatted | |
run: cargo fmt --all --check | |
clippy: | |
needs: install | |
runs-on: ubuntu-latest | |
steps: | |
- name: Use cashed cargo | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo | |
key: ${{ runner.os }}-rust-${{ hashFiles('rust-toolchain.toml') }} | |
- name: Checkout the source code | |
uses: actions/checkout@v3 | |
- name: Ensure clippy is happy | |
run: cargo clippy -- -D warnings | |
build: | |
needs: install | |
runs-on: ubuntu-latest | |
steps: | |
- name: Use cashed cargo | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo | |
key: ${{ runner.os }}-rust-${{ hashFiles('rust-toolchain.toml') }} | |
- name: Checkout the source code | |
uses: actions/checkout@v3 | |
- name: Ensure the project builds | |
run: cargo build |