Skip to content

[Doc] Clarify NPU device selection for multiprocessing, DP and Ray #3621

[Doc] Clarify NPU device selection for multiprocessing, DP and Ray

[Doc] Clarify NPU device selection for multiprocessing, DP and Ray #3621

name: Supplement New Tests

Check warning on line 1 in .github/workflows/pr_supplement_new_tests.yaml

View workflow run for this annotation

GitHub Actions / Supplement New Tests

Workflow execution policy warning (evaluate mode)

On December 2, 2026, GitHub will restrict `pull_request_target` on public repositories by default. To continue allowing the event trigger, configure an Actions policy. Learn more: https://gh.io/securely-using-pull_request_target#default-policy-for-pull_request_target
# pull_request_target is required so OBS secrets are available for fork PRs.
# Collect from the GitHub three-dot PR diff, not the merge/squash commit.
on:
pull_request_target:
types: [closed]
permissions:
contents: read
jobs:
upload-merged-new-tests:
name: Supplement New Tests
if: >-
${{
github.event.pull_request.merged == true &&
(
github.event.pull_request.base.ref == 'main' ||
startsWith(github.event.pull_request.base.ref, 'releases/v')
)
}}
runs-on: linux-amd64-cpu-8-hk
env:
OBS_ACCESS_KEY: ${{ secrets.OBS_ACCESS_KEY_PRECISION }}
OBS_SECRET_KEY: ${{ secrets.OBS_SECRET_ACCESS_KEY_PRECISION }}
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.base.ref }}
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Resolve supported target branch
id: target
env:
BASE_REF: ${{ github.event.pull_request.base.ref }}
run: |
set -euo pipefail
if [ "${BASE_REF}" = "main" ]; then
{
echo "supported=true"
echo "obs_object=ci/precision-test/extra_recommended_tests.yaml"
} >> "$GITHUB_OUTPUT"
exit 0
fi
POINTER_URL="https://vllm-ascend.obs.cn-north-4.myhuaweicloud.com/ci/precision-test/coverage_release_branch.txt"
curl -sSL --retry 3 -o coverage_release_branch.txt "${POINTER_URL}" || true
python3 - <<'PY'
import os
base_ref = os.environ["BASE_REF"]
pointer_path = "coverage_release_branch.txt"
recorded = ""
if os.path.isfile(pointer_path):
recorded = open(pointer_path, encoding="utf-8").read().strip()
supported = recorded == base_ref
if supported:
print(f"PR targets the release branch recorded by coverage: {recorded}")
else:
print(f"Skip PR targeting {base_ref}; coverage_release_branch.txt records {recorded or '<empty>'}")
obs_object = ""
if supported:
version = base_ref.split("/", 1)[1]
obs_object = f"ci/precision-test/extra_recommended_tests-{version}.yaml"
with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as output:
print(f"supported={str(supported).lower()}", file=output)
print(f"obs_object={obs_object}", file=output)
PY
- name: Collect new or moved tests
id: collect
if: ${{ steps.target.outputs.supported == 'true' }}
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_BASE: ${{ github.event.pull_request.base.sha }}
MERGE_SHA: ${{ github.event.pull_request.merge_commit_sha }}
run: |
set -euo pipefail
git config --global --add safe.directory "$GITHUB_WORKSPACE"
# GitHub keeps refs/pull/<n>/head on the base repo. Three-dot
# PR_BASE...PR_HEAD is the Files changed tab, even if PR_BASE is stale.
git fetch origin "pull/${PR_NUMBER}/head" --no-tags
PR_HEAD=$(git rev-parse FETCH_HEAD)
echo "pr-number=${PR_NUMBER}"
echo "pr-base=${PR_BASE}"
echo "pr-head=${PR_HEAD}"
echo "merge=${MERGE_SHA}"
python3 .github/workflows/scripts/collect_merged_new_tests.py \
--pr-base "${PR_BASE}" \
--pr-head "${PR_HEAD}" \
--output merged_new_tests.yaml \
--pr-number "${PR_NUMBER}" \
--merge-sha "${MERGE_SHA}"
if [ -s merged_new_tests.yaml ]; then
echo "has_tests=true" >> "$GITHUB_OUTPUT"
echo "Collected tests:"
cat merged_new_tests.yaml
else
echo "has_tests=false" >> "$GITHUB_OUTPUT"
echo "No new or moved tests to upload"
fi
- name: Merge into OBS extra_recommended_tests.yaml
id: merge
if: ${{ steps.collect.outputs.has_tests == 'true' }}
env:
OBS_OBJECT: ${{ steps.target.outputs.obs_object }}
run: |
set -euo pipefail
OBS_URL="https://vllm-ascend.obs.cn-north-4.myhuaweicloud.com/${OBS_OBJECT}"
python3 -m pip install pyyaml --quiet
http_code=$(curl -sSL --retry 3 -o extra_recommended_tests.yaml -w "%{http_code}" "${OBS_URL}" || echo "000")
if [ "${http_code}" = "200" ] && [ -s extra_recommended_tests.yaml ]; then
echo "Downloaded existing ${OBS_OBJECT} from OBS"
elif [ "${http_code}" = "404" ] || [ "${http_code}" = "403" ]; then
# Anonymous reads return 403 when the object does not exist.
echo "No ${OBS_OBJECT} on OBS yet (HTTP ${http_code}); starting a new file"
: > extra_recommended_tests.yaml
else
echo "::error::Failed to download ${OBS_OBJECT} from OBS (HTTP ${http_code})"
exit 1
fi
python3 .github/workflows/scripts/merge_extra_recommended_tests.py \
--extra-yaml extra_recommended_tests.yaml \
--incoming-yaml merged_new_tests.yaml \
--output-yaml extra_recommended_tests.yaml \
| tee merge.out
if grep -q "^Appended " merge.out; then
echo "has_new_paths=true" >> "$GITHUB_OUTPUT"
echo "Merged extra yaml:"
cat extra_recommended_tests.yaml
else
echo "has_new_paths=false" >> "$GITHUB_OUTPUT"
echo "No new paths to upload"
fi
- name: Upload extra_recommended_tests.yaml to OBS
if: ${{ steps.merge.outputs.has_new_paths == 'true' }}
env:
OBS_OBJECT: ${{ steps.target.outputs.obs_object }}
run: |
set -euo pipefail
if [ -z "${OBS_ACCESS_KEY}" ] || [ -z "${OBS_SECRET_KEY}" ]; then
echo "::error::OBS credentials are missing"
exit 1
fi
python3 -m pip install esdk-obs-python --quiet
python3 - <<'EOF'
import os
from obs import ObsClient
obs_path = os.environ['OBS_OBJECT']
client = ObsClient(
access_key_id=os.environ['OBS_ACCESS_KEY'],
secret_access_key=os.environ['OBS_SECRET_KEY'],
server='https://obs.cn-north-4.myhuaweicloud.com',
)
resp = client.putFile('vllm-ascend', obs_path, 'extra_recommended_tests.yaml')
if resp.status >= 300:
raise Exception(f'Failed to upload {obs_path}: {resp.errorMessage}')
print(f'Uploaded extra_recommended_tests.yaml -> {obs_path}')
print('https://vllm-ascend.obs.cn-north-4.myhuaweicloud.com/' + obs_path)
EOF