From fa7e7bea2130fe23ab95ef579901b7c0693cf148 Mon Sep 17 00:00:00 2001 From: Yikun Jiang Date: Thu, 30 Jan 2025 19:20:30 +0800 Subject: [PATCH] Make CI work and use cache speed up e2e test This patch make CI work and use cache speed up e2e test, including: 1. Change push (post merge ci) and pull_request (pr ci) trigger branch to main 2. Make mypy work by ignore base_communicator and clear unused deps 3. Several improvements for vllm_ascend_test: - use cache (pip, ms, hf) speed up e2e test (25mins --> 5mins) - switch `git clone` command to `action/checkout` to speedup checkout and - Enable sv for pytest for better info dump - Remove network host to resole `docker: conflicting ontions: cannot attach both user-defined and non-user-definednetwork-modes`, which is a problem on docker 1.45 but not on 1.39. Signed-off-by: Yikun Jiang --- .github/mergify.yml | 65 ------------------------- .github/workflows/actionlint.yml | 4 +- .github/workflows/mypy.yaml | 33 ++++++------- .github/workflows/ruff.yml | 4 +- .github/workflows/shellcheck.yml | 4 +- .github/workflows/vllm_ascend_test.yaml | 39 +++++++-------- .github/workflows/yapf.yml | 4 +- mypy.ini | 4 ++ tools/npu-vllm-test.sh | 2 +- 9 files changed, 46 insertions(+), 113 deletions(-) delete mode 100644 .github/mergify.yml diff --git a/.github/mergify.yml b/.github/mergify.yml deleted file mode 100644 index bb7bb1b6..00000000 --- a/.github/mergify.yml +++ /dev/null @@ -1,65 +0,0 @@ -# -# Adapted from vllm-project/vllm/blob/main/.github -# Copyright 2023 The vLLM team. -# -# 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. -# -pull_request_rules: -- name: label-documentation - description: Automatically apply documentation label - conditions: - - or: - - files~=^[^/]+\.md$ - - files~=^docs/ - actions: - label: - add: - - documentation - -- name: label-ci-build - description: Automatically apply ci/build label - conditions: - - or: - - files~=^\.github/ - - files~=^Dockerfile - - files~=^requirements.*\.txt - - files=setup.py - actions: - label: - add: - - ci/build - - -- name: ping author on conflicts and add 'needs-rebase' label - conditions: - - conflict - - -closed - actions: - label: - add: - - needs-rebase - comment: - message: | - This pull request has merge conflicts that must be resolved before it can be - merged. Please rebase the PR, @{{author}}. - - https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork - -- name: remove 'needs-rebase' label when conflict is resolved - conditions: - - -conflict - - -closed - actions: - label: - remove: - - needs-rebase diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index 6525467c..1161a6e2 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -19,14 +19,14 @@ name: Lint GitHub Actions workflows on: push: branches: - - "*" + - "main" 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.*' diff --git a/.github/workflows/mypy.yaml b/.github/workflows/mypy.yaml index 46d580a3..ec9c2e6f 100644 --- a/.github/workflows/mypy.yaml +++ b/.github/workflows/mypy.yaml @@ -22,14 +22,14 @@ on: # but only for the main branch push: branches: - - "*" + - "main" paths: - '**/*.py' - '.github/workflows/mypy.yaml' - 'tools/mypy.sh' pull_request: branches: - - "*" + - "main" # 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 @@ -54,23 +54,20 @@ jobs: 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 - sudo apt-get update - sudo apt-get install -y git gcc-12 g++-12 libnuma-dev - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 10 --slave /usr/bin/g++ g++ /usr/bin/g++-12 - pip install cmake>=3.26 wheel packaging ninja "setuptools-scm>=8" numpy - - name: Download and Install vllm cpu - # TODO (cmq): clone vllm-project/vllm:main instead of cosdt/vllm:apply_plugin + pip install -r requirements-dev.txt + + - name: Checkout vllm-project/vllm repo + uses: actions/checkout@v4 + with: + repository: vllm-project/vllm + path: vllm-empty + + - name: Install vllm-project/vllm from source + working-directory: vllm-empty run: | - git clone https://github.com/cosdt/vllm -b apply_plugin - cd vllm - pip install -r requirements-cpu.txt --extra-index-url https://download.pytorch.org/whl/cpu - VLLM_TARGET_DEVICE=cpu python setup.py install + pip install -r requirements-build.txt --extra-index-url https://download.pytorch.org/whl/cpu + VLLM_TARGET_DEVICE=empty pip install . + - name: Mypy run: | echo "::add-matcher::.github/workflows/matchers/mypy.json" diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml index 61322206..11573a84 100644 --- a/.github/workflows/ruff.yml +++ b/.github/workflows/ruff.yml @@ -22,7 +22,7 @@ on: # but only for the main branch push: branches: - - "*" + - "main" paths: - "**/*.py" - requirements-lint.txt @@ -30,7 +30,7 @@ on: - .github/workflows/ruff.yml pull_request: branches: - - "*" + - "main" jobs: ruff: diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index 78f79852..6a8ff7a2 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -19,13 +19,13 @@ name: Lint shell scripts on: push: branches: - - "*" + - "main" paths: - '**/*.sh' - '.github/workflows/shellcheck.yml' pull_request: branches: - - "*" + - "main" paths: - '**/*.sh' - '.github/workflows/shellcheck.yml' diff --git a/.github/workflows/vllm_ascend_test.yaml b/.github/workflows/vllm_ascend_test.yaml index 7d83ace4..bea98471 100644 --- a/.github/workflows/vllm_ascend_test.yaml +++ b/.github/workflows/vllm_ascend_test.yaml @@ -15,7 +15,7 @@ # limitations under the License. # -name: 'vllm_ascend_ut' +name: 'e2e test' on: push: @@ -42,8 +42,8 @@ defaults: jobs: test: - name: run ut for vllm_ascend - runs-on: npu-arm64 # actionlint-ignore: runner-label + name: vLLM Ascend test (self-host) + runs-on: ascend-arm64 # actionlint-ignore: runner-label container: image: quay.io/ascend/cann:8.0.rc3.beta1-910b-ubuntu22.04-py3.10 @@ -51,10 +51,10 @@ jobs: - /usr/local/dcmi:/usr/local/dcmi - /usr/local/bin/npu-smi:/usr/local/bin/npu-smi - /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ - - /data/disk1/actions-runner/_work/_repo/vllm:/root/vllm + # Use self-host cache speed up pip and model download + - /home/action/actions-runner/_work/cache:/github/home/.cache/ options: >- - --network host - --device /dev/davinci1 + --device /dev/davinci6 --device /dev/davinci_manager --device /dev/devmm_svm --device /dev/hisi_hdc @@ -70,7 +70,7 @@ jobs: sed -i 's|ports.ubuntu.com|mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple - - name: Checkout + - name: Checkout vllm-project/vllm-ascend repo uses: actions/checkout@v4 - name: Install system dependencies @@ -82,28 +82,25 @@ jobs: run: | pip install -r requirements-dev.txt - # This is the base vllm master code cached in the container to speed up - # the test. There are two branch by default: - # - up-main: the latest code of vllm - # - apply_plugin: the code of vllm with the plugin applied - - name: copy vllm - run: | - cp -r /root/vllm /root/vllm-empty + - name: Checkout vllm-project/vllm repo + uses: actions/checkout@v4 + with: + repository: vllm-project/vllm + path: ./vllm-empty - - name: Install vLLM from source - working-directory: /root/vllm-empty + - name: Install vllm-project/vllm from source + working-directory: ./vllm-empty run: | - git checkout up-main VLLM_TARGET_DEVICE=empty pip install -e . - - name: Install vllm_ascend + - name: Install vllm-project/vllm-ascend run: | pip install -e . - - name: Run test + - name: Run vllm-project/vllm-ascend test run: | - pytest tests + pytest -sv tests - - name: Run vLLM native test + - name: Run vllm-project/vllm test run: | bash tools/npu-vllm-test.sh diff --git a/.github/workflows/yapf.yml b/.github/workflows/yapf.yml index ac682099..14a3ae92 100644 --- a/.github/workflows/yapf.yml +++ b/.github/workflows/yapf.yml @@ -22,13 +22,13 @@ on: # but only for the main branch push: branches: - - "*" + - "main" paths: - "**/*.py" - .github/workflows/yapf.yml pull_request: branches: - - "*" + - "main" paths: - "**/*.py" - .github/workflows/yapf.yml diff --git a/mypy.ini b/mypy.ini index fe0fd661..b627e7f5 100644 --- a/mypy.ini +++ b/mypy.ini @@ -8,3 +8,7 @@ ignore_missing_imports = True [mypy-transformers.*] ignore_missing_imports = True + +; Remove this after https://github.com/vllm-project/vllm/pull/11324 merged +[mypy-vllm.distributed.device_communicators.base_communicator] +ignore_missing_imports = True diff --git a/tools/npu-vllm-test.sh b/tools/npu-vllm-test.sh index f2024f6b..17c7a4d4 100644 --- a/tools/npu-vllm-test.sh +++ b/tools/npu-vllm-test.sh @@ -20,7 +20,7 @@ set -o pipefail -TEST_DIR="/root/vllm-empty/tests" +TEST_DIR="./vllm-empty/tests" TEST_FILES=( test_sequence.py # test_utils.py