style.yml 3.1 KB

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