Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

style.yml 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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. permissions:
  10. checks: write
  11. statuses: write
  12. contents: read
  13. jobs:
  14. python-style:
  15. name: Python Style
  16. runs-on: ubuntu-latest
  17. steps:
  18. - name: Checkout code
  19. uses: actions/checkout@v4
  20. with:
  21. persist-credentials: false
  22. - name: Check changed files
  23. id: changed-files
  24. uses: tj-actions/changed-files@v46
  25. with:
  26. files: |
  27. api/**
  28. .github/workflows/style.yml
  29. - name: Setup UV and Python
  30. if: steps.changed-files.outputs.any_changed == 'true'
  31. uses: ./.github/actions/setup-uv
  32. with:
  33. uv-lockfile: api/uv.lock
  34. enable-cache: false
  35. - name: Install dependencies
  36. if: steps.changed-files.outputs.any_changed == 'true'
  37. run: uv sync --project api --dev
  38. - name: Ruff check
  39. if: steps.changed-files.outputs.any_changed == 'true'
  40. run: |
  41. uv run --directory api ruff --version
  42. uv run --directory api ruff check --diff ./
  43. uv run --directory api ruff format --check --diff ./
  44. - name: Dotenv check
  45. if: steps.changed-files.outputs.any_changed == 'true'
  46. run: uv run --project api dotenv-linter ./api/.env.example ./web/.env.example
  47. - name: Lint hints
  48. if: failure()
  49. run: echo "Please run 'dev/reformat' to fix the fixable linting errors."
  50. web-style:
  51. name: Web Style
  52. runs-on: ubuntu-latest
  53. defaults:
  54. run:
  55. working-directory: ./web
  56. steps:
  57. - name: Checkout code
  58. uses: actions/checkout@v4
  59. with:
  60. persist-credentials: false
  61. - name: Check changed files
  62. id: changed-files
  63. uses: tj-actions/changed-files@v46
  64. with:
  65. files: web/**
  66. - name: Install pnpm
  67. uses: pnpm/action-setup@v4
  68. with:
  69. version: 10
  70. run_install: false
  71. - name: Setup NodeJS
  72. uses: actions/setup-node@v4
  73. if: steps.changed-files.outputs.any_changed == 'true'
  74. with:
  75. node-version: 22
  76. cache: pnpm
  77. cache-dependency-path: ./web/package.json
  78. - name: Web dependencies
  79. if: steps.changed-files.outputs.any_changed == 'true'
  80. run: pnpm install --frozen-lockfile
  81. - name: Web style check
  82. if: steps.changed-files.outputs.any_changed == 'true'
  83. run: pnpm run lint
  84. docker-compose-template:
  85. name: Docker Compose Template
  86. runs-on: ubuntu-latest
  87. steps:
  88. - name: Checkout code
  89. uses: actions/checkout@v4
  90. with:
  91. persist-credentials: false
  92. - name: Check changed files
  93. id: changed-files
  94. uses: tj-actions/changed-files@v46
  95. with:
  96. files: |
  97. docker/generate_docker_compose
  98. docker/.env.example
  99. docker/docker-compose-template.yaml
  100. docker/docker-compose.yaml
  101. - name: Generate Docker Compose
  102. if: steps.changed-files.outputs.any_changed == 'true'
  103. run: |
  104. cd docker
  105. ./generate_docker_compose
  106. - name: Check for changes
  107. if: steps.changed-files.outputs.any_changed == 'true'
  108. run: git diff --exit-code
  109. superlinter:
  110. name: SuperLinter
  111. runs-on: ubuntu-latest
  112. steps:
  113. - name: Checkout code
  114. uses: actions/checkout@v4
  115. with:
  116. fetch-depth: 0
  117. persist-credentials: false
  118. - name: Check changed files
  119. id: changed-files
  120. uses: tj-actions/changed-files@v46
  121. with:
  122. files: |
  123. **.sh
  124. **.yaml
  125. **.yml
  126. **Dockerfile
  127. dev/**
  128. .editorconfig
  129. - name: Super-linter
  130. uses: super-linter/super-linter/slim@v8
  131. if: steps.changed-files.outputs.any_changed == 'true'
  132. env:
  133. BASH_SEVERITY: warning
  134. DEFAULT_BRANCH: origin/main
  135. EDITORCONFIG_FILE_NAME: editorconfig-checker.json
  136. FILTER_REGEX_INCLUDE: pnpm-lock.yaml
  137. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  138. IGNORE_GENERATED_FILES: true
  139. IGNORE_GITIGNORED_FILES: true
  140. VALIDATE_BASH: true
  141. VALIDATE_BASH_EXEC: true
  142. # FIXME: temporarily disabled until api-docker.yaml's run script is fixed for shellcheck
  143. # VALIDATE_GITHUB_ACTIONS: true
  144. VALIDATE_DOCKERFILE_HADOLINT: true
  145. VALIDATE_EDITORCONFIG: true
  146. VALIDATE_XML: true
  147. VALIDATE_YAML: true