style.yml 3.3 KB

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