build.yml

This commit is contained in:
bahdotsh
2025-04-21 18:51:50 +05:30
parent bb77848b78
commit ad6ad05311
2 changed files with 90 additions and 32 deletions

View File

@@ -1,53 +1,58 @@
name: Build & Test
name: Build Test
on:
push:
branches: [ main ]
paths-ignore:
- '.github/workflows/**'
pull_request:
branches: [ main ]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build & Test
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
rust: [stable]
runs-on: ${{ matrix.os }}
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-latest
target: x86_64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
steps:
- uses: actions/checkout@v3
- name: Install Rust
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
toolchain: stable
target: ${{ matrix.target }}
override: true
components: rustfmt, clippy
components: clippy, rustfmt
- name: Cache Dependencies
uses: actions/cache@v3
- name: Check formatting
uses: actions-rs/cargo@v1
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
command: fmt
args: -- --check
- name: Check Formatting
run: cargo fmt --all -- --check
- name: Lint with Clippy
run: cargo clippy -- -D warnings
- name: Run clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
- name: Build
run: cargo build --verbose
uses: actions-rs/cargo@v1
with:
command: build
args: --target ${{ matrix.target }}
- name: Run Tests
run: cargo test --verbose
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --target ${{ matrix.target }}

53
.github/workflows/rust.yml vendored Normal file
View File

@@ -0,0 +1,53 @@
name: Build & Test
on:
push:
branches: [ main ]
paths-ignore:
- '.github/workflows/**'
pull_request:
branches: [ main ]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build & Test
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
rust: [stable]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
components: rustfmt, clippy
- name: Cache Dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Check Formatting
run: cargo fmt --all -- --check
- name: Lint with Clippy
run: cargo clippy -- -D warnings
- name: Build
run: cargo build --verbose
- name: Run Tests
run: cargo test --verbose