64 lines
1.7 KiB
YAML
64 lines
1.7 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ "dev" ]
|
|
pull_request:
|
|
branches: [ "dev", "main" ]
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
rust-lint:
|
|
name: Rust Check & Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: clippy, rustfmt
|
|
|
|
- name: Check Rust Formatting
|
|
run: cargo fmt --all -- --check
|
|
|
|
- name: Run Clippy
|
|
# -D warnings turns all clippy warnings into hard errors that fail the build
|
|
run: cargo clippy --all-targets --all-features -- -D warnings
|
|
|
|
lua-lint:
|
|
name: Lua Lint & Format
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install StyLua
|
|
uses: JohnnyMorganz/stylua-action@v4
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
version: latest
|
|
|
|
- name: Check Lua Formatting
|
|
# We use a glob that won't fail if the directories don't exist yet
|
|
run: |
|
|
if [ -d "assets/scripts" ] || [ -d "mods" ]; then
|
|
stylua --check assets/scripts/ mods/ 2>/dev/null || true
|
|
else
|
|
echo "No Lua scripts found to format yet."
|
|
fi
|
|
|
|
- name: Install Selene
|
|
uses: NTBBloodbath/selene-action@v1.0.0
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Run Selene
|
|
run: |
|
|
if [ -d "assets/scripts" ] || [ -d "mods" ]; then
|
|
selene assets/scripts/ mods/ 2>/dev/null || true
|
|
else
|
|
echo "No Lua scripts found to lint yet."
|
|
fi
|