107 lines
2.4 KiB
YAML
107 lines
2.4 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
fmt:
|
|
name: Formatting
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: rustfmt
|
|
|
|
- name: Check formatting
|
|
run: cargo fmt --all --check
|
|
|
|
clippy:
|
|
name: Clippy
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Clone Pumpkin dependency
|
|
run: git clone --depth 1 https://github.com/Pumpkin-MC/Pumpkin.git ../Pumpkin
|
|
|
|
- name: Setup Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: clippy
|
|
targets: wasm32-wasip2
|
|
|
|
- name: Setup Rust cache
|
|
uses: Swatinem/rust-cache@v2
|
|
|
|
- name: Run Clippy (WASM target)
|
|
run: cargo clippy --target wasm32-wasip2 -- -D warnings
|
|
|
|
- name: Run Clippy (Host target)
|
|
run: cargo clippy --all-targets -- -D warnings
|
|
|
|
build:
|
|
name: Compile & Build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Clone Pumpkin dependency
|
|
run: git clone --depth 1 https://github.com/Pumpkin-MC/Pumpkin.git ../Pumpkin
|
|
|
|
- name: Setup Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: wasm32-wasip2
|
|
|
|
- name: Setup Rust cache
|
|
uses: Swatinem/rust-cache@v2
|
|
|
|
- name: Check native compilation
|
|
run: cargo check --all-targets
|
|
|
|
- name: Build WASM plugin (debug)
|
|
run: cargo build --target wasm32-wasip2
|
|
|
|
- name: Build WASM plugin (release)
|
|
run: cargo build --release --target wasm32-wasip2
|
|
|
|
test:
|
|
name: Test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Clone Pumpkin dependency
|
|
run: git clone --depth 1 https://github.com/Pumpkin-MC/Pumpkin.git ../Pumpkin
|
|
|
|
- name: Setup Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Setup Rust cache
|
|
uses: Swatinem/rust-cache@v2
|
|
|
|
- name: Run unit tests
|
|
run: cargo test --lib --verbose
|