-
Notifications
You must be signed in to change notification settings - Fork 281
[CI] Move linting system to pre-commits hooks #1241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Potabk
wants to merge
6
commits into
vllm-project:main
Choose a base branch
from
Potabk:lint
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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,31 @@ | ||
name: pre-commit | ||
|
||
on: | ||
workflow_call: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 | ||
with: | ||
python-version: "3.10" | ||
- run: echo "::add-matcher::.github/workflows/matchers/actionlint.json" | ||
- run: echo "::add-matcher::.github/workflows/matchers/mypy.json" | ||
- name: Checkout vllm-project/vllm repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: vllm-project/vllm | ||
path: vllm-empty | ||
- name: Install vllm | ||
working-directory: vllm-empty | ||
run: | | ||
pip install -r requirements/build.txt --extra-index-url https://download.pytorch.org/whl/cpu | ||
VLLM_TARGET_DEVICE=empty pip install -e . | ||
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 | ||
with: | ||
extra_args: --all-files --hook-stage manual |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
This file contains hidden or 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,130 @@ | ||
default_install_hook_types: | ||
- pre-commit | ||
- commit-msg | ||
default_stages: | ||
- pre-commit # Run locally | ||
- manual # Run in CI | ||
exclude: 'examples/.*' # Exclude examples from all hooks by default | ||
repos: | ||
- repo: https://github.com/google/yapf | ||
rev: v0.43.0 | ||
hooks: | ||
- id: yapf | ||
args: [--in-place, --verbose] | ||
# Keep the same list from yapfignore here to avoid yapf failing without any inputs | ||
exclude: '(.github|benchmarks|examples|docs)/.*' | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.11.7 | ||
hooks: | ||
- id: ruff | ||
args: [--output-format, github, --fix] | ||
- id: ruff-format | ||
files: ^(.github|benchmarks|examples|docs)/.* | ||
- repo: https://github.com/crate-ci/typos | ||
rev: v1.32.0 | ||
hooks: | ||
- id: typos | ||
- repo: https://github.com/PyCQA/isort | ||
rev: 6.0.1 | ||
hooks: | ||
- id: isort | ||
- repo: https://github.com/pre-commit/mirrors-clang-format | ||
rev: v20.1.3 | ||
hooks: | ||
- id: clang-format | ||
exclude: '' | ||
types_or: [c++] | ||
args: [--style=file, --verbose] | ||
- repo: https://github.com/jackdewinter/pymarkdown | ||
rev: v0.9.29 | ||
hooks: | ||
- id: pymarkdown | ||
args: [fix] | ||
- repo: local | ||
hooks: | ||
- id: mypy-local | ||
name: Run mypy for local Python installation | ||
entry: tools/mypy.sh 0 "local" | ||
language: python | ||
types: [python] | ||
additional_dependencies: &mypy_deps [mypy==1.11.1, types-cachetools, types-setuptools, types-PyYAML, types-requests, pydantic] | ||
stages: [pre-commit] # Don't run in CI | ||
- id: mypy-3.9 # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward | ||
name: Run mypy for Python 3.9 | ||
entry: tools/mypy.sh 1 "3.9" | ||
language: python | ||
types: [python] | ||
additional_dependencies: *mypy_deps | ||
stages: [manual] # Only run in CI | ||
- id: mypy-3.10 # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward | ||
name: Run mypy for Python 3.10 | ||
entry: tools/mypy.sh 1 "3.10" | ||
language: python | ||
types: [python] | ||
additional_dependencies: *mypy_deps | ||
stages: [manual] # Only run in CI | ||
- id: mypy-3.11 # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward | ||
name: Run mypy for Python 3.11 | ||
entry: tools/mypy.sh 1 "3.11" | ||
language: python | ||
types: [python] | ||
additional_dependencies: *mypy_deps | ||
stages: [manual] # Only run in CI | ||
- id: mypy-3.12 # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward | ||
name: Run mypy for Python 3.12 | ||
entry: tools/mypy.sh 1 "3.12" | ||
language: python | ||
types: [python] | ||
additional_dependencies: *mypy_deps | ||
stages: [manual] # Only run in CI | ||
- id: shellcheck | ||
name: Lint shell scripts | ||
entry: tools/shellcheck.sh | ||
language: script | ||
types: [shell] | ||
- id: png-lint | ||
name: Lint PNG exports from excalidraw | ||
entry: tools/png-lint.sh | ||
language: script | ||
types: [png] | ||
- id: action-lint | ||
name: Lint GitHub Actions workflows | ||
entry: tools/actionlint.sh | ||
language: script | ||
types: [shell] | ||
- id: signoff-commit | ||
name: Sign-off Commit | ||
entry: bash | ||
args: | ||
- -c | ||
- | | ||
if ! grep -q "^Signed-off-by: $(git config user.name) <$(git config user.email)>" "$(git rev-parse --git-path COMMIT_EDITMSG)"; then | ||
printf "\nSigned-off-by: $(git config user.name) <$(git config user.email)>\n" >> "$(git rev-parse --git-path COMMIT_EDITMSG)" | ||
fi | ||
language: system | ||
verbose: true | ||
stages: [commit-msg] | ||
- id: check-filenames | ||
name: Check for spaces in all filenames | ||
entry: bash | ||
args: | ||
- -c | ||
- 'git ls-files | grep " " && echo "Filenames should not contain spaces!" && exit 1 || exit 0' | ||
language: system | ||
always_run: true | ||
pass_filenames: false | ||
- id: enforce-import-regex-instead-of-re | ||
name: Enforce import regex as re | ||
entry: python tools/enforce_regex_import.py | ||
language: python | ||
types: [python] | ||
pass_filenames: false | ||
additional_dependencies: [regex] | ||
# Keep `suggestion` last | ||
- id: suggestion | ||
name: Suggestion | ||
entry: bash -c 'echo "To bypass pre-commit hooks, add --no-verify to git commit."' | ||
language: system | ||
verbose: true | ||
pass_filenames: false | ||
# Insert new entries above the `suggestion` entry |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this to vllm_ascend_test.yaml as deps of e2e test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if pre-commits runs parallel with e2e test is batter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e2e resource is limited so do pre check then run e2e is better