From 9d2dc281ec597c2d6d926f8b26bde8bddfcfa302 Mon Sep 17 00:00:00 2001 From: AramJonghu Date: Wed, 8 Jul 2026 14:13:55 +0200 Subject: [PATCH] refactor(ci): restructure workflows to multi-job per language --- .gitea/workflows/{lint-js.yml => js-ts.yml} | 18 ++- .gitea/workflows/lint-python.yml | 65 --------- .gitea/workflows/lint-rust.yml | 85 ----------- .gitea/workflows/rust.yml | 152 ++++++++++++++++++++ 4 files changed, 167 insertions(+), 153 deletions(-) rename .gitea/workflows/{lint-js.yml => js-ts.yml} (84%) delete mode 100644 .gitea/workflows/lint-python.yml delete mode 100644 .gitea/workflows/lint-rust.yml create mode 100644 .gitea/workflows/rust.yml diff --git a/.gitea/workflows/lint-js.yml b/.gitea/workflows/js-ts.yml similarity index 84% rename from .gitea/workflows/lint-js.yml rename to .gitea/workflows/js-ts.yml index f7c9829..639adaf 100644 --- a/.gitea/workflows/lint-js.yml +++ b/.gitea/workflows/js-ts.yml @@ -1,10 +1,10 @@ -name: Lint & Format (JS/TS) +name: JS/TS on: pull_request: jobs: - lint-format: + fmt: runs-on: alpine container: node:26-alpine @@ -18,7 +18,6 @@ jobs: git - name: Prettier - continue-on-error: true run: | if [ -n "$(find . \( -iname "*.js" -o -iname "*.jsx" -o -iname "*.ts" -o -iname "*.tsx" -o -iname "*.mjs" -o -iname "*.cjs" \) -print -quit)" ]; then npx --yes prettier --check "**/*.{js,jsx,ts,tsx,mjs,cjs}" --ignore-path .prettierignore @@ -26,6 +25,19 @@ jobs: echo "No JS/TS files found" fi + lint: + runs-on: alpine + container: node:26-alpine + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install tools + run: | + apk add --no-cache \ + git + - name: ESLint run: | if [ -n "$(find . \( -iname "*.js" -o -iname "*.jsx" -o -iname "*.ts" -o -iname "*.tsx" -o -iname "*.mjs" -o -iname "*.cjs" \) -print -quit)" ]; then diff --git a/.gitea/workflows/lint-python.yml b/.gitea/workflows/lint-python.yml deleted file mode 100644 index 123ebec..0000000 --- a/.gitea/workflows/lint-python.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: Python - -on: - pull_request: - -jobs: - lint-format: - runs-on: alpine - container: node:26-alpine - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install tools - run: | - apk add --no-cache \ - git \ - python3 \ - py3-pip - python3 -m venv .venv - . .venv/bin/activate - pip install --no-cache-dir ruff - - - name: Format check - continue-on-error: true - run: | - . .venv/bin/activate - ruff format --check . - - - name: Lint - run: | - . .venv/bin/activate - ruff check . - - test: - runs-on: alpine - container: node:26-alpine - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install tools - run: | - apk add --no-cache \ - git \ - python3 \ - py3-pip \ - py3-pillow \ - build-base - python3 -m venv .venv - . .venv/bin/activate - pip install --no-cache-dir \ - typer \ - pillow \ - materialyoucolor \ - jinja2 \ - pytest - - - name: Test - run: | - . .venv/bin/activate - cd cli - python -m pytest tests/ -v diff --git a/.gitea/workflows/lint-rust.yml b/.gitea/workflows/lint-rust.yml deleted file mode 100644 index 49250d3..0000000 --- a/.gitea/workflows/lint-rust.yml +++ /dev/null @@ -1,85 +0,0 @@ -name: Lint & Format (Rust) - -on: - pull_request: - -jobs: - lint-format: - runs-on: alpine - container: node:26-alpine - env: - CARGO_HOME: ${{ github.workspace }}/.cargo - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Cache cargo packages - uses: actions/cache@v4 - env: - cache-name: cache-cargo-packages - with: - path: | - .cargo/registry - .cargo/git - target - key: rust-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - rust-${{ runner.os }}-build-${{ env.cache-name }}- - rust-${{ runner.os }}-build- - rust- - - - name: Install tools - run: | - apk add --no-cache \ - git \ - cargo \ - rust \ - rustfmt \ - rust-clippy - - - id: format-check - name: Format check - continue-on-error: true - run: | - if [ -n "$(find . -name "Cargo.toml" -print -quit)" ]; then - status=0 - for manifest in $(find . -name "Cargo.toml"); do - cargo fmt --manifest-path "$manifest" --check && \ - echo "$manifest: formatting OK" || \ - { echo "$manifest: needs formatting"; status=1; } - done - exit $status - elif [ -n "$(find . -name "*.rs" -print -quit)" ]; then - echo "Rust files found but no Cargo.toml" - exit 1 - else - echo "No Rust project found" - fi - - - id: clippy - name: Clippy - run: | - if [ -n "$(find . -name "Cargo.toml" -print -quit)" ]; then - status=0 - for manifest in $(find . -name "Cargo.toml"); do - cargo clippy --manifest-path "$manifest" --all-targets --all-features -- -D warnings && \ - echo "$manifest: Clippy passed" || \ - { echo "$manifest: Clippy failed"; status=1; } - done - exit $status - elif [ -n "$(find . -name "*.rs" -print -quit)" ]; then - echo "Rust files found but no Cargo.toml" - exit 1 - else - echo "No Rust project found" - fi - - - name: Check results - if: always() - run: | - if [ "${{ steps.format-check.outcome }}" = "failure" ] || [ "${{ steps.clippy.outcome }}" = "failure" ]; then - echo "One or more checks failed" - exit 1 - fi - echo "All checks passed" diff --git a/.gitea/workflows/rust.yml b/.gitea/workflows/rust.yml new file mode 100644 index 0000000..da2d4bf --- /dev/null +++ b/.gitea/workflows/rust.yml @@ -0,0 +1,152 @@ +name: Rust + +on: + pull_request: + +jobs: + build: + runs-on: alpine + container: node:26-alpine + env: + CARGO_HOME: ${{ github.workspace }}/.cargo + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Cache cargo packages + uses: actions/cache@v4 + env: + cache-name: cache-cargo-packages + with: + path: | + .cargo/registry + .cargo/git + target + key: rust-build-${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + rust-${{ runner.os }}-build-${{ env.cache-name }}- + rust-${{ runner.os }}-build- + rust- + + - name: Install tools + run: | + apk add --no-cache \ + git \ + cargo \ + rust + + - name: Cargo check + run: | + if [ -n "$(find . -name "Cargo.toml" -print -quit)" ]; then + for manifest in $(find . -name "Cargo.toml"); do + cargo check --manifest-path "$manifest" && \ + echo "$manifest: check passed" || \ + { echo "$manifest: check failed"; exit 1; } + done + elif [ -n "$(find . -name "*.rs" -print -quit)" ]; then + echo "Rust files found but no Cargo.toml" + exit 1 + else + echo "No Rust project found" + fi + + fmt: + runs-on: alpine + container: node:26-alpine + env: + CARGO_HOME: ${{ github.workspace }}/.cargo + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Cache cargo packages + uses: actions/cache@v4 + env: + cache-name: cache-cargo-packages + with: + path: | + .cargo/registry + .cargo/git + target + key: rust-fmt-${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + rust-${{ runner.os }}-build-${{ env.cache-name }}- + rust-${{ runner.os }}-build- + rust- + + - name: Install tools + run: | + apk add --no-cache \ + git \ + cargo \ + rust \ + rustfmt + + - name: Format check + run: | + if [ -n "$(find . -name "Cargo.toml" -print -quit)" ]; then + status=0 + for manifest in $(find . -name "Cargo.toml"); do + cargo fmt --manifest-path "$manifest" --check && \ + echo "$manifest: formatting OK" || \ + { echo "$manifest: needs formatting"; status=1; } + done + exit $status + elif [ -n "$(find . -name "*.rs" -print -quit)" ]; then + echo "Rust files found but no Cargo.toml" + exit 1 + else + echo "No Rust project found" + fi + + clippy: + runs-on: alpine + container: node:26-alpine + env: + CARGO_HOME: ${{ github.workspace }}/.cargo + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Cache cargo packages + uses: actions/cache@v4 + env: + cache-name: cache-cargo-packages + with: + path: | + .cargo/registry + .cargo/git + target + key: rust-clippy-${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + rust-${{ runner.os }}-build-${{ env.cache-name }}- + rust-${{ runner.os }}-build- + rust- + + - name: Install tools + run: | + apk add --no-cache \ + git \ + cargo \ + rust \ + rust-clippy + + - name: Clippy + run: | + if [ -n "$(find . -name "Cargo.toml" -print -quit)" ]; then + status=0 + for manifest in $(find . -name "Cargo.toml"); do + cargo clippy --manifest-path "$manifest" --all-targets --all-features -- -D warnings && \ + echo "$manifest: Clippy passed" || \ + { echo "$manifest: Clippy failed"; status=1; } + done + exit $status + elif [ -n "$(find . -name "*.rs" -print -quit)" ]; then + echo "Rust files found but no Cargo.toml" + exit 1 + else + echo "No Rust project found" + fi