forked from vllm-project/vllm-ascend
-
Notifications
You must be signed in to change notification settings - Fork 1
218 lines (195 loc) · 8.13 KB
/
Copy pathpr_test.yaml
File metadata and controls
218 lines (195 loc) · 8.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
#
# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This file is a part of the vllm-ascend project.
#
name: E2E
on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
branches:
- 'main'
- '*-dev'
- 'releases/v*'
# Bash shells do not use ~/.profile or ~/.bashrc so these shells need to be explicitly
# declared as "shell: bash -el {0}" on steps that need to be properly activated.
# It's used to activate ascend-toolkit environment variables.
defaults:
run:
shell: bash -el {0}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint-and-select-tests:
if: ${{ github.event.action != 'labeled' || github.event.label.name == 'ready' }}
runs-on: linux-amd64-cpu-8-hk
container:
image: quay.io/ascend-ci/vllm-ascend:lint
outputs:
has_tests: ${{ steps.scope.outputs.has_tests || steps.noop.outputs.has_tests }}
test_groups: ${{ steps.scope.outputs.test_groups || steps.noop.outputs.test_groups }}
matched_modules: ${{ steps.scope.outputs.matched_modules || steps.noop.outputs.matched_modules }}
main_commit: ${{ steps.vllm.outputs.main_commit }}
release_tag: ${{ steps.vllm.outputs.release_tag }}
steps:
- name: Validate PR title prefix
run: |
PR_TITLE=$(curl -sSf -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}" \
| python3 -c "import sys,json; print(json.load(sys.stdin)['title'])") || {
echo "::error::Failed to fetch PR title from GitHub API"
exit 1
}
if [ -z "$PR_TITLE" ]; then
echo "::error::PR title cannot be empty"
exit 1
fi
echo "Checking PR title: $PR_TITLE"
VALID_PREFIXES='\[(BugFix|Performance|Test|CI|Feature|Doc|Misc|Community|Refactor)\]'
if ! echo "$PR_TITLE" | grep -iqE "$VALID_PREFIXES"; then
echo "::error::PR title must contain one of the following prefixes: [BugFix], [Performance], [Test], [CI], [Feature], [Doc], [Misc], [Community], [Refactor]"
echo "::error::Example: '[Feature] Add new optimization pass' or 'Add new feature [Feature]'"
exit 1
fi
echo "✓ PR title prefix is valid"
- name: Checkout vllm-project/vllm-ascend repo
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Read verified vLLM refs
id: vllm
run: |
main_commit="$(tr -d '[:space:]' < .github/vllm-main-verified.commit)"
release_tag="$(tr -d '[:space:]' < .github/vllm-release-tag.commit)"
[[ "${main_commit}" =~ ^[0-9a-f]{7,40}$ ]] || {
echo "::error file=.github/vllm-main-verified.commit::invalid vLLM main commit: ${main_commit}"
exit 1
}
[[ "${release_tag}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+([.-].*)?$ ]] || {
echo "::error file=.github/vllm-release-tag.commit::invalid vLLM release tag: ${release_tag}"
exit 1
}
{
echo "main_commit=${main_commit}"
echo "release_tag=${release_tag}"
} >> "$GITHUB_OUTPUT"
- name: cp problem matchers
run: |
cp .github/workflows/matchers/actionlint.json "$RUNNER_TEMP/actionlint.json"
cp .github/workflows/matchers/markdownlint.json "$RUNNER_TEMP/markdownlint.json"
cp .github/workflows/matchers/mypy.json "$RUNNER_TEMP/mypy.json"
- run: echo "::add-matcher::$RUNNER_TEMP/actionlint.json"
- run: echo "::add-matcher::$RUNNER_TEMP/markdownlint.json"
- run: echo "::add-matcher::$RUNNER_TEMP/mypy.json"
- name: Checkout vllm-project/vllm repo
uses: actions/checkout@v7
with:
repository: vllm-project/vllm
path: ./vllm-empty
ref: ${{ steps.vllm.outputs.main_commit }}
- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
lint_tracker:
- 'requirements.txt'
- 'requirements-dev.txt'
- 'requirements-lint.txt'
src:
- 'vllm_ascend/**'
- 'setup.py'
- 'csrc/**'
- 'requirements.txt'
- 'pyproject.toml'
- 'cmake/**'
- '.github/**'
- 'tests/**'
- 'tools/**'
- 'CMakeLists.txt'
- name: Install vllm-ascend dev (conditional)
if: steps.filter.outputs.lint_tracker == 'true'
env:
UV_INDEX_URL: http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple
UV_EXTRA_INDEX_URL: "https://repo.huaweicloud.com/ascend/repos/pypi"
UV_INDEX_STRATEGY: unsafe-best-match
UV_NO_CACHE: 1
UV_SYSTEM_PYTHON: 1
run: |
pip install uv
git config --global --add safe.directory /__w/vllm-ascend/vllm-ascend
pip install uc-manager
uv pip install -r requirements-dev.txt --extra-index-url https://download.pytorch.org/whl/cpu
- name: Run pre-commit
env:
PRE_COMMIT_COLOR: always
FORCE_COLOR: "1"
TERM: xterm-256color
SHELLCHECK_OPTS: "--exclude=SC2046,SC2006,SC2086"
run: |
git config --global --add safe.directory /__w/vllm-ascend/vllm-ascend
pre-commit run --all-files --hook-stage manual --show-diff-on-failure
- name: Run mypy
run: |
PYTHONPATH="$PYTHONPATH:$(pwd)/vllm-empty"
export PYTHONPATH
git config --global --add safe.directory /__w/vllm-ascend/vllm-ascend
for python_version in "3.10" "3.11" "3.12"; do
echo "============================"
tools/mypy.sh 1 "$python_version"
echo "============================"
done
- name: Validate test coverage config
run: |
pip install pyyaml
python3 .github/workflows/scripts/coverage.py
- name: Select tests based on changed files
id: scope
if: steps.filter.outputs.src == 'true'
run: |
git config --global --add safe.directory /__w/vllm-ascend/vllm-ascend
git fetch origin ${{ github.base_ref }}
pip install regex
python3 .github/workflows/scripts/select_tests.py \
--diff-base origin/${{ github.base_ref }}
- name: Set no-tests output when source paths unchanged
id: noop
if: steps.filter.outputs.src != 'true'
run: |
{
echo "has_tests=false"
echo "test_groups=[]"
echo "matched_modules="
} >> "$GITHUB_OUTPUT"
run-selected-tests:
needs: lint-and-select-tests
if: ${{ needs.lint-and-select-tests.outputs.has_tests == 'true' && contains(github.event.pull_request.labels.*.name, 'ready') }}
strategy:
matrix:
vllm_version:
- ${{ needs.lint-and-select-tests.outputs.main_commit }}
# Dropped vLLM v0.22.1 (release-tag) compatibility from main. Uncomment
# the line below to re-enable release-tag CI when maintaining a new
# release tag (update .github/vllm-release-tag.commit accordingly).
# - ${{ needs.lint-and-select-tests.outputs.release_tag }}
uses: ./.github/workflows/_selected_tests.yaml
with:
vllm: ${{ matrix.vllm_version }}
ref: ${{ github.event.pull_request.head.sha }}
test_groups: ${{ needs.lint-and-select-tests.outputs.test_groups }}