2023-07-06 22:51:18 -07:00
|
|
|
name: Rust Build and Clippy Check
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
branches:
|
2023-07-18 05:08:32 -07:00
|
|
|
- main
|
2023-07-06 22:51:18 -07:00
|
|
|
push:
|
|
|
|
branches:
|
2023-07-18 05:08:32 -07:00
|
|
|
- main
|
2023-07-06 22:51:18 -07:00
|
|
|
|
|
|
|
jobs:
|
2023-09-04 08:16:26 -07:00
|
|
|
build_all:
|
2023-09-04 07:43:25 -07:00
|
|
|
name: Rust project - latest
|
2023-07-06 22:51:18 -07:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-13 07:16:20 -07:00
|
|
|
- name: Install Dependencies
|
|
|
|
run: |
|
|
|
|
sudo apt-get update -y
|
|
|
|
sudo apt-get upgrade -y
|
|
|
|
sudo apt-get install libssl-dev openssl -y
|
|
|
|
|
2023-09-13 06:29:42 -07:00
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
|
|
|
# The toolchain action should definitely be run before the cache action
|
|
|
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
2023-09-04 07:41:28 -07:00
|
|
|
with:
|
2023-09-13 07:16:20 -07:00
|
|
|
# use toolchain version from rust-toolchain.toml
|
2023-09-13 06:29:42 -07:00
|
|
|
components: rustfmt, clippy
|
|
|
|
cache: false
|
|
|
|
# avoid the default "-D warnings" which thrashes cache
|
|
|
|
rustflags: ""
|
2023-07-06 22:51:18 -07:00
|
|
|
|
2023-09-13 06:29:42 -07:00
|
|
|
# https://github.com/actions/cache/blob/main/examples.md#rust---cargo
|
|
|
|
- uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/bin/
|
|
|
|
~/.cargo/registry/index/
|
|
|
|
~/.cargo/registry/cache/
|
|
|
|
~/.cargo/git/db/
|
|
|
|
target/
|
|
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
2023-09-04 08:52:20 -07:00
|
|
|
|
2023-09-04 07:41:28 -07:00
|
|
|
- name: Early Build
|
|
|
|
run: cargo build --workspace --tests
|
2023-07-18 05:08:32 -07:00
|
|
|
|
2023-09-13 06:29:42 -07:00
|
|
|
- name: Run fmt+clippy
|
|
|
|
run: |
|
|
|
|
cargo fmt --all --check
|
|
|
|
cargo clippy --workspace --all-targets
|