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
|
|
|
|
2023-09-13 12:14:09 -07:00
|
|
|
env:
|
|
|
|
SCCACHE_GHA_ENABLED: true
|
|
|
|
RUSTC_WRAPPER: sccache
|
2023-09-13 14:09:08 -07:00
|
|
|
SCCACHE_CACHE_SIZE: "1G"
|
2023-09-13 12:14:09 -07:00
|
|
|
|
2023-07-06 22:51:18 -07:00
|
|
|
jobs:
|
2023-09-04 08:16:26 -07:00
|
|
|
build_all:
|
2023-09-13 14:12:42 -07:00
|
|
|
name: Rust project
|
|
|
|
runs-on: ubuntu-22.04
|
2023-07-06 22:51:18 -07:00
|
|
|
steps:
|
2023-09-13 22:48:47 -07:00
|
|
|
- name: Install Linux Packages
|
2023-09-13 07:16:20 -07:00
|
|
|
run: |
|
|
|
|
sudo apt-get update -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
|
2023-09-13 14:09:08 -07:00
|
|
|
cache: true
|
2023-09-13 06:29:42 -07:00
|
|
|
# avoid the default "-D warnings" which thrashes cache
|
|
|
|
rustflags: ""
|
2023-07-06 22:51:18 -07:00
|
|
|
|
2023-09-13 14:09:08 -07:00
|
|
|
|
2023-09-13 12:14:09 -07:00
|
|
|
- name: Run sccache-cache
|
|
|
|
uses: mozilla-actions/sccache-action@v0.0.3
|
|
|
|
|
|
|
|
|
2023-09-13 06:29:42 -07:00
|
|
|
# https://github.com/actions/cache/blob/main/examples.md#rust---cargo
|
2023-09-13 14:09:08 -07:00
|
|
|
# https://blog.arriven.wtf/posts/rust-ci-cache/
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
2023-09-13 06:29:42 -07:00
|
|
|
with:
|
2023-09-13 14:09:08 -07:00
|
|
|
# will be covered by sscache
|
|
|
|
cache-targets: false
|
2023-09-13 06:29:42 -07:00
|
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
2023-09-04 08:52:20 -07:00
|
|
|
|
2023-09-13 14:09:08 -07:00
|
|
|
|
2023-09-04 07:41:28 -07:00
|
|
|
- name: Early Build
|
2023-09-13 12:08:51 -07:00
|
|
|
run: |
|
2023-09-13 22:48:47 -07:00
|
|
|
cargo build --locked --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
|
2023-09-13 14:09:08 -07:00
|
|
|
cargo clippy --locked --workspace --all-targets
|
2023-09-13 07:30:03 -07:00
|
|
|
|