67 lines
1.8 KiB
YAML
67 lines
1.8 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
|
|
# The `-D warnings` flag converts all clippy warnings into hard errors, causing the build to fail.
|
|
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
|
|
# A conditional search is used to prevent failures when no Lua files exist yet.
|
|
run: |
|
|
LUA_FILES=$(find assets/scripts mods -name "*.lua" 2>/dev/null || true)
|
|
if [ -z "$LUA_FILES" ]; then
|
|
echo "No Lua files found to format."
|
|
else
|
|
echo "$LUA_FILES" | xargs stylua --check
|
|
fi
|
|
|
|
- name: Install Selene
|
|
uses: NTBBloodbath/selene-action@v1.0.0
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Run Selene
|
|
# A conditional search is used to prevent failures when no Lua files exist yet.
|
|
run: |
|
|
LUA_FILES=$(find assets/scripts mods -name "*.lua" 2>/dev/null || true)
|
|
if [ -z "$LUA_FILES" ]; then
|
|
echo "No Lua files found to lint."
|
|
else
|
|
echo "$LUA_FILES" | xargs selene
|
|
fi
|