ruff-linter.yml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. name: CI
  2. on:
  3. pull_request:
  4. branches: [ "main", "develop" ]
  5. push:
  6. branches: [ "main", "develop" ]
  7. # Cancel previous runs if a new one is triggered
  8. concurrency:
  9. group: ${{ github.workflow }}-${{ github.ref }}
  10. cancel-in-progress: true
  11. jobs:
  12. lint:
  13. name: Code Linting
  14. runs-on: ubuntu-latest
  15. timeout-minutes: 10
  16. steps:
  17. - name: Checkout repository
  18. uses: actions/checkout@v4
  19. with:
  20. fetch-depth: 0
  21. - name: Set up Python
  22. uses: actions/setup-python@v5
  23. with:
  24. python-version: "3.11"
  25. cache: 'pip'
  26. - name: Install dependencies
  27. run: |
  28. python -m pip install --upgrade pip
  29. pip install ruff
  30. - name: Run Ruff linter
  31. run: ruff check . --output-format=github
  32. - name: Run Ruff formatter check
  33. run: ruff format . --check
  34. - name: Show statistics
  35. run: ruff check . --statistics
  36. - name: Generate lint report
  37. if: always()
  38. run: |
  39. ruff check . --output-format=json > ruff-report.json || true
  40. - name: Upload lint report
  41. uses: actions/upload-artifact@v4
  42. if: always()
  43. with:
  44. name: lint-report
  45. path: ruff-report.json
  46. retention-days: 30