lint.yml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # Workflow that runs lint on the frontend and python code
  2. name: Lint
  3. # The jobs in this workflow are required, so they must run at all times
  4. # Always run on "main"
  5. # Always run on PRs
  6. on:
  7. push:
  8. branches:
  9. - main
  10. pull_request:
  11. # If triggered by a PR, it will be in the same group. However, each commit on main will be in its own unique group
  12. concurrency:
  13. group: ${{ github.workflow }}-${{ (github.head_ref && github.ref) || github.run_id }}
  14. cancel-in-progress: true
  15. jobs:
  16. # Run lint on the frontend code
  17. lint-frontend:
  18. name: Lint frontend
  19. runs-on: ubuntu-latest
  20. steps:
  21. - uses: actions/checkout@v4
  22. - name: Install Node.js 20
  23. uses: actions/setup-node@v4
  24. with:
  25. node-version: 20
  26. - name: Install dependencies
  27. run: |
  28. cd frontend
  29. npm install --frozen-lockfile
  30. - name: Lint and TypeScript compilation
  31. run: |
  32. cd frontend
  33. npm run lint
  34. npm run make-i18n && tsc
  35. # Run lint on the python code
  36. lint-python:
  37. name: Lint python
  38. runs-on: ubuntu-latest
  39. steps:
  40. - uses: actions/checkout@v4
  41. with:
  42. fetch-depth: 0
  43. - name: Set up python
  44. uses: actions/setup-python@v5
  45. with:
  46. python-version: 3.12
  47. cache: 'pip'
  48. - name: Install pre-commit
  49. run: pip install pre-commit==3.7.0
  50. - name: Run pre-commit hooks
  51. run: pre-commit run --files openhands/**/* evaluation/**/* tests/**/* --show-diff-on-failure --config ./dev_config/python/.pre-commit-config.yaml