style.yml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. name: Style check
  2. on:
  3. pull_request:
  4. branches:
  5. - main
  6. concurrency:
  7. group: style-${{ github.head_ref || github.run_id }}
  8. cancel-in-progress: true
  9. jobs:
  10. python-style:
  11. name: Python Style
  12. runs-on: ubuntu-latest
  13. steps:
  14. - name: Checkout code
  15. uses: actions/checkout@v4
  16. - name: Check changed files
  17. id: changed-files
  18. uses: tj-actions/changed-files@v45
  19. with:
  20. files: api/**
  21. - name: Set up Python
  22. uses: actions/setup-python@v5
  23. if: steps.changed-files.outputs.any_changed == 'true'
  24. with:
  25. python-version: '3.10'
  26. - name: Install Poetry
  27. uses: abatilo/actions-poetry@v3
  28. - name: Python dependencies
  29. if: steps.changed-files.outputs.any_changed == 'true'
  30. run: poetry install -C api --only lint
  31. - name: Ruff check
  32. if: steps.changed-files.outputs.any_changed == 'true'
  33. run: poetry run -C api ruff check ./api
  34. - name: Dotenv check
  35. if: steps.changed-files.outputs.any_changed == 'true'
  36. run: poetry run -C api dotenv-linter ./api/.env.example ./web/.env.example
  37. - name: Ruff formatter check
  38. if: steps.changed-files.outputs.any_changed == 'true'
  39. run: poetry run -C api ruff format --check ./api
  40. - name: Lint hints
  41. if: failure()
  42. run: echo "Please run 'dev/reformat' to fix the fixable linting errors."
  43. web-style:
  44. name: Web Style
  45. runs-on: ubuntu-latest
  46. defaults:
  47. run:
  48. working-directory: ./web
  49. steps:
  50. - name: Checkout code
  51. uses: actions/checkout@v4
  52. - name: Check changed files
  53. id: changed-files
  54. uses: tj-actions/changed-files@v45
  55. with:
  56. files: web/**
  57. - name: Setup NodeJS
  58. uses: actions/setup-node@v4
  59. if: steps.changed-files.outputs.any_changed == 'true'
  60. with:
  61. node-version: 20
  62. cache: yarn
  63. cache-dependency-path: ./web/package.json
  64. - name: Web dependencies
  65. if: steps.changed-files.outputs.any_changed == 'true'
  66. run: yarn install --frozen-lockfile
  67. - name: Web style check
  68. if: steps.changed-files.outputs.any_changed == 'true'
  69. run: yarn run lint
  70. superlinter:
  71. name: SuperLinter
  72. runs-on: ubuntu-latest
  73. steps:
  74. - name: Checkout code
  75. uses: actions/checkout@v4
  76. - name: Check changed files
  77. id: changed-files
  78. uses: tj-actions/changed-files@v45
  79. with:
  80. files: |
  81. **.sh
  82. **.yaml
  83. **.yml
  84. **Dockerfile
  85. dev/**
  86. - name: Super-linter
  87. uses: super-linter/super-linter/slim@v7
  88. if: steps.changed-files.outputs.any_changed == 'true'
  89. env:
  90. BASH_SEVERITY: warning
  91. DEFAULT_BRANCH: main
  92. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  93. IGNORE_GENERATED_FILES: true
  94. IGNORE_GITIGNORED_FILES: true
  95. VALIDATE_BASH: true
  96. VALIDATE_BASH_EXEC: true
  97. # FIXME: temporarily disabled until api-docker.yaml's run script is fixed for shellcheck
  98. # VALIDATE_GITHUB_ACTIONS: true
  99. VALIDATE_DOCKERFILE_HADOLINT: true
  100. VALIDATE_XML: true
  101. VALIDATE_YAML: true