mirror of
https://github.com/Nostalgica-Reverie/Content-Monorepo.git
synced 2026-05-09 00:24:15 +00:00
75 lines
2.1 KiB
YAML
75 lines
2.1 KiB
YAML
name: "Linter"
|
|
|
|
on:
|
|
push:
|
|
branches: ["main"]
|
|
paths:
|
|
- 'modpacks/**/*.json'
|
|
- 'modpacks/**/*.mcmeta'
|
|
- 'modpacks/**/*.toml'
|
|
- 'datapacks/**/*.json'
|
|
- 'datapacks/**/*.mcmeta'
|
|
- 'src/actions/somnus/**'
|
|
pull_request:
|
|
branches: ["main"]
|
|
paths:
|
|
- 'modpacks/**/*.json'
|
|
- 'modpacks/**/*.mcmeta'
|
|
- 'modpacks/**/*.toml'
|
|
- 'datapacks/**/*.json'
|
|
- 'datapacks/**/*.mcmeta'
|
|
- 'src/actions/somnus/**'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: technocality
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 2
|
|
filter: blob:none
|
|
sparse-checkout: |
|
|
modpacks
|
|
datapacks
|
|
src/actions/somnus
|
|
|
|
- name: Cache Linter Binaries
|
|
id: cache-linter
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ./linter-bin
|
|
key: linter-v1-${{ runner.os }}-${{ hashFiles('src/actions/somnus/core/**/*.rs', 'src/actions/somnus/core/Cargo.toml', 'src/actions/somnus/core/Cargo.lock') }}
|
|
|
|
- name: Rust Cache
|
|
if: steps.cache-linter.outputs.cache-hit != 'true'
|
|
uses: https://github.com/Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: "src/actions/somnus/core -> target"
|
|
|
|
- name: Install Rust
|
|
if: steps.cache-linter.outputs.cache-hit != 'true'
|
|
uses: https://github.com/dtolnay/rust-toolchain@stable
|
|
|
|
- name: Build Linters
|
|
if: steps.cache-linter.outputs.cache-hit != 'true'
|
|
run: |
|
|
cargo build --release \
|
|
--manifest-path src/actions/somnus/core/Cargo.toml \
|
|
--bin json-linter --bin toml-linter
|
|
|
|
mkdir -p ./linter-bin
|
|
|
|
cp src/actions/somnus/core/target/release/json-linter ./linter-bin/
|
|
cp src/actions/somnus/core/target/release/toml-linter ./linter-bin/
|
|
|
|
- name: Run Linters
|
|
run: |
|
|
chmod +x ./linter-bin/json-linter ./linter-bin/toml-linter
|
|
echo "Running JSON Linter..."
|
|
./linter-bin/json-linter
|
|
echo "Running TOML Linter..."
|
|
./linter-bin/toml-linter
|
|
|