117 lines
3 KiB
YAML
117 lines
3 KiB
YAML
name: Code Quality
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [main]
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
changes:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
lua: ${{ steps.changes.outputs.lua }}
|
|
python: ${{ steps.changes.outputs.python }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dorny/paths-filter@v3
|
|
id: changes
|
|
with:
|
|
filters: |
|
|
lua:
|
|
- 'lua/**'
|
|
- 'spec/**'
|
|
- 'plugin/**'
|
|
- 'after/**'
|
|
- 'ftdetect/**'
|
|
- '*.lua'
|
|
- '.luarc.json'
|
|
- 'stylua.toml'
|
|
- 'selene.toml'
|
|
python:
|
|
- 'scrapers/**'
|
|
- 'tests/scrapers/**'
|
|
- 'pyproject.toml'
|
|
- 'uv.lock'
|
|
|
|
lua-format:
|
|
name: Lua Format Check
|
|
runs-on: ubuntu-latest
|
|
needs: changes
|
|
if: ${{ needs.changes.outputs.lua == 'true' }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: JohnnyMorganz/stylua-action@v4
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
version: 2.1.0
|
|
args: --check .
|
|
|
|
lua-lint:
|
|
name: Lua Lint Check
|
|
runs-on: ubuntu-latest
|
|
needs: changes
|
|
if: ${{ needs.changes.outputs.lua == 'true' }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Lint with Selene
|
|
uses: NTBBloodbath/selene-action@v1.0.0
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
args: --display-style quiet .
|
|
|
|
lua-typecheck:
|
|
name: Lua Type Check
|
|
runs-on: ubuntu-latest
|
|
needs: changes
|
|
if: ${{ needs.changes.outputs.lua == 'true' }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Run Lua LS Type Check
|
|
uses: mrcjkb/lua-typecheck-action@v0
|
|
with:
|
|
checklevel: Warning
|
|
directories: lua
|
|
configpath: .luarc.json
|
|
|
|
python-format:
|
|
name: Python Format Check
|
|
runs-on: ubuntu-latest
|
|
needs: changes
|
|
if: ${{ needs.changes.outputs.python == 'true' }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v4
|
|
- name: Install ruff
|
|
run: uv tool install ruff
|
|
- name: Check Python formatting with ruff
|
|
run: ruff format --check scrapers/ tests/scrapers/
|
|
|
|
python-lint:
|
|
name: Python Lint Check
|
|
runs-on: ubuntu-latest
|
|
needs: changes
|
|
if: ${{ needs.changes.outputs.python == 'true' }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v4
|
|
- name: Install ruff
|
|
run: uv tool install ruff
|
|
- name: Lint Python files with ruff
|
|
run: ruff check scrapers/ tests/scrapers/
|
|
|
|
python-typecheck:
|
|
name: Python Type Check
|
|
runs-on: ubuntu-latest
|
|
needs: changes
|
|
if: ${{ needs.changes.outputs.python == 'true' }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v4
|
|
- name: Install dependencies with mypy
|
|
run: uv sync --dev
|
|
- name: Type check Python files with mypy
|
|
run: uv run mypy scrapers/ tests/scrapers/
|