Files
rust_workflow_template/.gitea/workflows/lint.yml
T
melfely 9bcfd7d966 feat: reduced number of steps. Updated tool versions
Properly uses the action workflow tools that were in use before. By using the rust installer action, to also install the tools I need.

Setup to use the cargo-cache installer for cargo-cross rather than a manual install, this should allow caching between runs
2026-09-09 11:03:41 -05:00

101 lines
2.6 KiB
YAML

name: Crossplatform Linting && Build
on:
push:
branches: [ main, master ]
pull_request:
jobs:
lint:
name: Linting
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v5
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Install cargo sort
uses: taiki-e/cache-cargo-install-action@v3 # v3
with:
tool: cargo-sort
- name: Install cargo machete
uses: taiki-e/cache-cargo-install-action@v3 # v3
with:
tool: cargo-machete
- name: Cache cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-lint-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-lint-
- name: Check formatting
run: cargo fmt --check
- name: Check import sorting
run: cargo sort --grouped --check --check-format
- name: Check for unused dependencies
run: cargo machete
- name: Clippy for Linux x86 (GNU ONLY)
run: |
cargo clippy --target x86_64-unknown-linux-gnu -- -D warnings
build:
name: Build
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout Project
uses: actions/checkout@v5
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-musl
- name: Install Cross
uses: taiki-e/cache-cargo-install-action@v3 # v3
with:
tool: cargo-cross
- name: Cache cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-lint-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-lint-
- name: Build for Linux x86 (GNU and MUSL)
run: |
cargo build --release --target x86_64-unknown-linux-gnu --locked
cargo build --release --target x86_64-unknown-linux-musl --locked
- name: Build for Linux aarch64 (GNU and MUSL)
run: |
cargo cross --release --target aarch64-unknown-linux-gnu --locked
cargo cross --release --target aarch64-unknown-linux-musl --locked