2024-06-30 21:11:55 +00:00
|
|
|
---
|
|
|
|
name: Validation
|
|
|
|
|
|
|
|
on: workflow_call
|
|
|
|
|
|
|
|
env:
|
|
|
|
PRE_COMMIT_HOME: "/home/runner/.cache/pre-commit"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
lint:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- name: Setup poetry
|
|
|
|
id: poetry_setup
|
|
|
|
uses: ItsDrike/setup-poetry@v1
|
|
|
|
with:
|
|
|
|
python-version: 3.12
|
|
|
|
install-args: "--without release"
|
|
|
|
|
|
|
|
- name: Pre-commit Environment Caching
|
|
|
|
uses: actions/cache@v4
|
|
|
|
with:
|
|
|
|
path: ${{ env.PRE_COMMIT_HOME }}
|
|
|
|
key:
|
|
|
|
"precommit-${{ runner.os }}-${{ steps.poetry_setup.outputs.python-version }}-\
|
|
|
|
${{ hashFiles('./.pre-commit-config.yaml') }}"
|
|
|
|
# Restore keys allows us to perform a cache restore even if the full cache key wasn't matched.
|
|
|
|
# That way we still end up saving new cache, but we can still make use of the cache from previous
|
|
|
|
# version.
|
|
|
|
restore-keys: "precommit-${{ runner.os }}-${{ steps.poetry_setup.outputs-python-version}}-"
|
|
|
|
|
|
|
|
- name: Run pre-commit hooks
|
2024-07-10 15:30:22 +00:00
|
|
|
run: SKIP=ruff-linter,ruff-formatter,slotscheck,basedpyright pre-commit run --all-files
|
2024-06-30 21:11:55 +00:00
|
|
|
|
|
|
|
- name: Run ruff linter
|
|
|
|
run: ruff check --output-format=github --show-fixes --exit-non-zero-on-fix .
|
|
|
|
|
|
|
|
- name: Run ruff formatter
|
|
|
|
run: ruff format --diff .
|
|
|
|
|
|
|
|
- name: Run slotscheck
|
|
|
|
run: slotscheck -m mcproto
|
|
|
|
|
2024-07-10 15:30:22 +00:00
|
|
|
- name: Run basedpyright type checker
|
|
|
|
run: basedpyright .
|