ruff-linter.yml 1.3 KB

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