name: Rust Build and Clippy Check on: pull_request: branches: - main push: branches: - main jobs: build_all: name: Rust project - latest runs-on: ubuntu-latest steps: - name: Install Dependencies run: | sudo apt-get update -y sudo apt-get upgrade -y sudo apt-get install libssl-dev openssl -y - uses: actions/checkout@v4 # The toolchain action should definitely be run before the cache action - uses: actions-rust-lang/setup-rust-toolchain@v1 with: # use toolchain version from rust-toolchain.toml components: rustfmt, clippy cache: false # avoid the default "-D warnings" which thrashes cache rustflags: "" # 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') }} - name: Early Build run: cargo build --workspace --tests - name: Run fmt+clippy run: | cargo fmt --all --check cargo clippy --workspace --all-targets -- -D warnings