Spaces:
No application file
No application file
Upload .github\workflows\style.yml with huggingface_hub
Browse files- .github//workflows//style.yml +165 -0
.github//workflows//style.yml
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Style check
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
pull_request:
|
| 5 |
+
branches:
|
| 6 |
+
- main
|
| 7 |
+
|
| 8 |
+
concurrency:
|
| 9 |
+
group: style-${{ github.head_ref || github.run_id }}
|
| 10 |
+
cancel-in-progress: true
|
| 11 |
+
|
| 12 |
+
jobs:
|
| 13 |
+
python-style:
|
| 14 |
+
name: Python Style
|
| 15 |
+
runs-on: ubuntu-latest
|
| 16 |
+
|
| 17 |
+
steps:
|
| 18 |
+
- name: Checkout code
|
| 19 |
+
uses: actions/checkout@v4
|
| 20 |
+
with:
|
| 21 |
+
fetch-depth: 0
|
| 22 |
+
persist-credentials: false
|
| 23 |
+
|
| 24 |
+
- name: Check changed files
|
| 25 |
+
id: changed-files
|
| 26 |
+
uses: tj-actions/changed-files@v45
|
| 27 |
+
with:
|
| 28 |
+
files: |
|
| 29 |
+
api/**
|
| 30 |
+
.github/workflows/style.yml
|
| 31 |
+
|
| 32 |
+
- name: Setup Poetry and Python
|
| 33 |
+
if: steps.changed-files.outputs.any_changed == 'true'
|
| 34 |
+
uses: ./.github/actions/setup-poetry
|
| 35 |
+
|
| 36 |
+
- name: Install dependencies
|
| 37 |
+
if: steps.changed-files.outputs.any_changed == 'true'
|
| 38 |
+
run: poetry install -C api --only lint
|
| 39 |
+
|
| 40 |
+
- name: Ruff check
|
| 41 |
+
if: steps.changed-files.outputs.any_changed == 'true'
|
| 42 |
+
run: |
|
| 43 |
+
poetry run -C api ruff --version
|
| 44 |
+
poetry run -C api ruff check ./
|
| 45 |
+
poetry run -C api ruff format --check ./
|
| 46 |
+
|
| 47 |
+
- name: Dotenv check
|
| 48 |
+
if: steps.changed-files.outputs.any_changed == 'true'
|
| 49 |
+
run: poetry run -P api dotenv-linter ./api/.env.example ./web/.env.example
|
| 50 |
+
|
| 51 |
+
- name: Lint hints
|
| 52 |
+
if: failure()
|
| 53 |
+
run: echo "Please run 'dev/reformat' to fix the fixable linting errors."
|
| 54 |
+
|
| 55 |
+
web-style:
|
| 56 |
+
name: Web Style
|
| 57 |
+
runs-on: ubuntu-latest
|
| 58 |
+
defaults:
|
| 59 |
+
run:
|
| 60 |
+
working-directory: ./web
|
| 61 |
+
|
| 62 |
+
steps:
|
| 63 |
+
- name: Checkout code
|
| 64 |
+
uses: actions/checkout@v4
|
| 65 |
+
with:
|
| 66 |
+
fetch-depth: 0
|
| 67 |
+
persist-credentials: false
|
| 68 |
+
|
| 69 |
+
- name: Check changed files
|
| 70 |
+
id: changed-files
|
| 71 |
+
uses: tj-actions/changed-files@v45
|
| 72 |
+
with:
|
| 73 |
+
files: web/**
|
| 74 |
+
|
| 75 |
+
- name: Install pnpm
|
| 76 |
+
uses: pnpm/action-setup@v4
|
| 77 |
+
with:
|
| 78 |
+
version: 10
|
| 79 |
+
run_install: false
|
| 80 |
+
|
| 81 |
+
- name: Setup NodeJS
|
| 82 |
+
uses: actions/setup-node@v4
|
| 83 |
+
if: steps.changed-files.outputs.any_changed == 'true'
|
| 84 |
+
with:
|
| 85 |
+
node-version: 20
|
| 86 |
+
cache: pnpm
|
| 87 |
+
cache-dependency-path: ./web/package.json
|
| 88 |
+
|
| 89 |
+
- name: Web dependencies
|
| 90 |
+
if: steps.changed-files.outputs.any_changed == 'true'
|
| 91 |
+
run: pnpm install
|
| 92 |
+
|
| 93 |
+
- name: Web style check
|
| 94 |
+
if: steps.changed-files.outputs.any_changed == 'true'
|
| 95 |
+
run: pnpm run lint
|
| 96 |
+
|
| 97 |
+
docker-compose-template:
|
| 98 |
+
name: Docker Compose Template
|
| 99 |
+
runs-on: ubuntu-latest
|
| 100 |
+
|
| 101 |
+
steps:
|
| 102 |
+
- name: Checkout code
|
| 103 |
+
uses: actions/checkout@v4
|
| 104 |
+
with:
|
| 105 |
+
fetch-depth: 0
|
| 106 |
+
persist-credentials: false
|
| 107 |
+
|
| 108 |
+
- name: Check changed files
|
| 109 |
+
id: changed-files
|
| 110 |
+
uses: tj-actions/changed-files@v45
|
| 111 |
+
with:
|
| 112 |
+
files: |
|
| 113 |
+
docker/generate_docker_compose
|
| 114 |
+
docker/.env.example
|
| 115 |
+
docker/docker-compose-template.yaml
|
| 116 |
+
docker/docker-compose.yaml
|
| 117 |
+
|
| 118 |
+
- name: Generate Docker Compose
|
| 119 |
+
if: steps.changed-files.outputs.any_changed == 'true'
|
| 120 |
+
run: |
|
| 121 |
+
cd docker
|
| 122 |
+
./generate_docker_compose
|
| 123 |
+
|
| 124 |
+
- name: Check for changes
|
| 125 |
+
if: steps.changed-files.outputs.any_changed == 'true'
|
| 126 |
+
run: git diff --exit-code
|
| 127 |
+
|
| 128 |
+
superlinter:
|
| 129 |
+
name: SuperLinter
|
| 130 |
+
runs-on: ubuntu-latest
|
| 131 |
+
|
| 132 |
+
steps:
|
| 133 |
+
- name: Checkout code
|
| 134 |
+
uses: actions/checkout@v4
|
| 135 |
+
with:
|
| 136 |
+
fetch-depth: 0
|
| 137 |
+
persist-credentials: false
|
| 138 |
+
|
| 139 |
+
- name: Check changed files
|
| 140 |
+
id: changed-files
|
| 141 |
+
uses: tj-actions/changed-files@v45
|
| 142 |
+
with:
|
| 143 |
+
files: |
|
| 144 |
+
**.sh
|
| 145 |
+
**.yaml
|
| 146 |
+
**.yml
|
| 147 |
+
**Dockerfile
|
| 148 |
+
dev/**
|
| 149 |
+
|
| 150 |
+
- name: Super-linter
|
| 151 |
+
uses: super-linter/super-linter/slim@v7
|
| 152 |
+
if: steps.changed-files.outputs.any_changed == 'true'
|
| 153 |
+
env:
|
| 154 |
+
BASH_SEVERITY: warning
|
| 155 |
+
DEFAULT_BRANCH: main
|
| 156 |
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
| 157 |
+
IGNORE_GENERATED_FILES: true
|
| 158 |
+
IGNORE_GITIGNORED_FILES: true
|
| 159 |
+
VALIDATE_BASH: true
|
| 160 |
+
VALIDATE_BASH_EXEC: true
|
| 161 |
+
# FIXME: temporarily disabled until api-docker.yaml's run script is fixed for shellcheck
|
| 162 |
+
# VALIDATE_GITHUB_ACTIONS: true
|
| 163 |
+
VALIDATE_DOCKERFILE_HADOLINT: true
|
| 164 |
+
VALIDATE_XML: true
|
| 165 |
+
VALIDATE_YAML: true
|