style.yml 3.2 KB

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