adds full CI checks for rust #3
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 Checks | |
on: | |
push: | |
branches: [develop] | |
pull_request: | |
jobs: | |
cargo-test: | |
name: cargo test | |
runs-on: self-hosted | |
env: | |
CARGO_NET_GIT_FETCH_WITH_CLI: true | |
RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 -C target-cpu=native | |
RUST_BACKTRACE: 1 | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Set up Rust | |
run: | | |
curl https://sh.rustup.rs -sSf | sh -s -- -y | |
- name: Set up CI | |
uses: ./.github/actions/setup | |
- name: cargo test | |
run: cargo test --release --workspace --all-features | |
cargo-check: | |
name: cargo check | |
runs-on: self-hosted | |
env: | |
CARGO_NET_GIT_FETCH_WITH_CLI: true | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Set up Rust | |
run: | | |
curl https://sh.rustup.rs -sSf | sh -s -- -y | |
- name: Set up CI | |
uses: ./.github/actions/setup | |
- name: cargo check | |
run: cargo check --workspace --all-features | |
cargo-fmt: | |
name: cargo fmt | |
runs-on: self-hosted | |
env: | |
CARGO_NET_GIT_FETCH_WITH_CLI: true | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Set up Rust | |
run: | | |
curl https://sh.rustup.rs -sSf | sh -s -- -y | |
- name: Set up CI | |
uses: ./.github/actions/setup | |
- name: cargo fmt | |
run: cargo fmt -- --check | |
cargo-fix: | |
name: cargo fix | |
runs-on: self-hosted | |
env: | |
CARGO_NET_GIT_FETCH_WITH_CLI: true | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Set up Rust | |
run: | | |
curl https://sh.rustup.rs -sSf | sh -s -- -y | |
- name: Set up CI | |
uses: ./.github/actions/setup | |
- name: cargo fix --workspace | |
run: | | |
# Run cargo fix on the project | |
cargo fix --workspace --all-features | |
# Check for local git changes | |
if ! git diff --exit-code; then | |
echo "There are local changes after running 'cargo fix --workspace' ❌" | |
exit 1 | |
else | |
echo "No changes detected after running 'cargo fix --workspace' ✅" | |
fi | |
cargo-clippy: | |
name: cargo clippy | |
runs-on: self-hosted | |
env: | |
CARGO_NET_GIT_FETCH_WITH_CLI: true | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Setup CI | |
uses: ./.github/actions/setup | |
- name: cargo clippy | |
run: cargo clippy --workspace --all-features -- -D warnings | |
cargo-audit: | |
name: cargo audit | |
runs-on: self-hosted | |
env: | |
CARGO_NET_GIT_FETCH_WITH_CLI: true | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Setup CI | |
uses: ./.github/actions/setup | |
- name: install cargo-audit | |
run: cargo install cargo-audit | |
- name: cargo audit | |
run: cargo audit |