From 4cba390c3204ff114c2ac60a42445e7213378249 Mon Sep 17 00:00:00 2001 From: omo50 <144749186+omo50@users.noreply.github.com> Date: Sat, 18 Apr 2026 14:03:22 -0600 Subject: [PATCH] chore(ci): update linter yml --- .forgejo/workflows/linter.yml | 48 +++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/.forgejo/workflows/linter.yml b/.forgejo/workflows/linter.yml index 9592c3c2b..6cda45244 100644 --- a/.forgejo/workflows/linter.yml +++ b/.forgejo/workflows/linter.yml @@ -2,55 +2,71 @@ name: "Linter" on: push: - branches: [ "main" ] + branches: ["main"] paths: - 'modpacks/**/*.json' + - 'modpacks/**/*.mcmeta' - 'modpacks/**/*.toml' - - 'resourcepacks/**/*.json' - '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@v4 + uses: actions/checkout@v5 with: fetch-depth: 2 + filter: blob:none sparse-checkout: | modpacks - resourcepacks datapacks src/actions/somnus - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - - - name: Cache Rust - uses: Swatinem/rust-cache@v2 - with: - workspaces: "src/actions/somnus/core -> target" - - name: Cache Linter Binaries id: cache-linter uses: actions/cache@v4 with: path: ./linter-bin - key: linter-${{ runner.os }}-${{ hashFiles('src/actions/somnus/core/**/*.rs') }} + key: linter-v1-${{ runner.os }}-${{ hashFiles('src/actions/somnus/core/**/*.rs', 'src/actions/somnus/core/Cargo.toml', 'src/actions/somnus/core/Cargo.lock') }} + + - name: Install Rust + if: steps.cache-linter.outputs.cache-hit != 'true' + uses: dtolnay/rust-toolchain@stable + + - name: Rust Cache (Compiler Internals) + if: steps.cache-linter.outputs.cache-hit != 'true' + uses: Swatinem/rust-cache@v2 + with: + workspaces: "src/actions/somnus/core -> target" - 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 - cargo build --release --manifest-path src/actions/somnus/core/Cargo.toml 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 \ No newline at end of file + ./linter-bin/toml-linter +