Template
Apparently Cross Compiling to MacOS is basically impossible. Crossing Compiling to Windows is painful but doable, not setting it up here ngl
101 lines
2.7 KiB
YAML
101 lines
2.7 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@1.90.0
|
|
|
|
- name: Install cargo fmt
|
|
run: rustup component add rustfmt
|
|
|
|
- name: Install cargo clippy
|
|
run: rustup component add clippy
|
|
|
|
- name: Install cargo sort
|
|
uses: taiki-e/cache-cargo-install-action@caa6f48d18d42462f9c30df89e2b4f71a42b7c2c # v2.0.1
|
|
with:
|
|
tool: cargo-sort@1.0.9
|
|
|
|
- name: Install cargo machete
|
|
uses: taiki-e/cache-cargo-install-action@caa6f48d18d42462f9c30df89e2b4f71a42b7c2c # v2.0.1
|
|
with:
|
|
tool: cargo-machete@0.7.0
|
|
|
|
- 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@1.90.0
|
|
|
|
- name: Install Cross
|
|
run: cargo install cross --locked
|
|
|
|
- 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 --target --release x86_64-unknown-linux-gnu --locked
|
|
cargo build --target --release x86_64-unknown-linux-musl --locked
|
|
|
|
- name: Build for Linux aarch64 (GNU and MUSL)
|
|
run: |
|
|
cargo cross --target --release aarch64-unknown-linux-gnu --locked
|
|
cargo cross --target --release aarch64-unknown-linux-musl --locked
|
|
|
|
|
|
|