ops: Add mypy and pyright to the code quality workflow
This commit is contained in:
@@ -51,7 +51,9 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install bandit[toml] ruff vermin
|
||||
pip install bandit[toml] ruff vermin mypy pyright
|
||||
pip install -e ".[all]"
|
||||
pip install lxml-stubs
|
||||
|
||||
- name: Run Bandit (Security Linter)
|
||||
id: bandit
|
||||
@@ -86,6 +88,22 @@ jobs:
|
||||
vermin -t=3.10- --violations --eval-annotations --no-tips scrapling/
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Run Mypy (Static Type Checker)
|
||||
id: mypy
|
||||
continue-on-error: true
|
||||
run: |
|
||||
echo "::group::Mypy - Static Type Checker"
|
||||
mypy scrapling/
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Run Pyright (Static Type Checker)
|
||||
id: pyright
|
||||
continue-on-error: true
|
||||
run: |
|
||||
echo "::group::Pyright - Static Type Checker"
|
||||
pyright scrapling/
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Check results and create summary
|
||||
if: always()
|
||||
run: |
|
||||
@@ -127,6 +145,22 @@ jobs:
|
||||
all_passed=false
|
||||
fi
|
||||
|
||||
# Check Mypy
|
||||
if [ "${{ steps.mypy.outcome }}" == "success" ]; then
|
||||
echo "✅ **Mypy (Type Checker)**: Passed" >> $GITHUB_STEP_SUMMARY
|
||||
else
|
||||
echo "❌ **Mypy (Type Checker)**: Failed" >> $GITHUB_STEP_SUMMARY
|
||||
all_passed=false
|
||||
fi
|
||||
|
||||
# Check Pyright
|
||||
if [ "${{ steps.pyright.outcome }}" == "success" ]; then
|
||||
echo "✅ **Pyright (Type Checker)**: Passed" >> $GITHUB_STEP_SUMMARY
|
||||
else
|
||||
echo "❌ **Pyright (Type Checker)**: Failed" >> $GITHUB_STEP_SUMMARY
|
||||
all_passed=false
|
||||
fi
|
||||
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
if [ "$all_passed" == "true" ]; then
|
||||
|
||||
+13
-1
@@ -105,4 +105,16 @@ include-package-data = true
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
where = ["."]
|
||||
include = ["scrapling*"]
|
||||
include = ["scrapling*"]
|
||||
|
||||
[tool.mypy]
|
||||
python_version = "3.10"
|
||||
warn_unused_configs = true
|
||||
ignore_missing_imports = true
|
||||
check_untyped_defs = true
|
||||
|
||||
[tool.pyright]
|
||||
pythonVersion = "3.10"
|
||||
typeCheckingMode = "basic"
|
||||
include = ["scrapling"]
|
||||
ignore = ["tests", "benchmarks.py"]
|
||||
Reference in New Issue
Block a user