Template
105 lines
2.5 KiB
YAML
105 lines
2.5 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/install-action@v2
|
|
with:
|
|
tool: cargo-sort
|
|
|
|
- name: Install cargo machete
|
|
uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: cargo-machete
|
|
|
|
- name: Check formatting
|
|
run: cargo fmt --check
|
|
|
|
- name: Check import sorting
|
|
run: cargo sort --workspace --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: Build for Linux x86 (GNU and MUSL)
|
|
run: |
|
|
cargo build --target x86_64-unknown-linux-gnu --release --locked
|
|
cargo build --target x86_64-unknown-linux-musl --release --locked
|
|
|
|
|
|
cross_build:
|
|
name: Cross-Build
|
|
runs-on: ubuntu-latest
|
|
needs: [lint, build]
|
|
|
|
steps:
|
|
- name: Checkout Project
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Setup Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Crosscompile for aarch64 linux, windows, macos
|
|
uses: zijiren233/cargo-cross@v1
|
|
with:
|
|
targets: |
|
|
aarch64-unknown-linux-musl
|
|
aarch64-unknown-linux-gnu
|
|
x86_64-pc-windows-gnu
|
|
aarch64-apple-darwin
|
|
|
|
test:
|
|
name: Test
|
|
runs-on: ubuntu-latest
|
|
needs: [build, 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: Test for Linux x86 (GNU and MUSL)
|
|
run: |
|
|
cargo test --target x86_64-unknown-linux-gnu --release --locked
|
|
cargo test --target x86_64-unknown-linux-musl --release --locked
|
|
|
|
|