forked from vllm-project/vllm
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pre_commit as it is now doesn't run the linters. Until it is figured …
…out returning the explicit linter workflows
- Loading branch information
Showing
9 changed files
with
375 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Lint GitHub Actions workflows | ||
on: | ||
push: | ||
branches: | ||
- "main" | ||
- "develop" | ||
paths: | ||
- '.github/workflows/*.ya?ml' | ||
- '.github/workflows/actionlint.*' | ||
- '.github/workflows/matchers/actionlint.json' | ||
pull_request: | ||
branches: | ||
- "main" | ||
paths: | ||
- '.github/workflows/*.ya?ml' | ||
- '.github/workflows/actionlint.*' | ||
- '.github/workflows/matchers/actionlint.json' | ||
|
||
env: | ||
LC_ALL: en_US.UTF-8 | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
actionlint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: "Run actionlint" | ||
run: | | ||
echo "::add-matcher::.github/workflows/matchers/actionlint.json" | ||
tools/actionlint.sh -color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: clang-format | ||
|
||
on: | ||
# Trigger the workflow on push or pull request, | ||
# but only for the main branch | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
paths: | ||
- '**/*.h' | ||
- '**/*.cpp' | ||
- '**/*.cu' | ||
- '**/*.cuh' | ||
- '.github/workflows/clang-format.yml' | ||
pull_request: | ||
branches: | ||
- main | ||
- develop | ||
paths: | ||
- '**/*.h' | ||
- '**/*.cpp' | ||
- '**/*.cu' | ||
- '**/*.cuh' | ||
- '.github/workflows/clang-format.yml' | ||
|
||
jobs: | ||
clang-format: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.11"] | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install clang-format==18.1.5 | ||
- name: Running clang-format | ||
run: | | ||
EXCLUDES=( | ||
'csrc/moe/topk_softmax_kernels.cu' | ||
'csrc/quantization/gguf/ggml-common.h' | ||
'csrc/quantization/gguf/dequantize.cuh' | ||
'csrc/quantization/gguf/vecdotq.cuh' | ||
'csrc/quantization/gguf/mmq.cuh' | ||
'csrc/quantization/gguf/mmvq.cuh' | ||
) | ||
find csrc/ \( -name '*.h' -o -name '*.cpp' -o -name '*.cu' -o -name '*.cuh' \) -print \ | ||
| grep -vFf <(printf "%s\n" "${EXCLUDES[@]}") \ | ||
| xargs clang-format --dry-run --Werror |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: codespell | ||
|
||
on: | ||
# Trigger the workflow on push or pull request, | ||
# but only for the main branch | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
paths: | ||
- "**/*.py" | ||
- "**/*.md" | ||
- "**/*.rst" | ||
- pyproject.toml | ||
- requirements-lint.txt | ||
- .github/workflows/codespell.yml | ||
pull_request: | ||
branches: | ||
- main | ||
- develop | ||
paths: | ||
- "**/*.py" | ||
- "**/*.md" | ||
- "**/*.rst" | ||
- pyproject.toml | ||
- requirements-lint.txt | ||
- .github/workflows/codespell.yml | ||
|
||
jobs: | ||
codespell: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.12"] | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements-lint.txt | ||
- name: Spelling check with codespell | ||
run: | | ||
codespell --toml pyproject.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Lint documentation | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "docs/**" | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- "docs/**" | ||
|
||
jobs: | ||
doc-lint: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.12"] | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements-lint.txt | ||
- name: Linting docs | ||
run: tools/doc-lint.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"problemMatcher": [ | ||
{ | ||
"owner": "ruff", | ||
"pattern": [ | ||
{ | ||
"regexp": "^(.+?):(\\d+):(\\d+): (\\w+): (.+)$", | ||
"file": 1, | ||
"line": 2, | ||
"column": 3, | ||
"code": 4, | ||
"message": 5 | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: mypy | ||
|
||
on: | ||
# Trigger the workflow on push or pull request, | ||
# but only for the main branch | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
paths: | ||
- '**/*.py' | ||
- '.github/workflows/mypy.yaml' | ||
- 'tools/mypy.sh' | ||
- 'pyproject.toml' | ||
pull_request: | ||
branches: | ||
- main | ||
- develop | ||
# This workflow is only relevant when one of the following files changes. | ||
# However, we have github configured to expect and require this workflow | ||
# to run and pass before github with auto-merge a pull request. Until github | ||
# allows more flexible auto-merge policy, we can just run this on every PR. | ||
# It doesn't take that long to run, anyway. | ||
#paths: | ||
# - '**/*.py' | ||
# - '.github/workflows/mypy.yaml' | ||
# - 'tools/mypy.sh' | ||
# - 'pyproject.toml' | ||
|
||
jobs: | ||
mypy: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.9", "3.10", "3.11", "3.12"] | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install mypy==1.11.1 | ||
pip install types-setuptools | ||
pip install types-PyYAML | ||
pip install types-requests | ||
pip install types-setuptools | ||
- name: Mypy | ||
run: | | ||
echo "::add-matcher::.github/workflows/matchers/mypy.json" | ||
tools/mypy.sh 1 ${{ matrix.python-version }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: ruff | ||
|
||
on: | ||
# Trigger the workflow on push or pull request, | ||
# but only for the main branch | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
paths: | ||
- "**/*.py" | ||
- pyproject.toml | ||
- requirements-lint.txt | ||
- .github/workflows/matchers/ruff.json | ||
- .github/workflows/ruff.yml | ||
pull_request: | ||
branches: | ||
- main | ||
- develop | ||
# This workflow is only relevant when one of the following files changes. | ||
# However, we have github configured to expect and require this workflow | ||
# to run and pass before github with auto-merge a pull request. Until github | ||
# allows more flexible auto-merge policy, we can just run this on every PR. | ||
# It doesn't take that long to run, anyway. | ||
#paths: | ||
# - "**/*.py" | ||
# - pyproject.toml | ||
# - requirements-lint.txt | ||
# - .github/workflows/matchers/ruff.json | ||
# - .github/workflows/ruff.yml | ||
|
||
jobs: | ||
ruff: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.12"] | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements-lint.txt | ||
- name: Analysing the code with ruff | ||
run: | | ||
echo "::add-matcher::.github/workflows/matchers/ruff.json" | ||
ruff check --output-format github . | ||
- name: Run isort | ||
run: | | ||
isort . --check-only |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Lint shell scripts | ||
on: | ||
push: | ||
branches: | ||
- "main" | ||
- "develop" | ||
paths: | ||
- '**/*.sh' | ||
- '.github/workflows/shellcheck.yml' | ||
pull_request: | ||
branches: | ||
- "main" | ||
- "develop" | ||
paths: | ||
- '**/*.sh' | ||
- '.github/workflows/shellcheck.yml' | ||
|
||
env: | ||
LC_ALL: en_US.UTF-8 | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
shellcheck: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: "Check shell scripts" | ||
run: | | ||
tools/shellcheck.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: yapf | ||
|
||
on: | ||
# Trigger the workflow on push or pull request, | ||
# but only for the main branch | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
paths: | ||
- "**/*.py" | ||
- .github/workflows/yapf.yml | ||
pull_request: | ||
branches: | ||
- main | ||
- develop | ||
|
||
jobs: | ||
yapf: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.12"] | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install yapf==0.32.0 | ||
pip install toml==0.10.2 | ||
- name: Running yapf | ||
run: | | ||
yapf --diff --recursive . |