mirror of
https://github.com/agessaman/meshcore-bot.git
synced 2026-07-29 14:59:52 +00:00
- Added a `--strict` option to `validate_config.py` to fail on "Unknown section" messages, aimed at CI validation of example configs. - Updated GitHub Actions workflow to validate shipped example configs against the canonical section list using the new strict mode. - Expanded the `CANONICAL_NON_COMMAND_SECTIONS` in `config_validation.py` to include additional sections for improved validation accuracy. - Introduced a regression test to ensure example configs do not trigger unknown section warnings, maintaining consistency with the canonical list.
132 lines
3.2 KiB
YAML
132 lines
3.2 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- master
|
|
- dev
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- master
|
|
- dev
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
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/*" \
|
|
-not -path "./dist/*" \
|
|
-print0 | xargs -0 shellcheck --severity=warning
|
|
|
|
lint:
|
|
name: Lint (ruff)
|
|
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 ruff
|
|
run: pip install "ruff==0.15.15"
|
|
|
|
- name: ruff check — fail on any lint error
|
|
run: ruff check modules/ tests/
|
|
|
|
- name: Log injection check — fail on new unsanitized logger calls
|
|
run: python scripts/check_log_injection.py
|
|
|
|
- name: Config validation — fail on unrecognized sections in shipped configs
|
|
run: |
|
|
set -e
|
|
for f in config.ini.example config.ini.minimal-example config.ini.quickstart config.min.ini config-pymc.ini; do
|
|
if [ -f "$f" ]; then
|
|
echo "Validating $f"
|
|
python validate_config.py --config "$f" --strict
|
|
fi
|
|
done
|
|
|
|
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: |
|
|
pip install --upgrade pip
|
|
pip install -e ".[test]"
|
|
pip install mypy
|
|
|
|
- name: mypy — strict overrides on typed modules
|
|
run: mypy modules/ --ignore-missing-imports
|
|
|
|
test:
|
|
name: Tests (Python ${{ matrix.python-version }})
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
python-version: ["3.11", "3.12", "3.13"]
|
|
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
|