mirror of
https://github.com/agessaman/meshcore-bot.git
synced 2026-05-28 11:24:05 +00:00
infra: CI lint gates for ruff, mypy, eslint, and shellcheck
Add four jobs to .github/workflows/test.yml: - lint: ruff check modules/ tests/ — zero violations enforced - typecheck: mypy modules/ with incremental strict mode; per-module disallow_untyped_defs where applicable - lint-frontend: ESLint (eslint-plugin-html) + HTMLHint on templates/ - lint-shell: ShellCheck --severity=warning on all .sh files Add [tool.ruff] and [tool.mypy] sections to pyproject.toml. Add .eslintrc.json, .htmlhintrc, package.json for frontend tooling.
This commit is contained in:
@@ -14,7 +14,47 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
lint-frontend:
|
||||
name: Lint Frontend (HTMLHint + ESLint)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
cache: npm
|
||||
|
||||
- name: Install frontend lint tools
|
||||
run: npm ci
|
||||
|
||||
- name: HTMLHint — lint HTML templates
|
||||
run: npm run lint:html
|
||||
|
||||
- name: ESLint — lint inline JavaScript
|
||||
run: npm run lint:js
|
||||
|
||||
lint-shell:
|
||||
name: Lint Shell Scripts (ShellCheck)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install ShellCheck
|
||||
run: sudo apt-get install -y shellcheck
|
||||
|
||||
- name: ShellCheck — lint all .sh files
|
||||
run: |
|
||||
find . -name "*.sh" \
|
||||
-not -path "./.git/*" \
|
||||
-not -path "./node_modules/*" \
|
||||
-not -path "./.venv/*" \
|
||||
-not -path "./venv/*" \
|
||||
-print0 | xargs -0 shellcheck --severity=warning
|
||||
|
||||
lint:
|
||||
name: Lint (ruff)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -23,18 +63,55 @@ jobs:
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
cache: pip
|
||||
|
||||
- name: Install ruff
|
||||
run: pip install ruff
|
||||
|
||||
- name: ruff check — fail on any lint error
|
||||
run: ruff check modules/ tests/
|
||||
|
||||
typecheck:
|
||||
name: Type check (mypy)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
cache: pip
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install --upgrade pip
|
||||
pip install -e ".[test]"
|
||||
pip install ruff mypy
|
||||
pip install mypy
|
||||
|
||||
- name: Lint with ruff
|
||||
run: ruff check .
|
||||
|
||||
- name: Type check with mypy
|
||||
- name: mypy — strict overrides on typed modules
|
||||
run: mypy modules/ --ignore-missing-imports
|
||||
|
||||
- name: Run tests
|
||||
test:
|
||||
name: Tests (Python ${{ matrix.python-version }})
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: ["3.9", "3.11", "3.12"]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
cache: pip
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pip install --upgrade pip
|
||||
pip install -e ".[test]"
|
||||
|
||||
- name: Run tests with coverage
|
||||
run: pytest tests/ -v --tb=short
|
||||
|
||||
Reference in New Issue
Block a user