Enhance Packaging, Testing, and Infrastructure with Modern Tools and Features #7
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Code Quality | |
on: | |
pull_request: | |
types: [ opened, synchronize, reopened, edited, ready_for_review ] | |
jobs: | |
code-quality: | |
name: Code Quality Checks | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the repository code | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# Step 2: Install Rye (via Curl) | |
- name: Install Rye | |
uses: eifinger/setup-rye@v4 | |
with: | |
version: '0.43.0' | |
enable-cache: 'true' | |
# Step 3: Sync dependencies | |
- name: Sync dependencies | |
run: rye sync | |
# Step 4: Get changed Python files | |
- name: Get Python changed files | |
id: changed-py-files | |
uses: tj-actions/changed-files@v45 | |
with: | |
files: | | |
*.py | |
**/*.py | |
# Step 5: Run Ruff for only changed files | |
- name: Run Ruff (Lint) | |
if: steps.changed-py-files.outputs.any_changed == 'true' | |
run: | | |
echo "Running Ruff on changed files..." | |
echo "Changed files: ${{ steps.changed-py-files.outputs.all_changed_files }}" | |
rye run lint ${{ steps.changed-py-files.outputs.all_changed_files }} | |
# Step 6: Run Pyright for only changed files | |
- name: Run Pyright (Type Check) | |
if: steps.changed-py-files.outputs.any_changed == 'true' | |
run: | | |
echo "Running Pyright on changed files..." | |
echo "Changed files: ${{ steps.changed-py-files.outputs.all_changed_files }}" | |
rye run typecheck ${{ steps.changed-py-files.outputs.all_changed_files }} | |
# Step 7: Create Pylintrc file (Pylint Config) | |
- name: Create Pylintrc file | |
run: | | |
echo "[MASTER]" > .pylintrc | |
echo "max-line-length=120" >> .pylintrc | |
echo "disable=" >> .pylintrc | |
echo " C0103, # variable naming style" >> .pylintrc | |
echo " logging-format-interpolation, # prefer % formatting" >> .pylintrc | |
echo " broad-except, # catch all exceptions" >> .pylintrc | |
echo " too-many-locals, # relax constraints" >> .pylintrc | |
echo " too-few-public-methods," >> .pylintrc | |
echo " too-many-instance-attributes," >> .pylintrc | |
echo " too-many-arguments," >> .pylintrc | |
echo " import-error," >> .pylintrc | |
echo " attribute-defined-outside-init," >> .pylintrc | |
echo " redefined-outer-name" >> .pylintrc | |
# Step 8: Run Pylint for only changed files | |
- name: Run Pylint (Lint) | |
if: steps.changed-py-files.outputs.any_changed == 'true' | |
run: | | |
echo "Running Pylint on changed files..." | |
echo "Changed files: ${{ steps.changed-py-files.outputs.all_changed_files }}" | |
python -m pylint --rcfile=.pylintrc ${{ steps.changed-py-files.outputs.all_changed_files }} |