mango-simulation/.github/workflows/build_test.yml

63 lines
1.5 KiB
YAML
Raw Normal View History

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-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 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
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
2023-09-13 12:14:09 -07:00
# ~/.cargo/registry/index/
# ~/.cargo/registry/cache/
# ~/.cargo/git/db/
2023-09-13 06:29:42 -07:00
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
2023-09-13 12:08:51 -07:00
run: |
rustc --version
echo $RUSTFLAGS
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
2023-09-13 07:49:45 -07:00
cargo clippy --workspace --all-targets
2023-09-13 07:30:03 -07:00