Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 47 additions & 2 deletions .github/workflows/_xpu_4cards_case_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ on:
secrets:
github-token:
required: true
outputs:
coverage_data_url:
description: "URL of the coverage data archive"
value: ${{ jobs.run_xpu_4cards_cases.outputs.coverage_data_url }}

jobs:
check_bypass:
Expand All @@ -53,6 +57,8 @@ jobs:
needs: check_bypass
if: ${{ inputs.FASTDEPLOY_WHEEL_URL != '' && needs.check_bypass.outputs.can-skip != 'true' }}
timeout-minutes: 60
outputs:
coverage_data_url: ${{ steps.upload_coverage.outputs.coverage_data_url }}
steps:
- name: Print current runner name
run: |
Expand Down Expand Up @@ -188,19 +194,30 @@ jobs:
python -m pip install openai -U
python -m pip install pytest
python -m pip install pytest-timeout
python -m pip install coverage
unset http_proxy
unset https_proxy
echo "============================开始运行pytest测试============================"
export PYTHONPATH=/workspace/FastDeploy/
export PYTHONPATH=$(pwd)/tests/xpu_ci:$PYTHONPATH
mkdir -p case_logs
export COVERAGE_RCFILE=/workspace/FastDeploy/scripts/.coveragerc_xpu
mkdir -p case_logs coveragedata
set +e
python -m pytest -v -s --tb=short tests/xpu_ci/4cards_cases/
COVERAGE_FILE=/workspace/FastDeploy/coveragedata/.coverage.4cards \
python -m coverage run --rcfile=${COVERAGE_RCFILE} -m pytest -v -s --tb=short tests/xpu_ci/4cards_cases/
exit_code=$?
set -e

# 合并覆盖率数据
cd /workspace/FastDeploy
COVERAGE_FILE=/workspace/FastDeploy/coveragedata/.coverage.4cards_combined \
python -m coverage combine --rcfile=${COVERAGE_RCFILE} coveragedata/ || true
tar -czf /workspace/FastDeploy/coverage_4cards.tar.gz -C coveragedata .

# 修改case_logs权限,确保Docker外部的runner用户可以读取并上传
chmod -R a+rX case_logs/ 2>/dev/null || true
chmod -R a+rX coveragedata/ 2>/dev/null || true
chmod a+r /workspace/FastDeploy/coverage_4cards.tar.gz 2>/dev/null || true

if [ $exit_code -eq 0 ]; then
echo "============================4卡cases测试通过!============================"
Expand All @@ -219,3 +236,31 @@ jobs:
path: FastDeploy/case_logs/
retention-days: 7
if-no-files-found: ignore

- name: Upload coverage data to BOS
id: upload_coverage
if: always()
run: |
set -x
if [[ "${{ github.event_name }}" == "pull_request" ]];then
commit_id=${{ github.event.pull_request.head.sha }}
pr_num=${{ github.event.pull_request.number }}
target_path=paddle-github-action/PR/FastDeploy/${pr_num}/${commit_id}/xpu_coverage
else
commit_id=${{ github.sha }}
branch_name=${{ github.ref_name }}
target_path=paddle-github-action/BRANCH/FastDeploy/${branch_name}/${commit_id}/xpu_coverage
fi
wget -q --no-proxy --no-check-certificate https://paddle-qa.bj.bcebos.com/CodeSync/develop/PaddlePaddle/PaddleTest/tools/bos_tools.py
push_file=$(realpath bos_tools.py)
python3 -m pip install -q bce-python-sdk==0.9.29
COV_FILE="FastDeploy/coverage_4cards.tar.gz"
if [ -f "${COV_FILE}" ]; then
python3 ${push_file} ${COV_FILE} ${target_path}
target_path_stripped="${target_path#paddle-github-action/}"
COV_URL=https://paddle-github-action.bj.bcebos.com/${target_path_stripped}/coverage_4cards.tar.gz
echo "coverage_data_url=${COV_URL}" >> $GITHUB_OUTPUT
else
echo "No coverage data found, skipping upload."
echo "coverage_data_url=" >> $GITHUB_OUTPUT
fi
49 changes: 47 additions & 2 deletions .github/workflows/_xpu_8cards_case_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ on:
secrets:
github-token:
required: true
outputs:
coverage_data_url:
description: "URL of the coverage data archive"
value: ${{ jobs.run_xpu_8cards_cases.outputs.coverage_data_url }}

jobs:
check_bypass:
Expand All @@ -53,6 +57,8 @@ jobs:
needs: check_bypass
if: ${{ inputs.FASTDEPLOY_WHEEL_URL != '' && needs.check_bypass.outputs.can-skip != 'true' }}
timeout-minutes: 60
outputs:
coverage_data_url: ${{ steps.upload_coverage.outputs.coverage_data_url }}
steps:
- name: Print current runner name
run: |
Expand Down Expand Up @@ -177,19 +183,30 @@ jobs:
python -m pip install openai -U
python -m pip install pytest
python -m pip install pytest-timeout
python -m pip install coverage
unset http_proxy
unset https_proxy
echo "============================开始运行pytest测试============================"
export PYTHONPATH=/workspace/FastDeploy/
export PYTHONPATH=$(pwd)/tests/xpu_ci:$PYTHONPATH
mkdir -p case_logs
export COVERAGE_RCFILE=/workspace/FastDeploy/scripts/.coveragerc_xpu
mkdir -p case_logs coveragedata
set +e
python -m pytest -v -s --tb=short tests/xpu_ci/8cards_cases/
COVERAGE_FILE=/workspace/FastDeploy/coveragedata/.coverage.8cards \
python -m coverage run --rcfile=${COVERAGE_RCFILE} -m pytest -v -s --tb=short tests/xpu_ci/8cards_cases/
exit_code=$?
set -e

# 合并覆盖率数据
cd /workspace/FastDeploy
COVERAGE_FILE=/workspace/FastDeploy/coveragedata/.coverage.8cards_combined \
python -m coverage combine --rcfile=${COVERAGE_RCFILE} coveragedata/ || true
tar -czf /workspace/FastDeploy/coverage_8cards.tar.gz -C coveragedata .

# 修改case_logs权限,确保Docker外部的runner用户可以读取并上传
chmod -R a+rX case_logs/ 2>/dev/null || true
chmod -R a+rX coveragedata/ 2>/dev/null || true
chmod a+r /workspace/FastDeploy/coverage_8cards.tar.gz 2>/dev/null || true

if [ $exit_code -eq 0 ]; then
echo "============================8卡cases测试通过!============================"
Expand All @@ -207,3 +224,31 @@ jobs:
path: FastDeploy/case_logs/
retention-days: 7
if-no-files-found: ignore

- name: Upload coverage data to BOS
id: upload_coverage
if: always()
run: |
set -x
if [[ "${{ github.event_name }}" == "pull_request" ]];then
commit_id=${{ github.event.pull_request.head.sha }}
pr_num=${{ github.event.pull_request.number }}
target_path=paddle-github-action/PR/FastDeploy/${pr_num}/${commit_id}/xpu_coverage
else
commit_id=${{ github.sha }}
branch_name=${{ github.ref_name }}
target_path=paddle-github-action/BRANCH/FastDeploy/${branch_name}/${commit_id}/xpu_coverage
fi
wget -q --no-proxy --no-check-certificate https://paddle-qa.bj.bcebos.com/CodeSync/develop/PaddlePaddle/PaddleTest/tools/bos_tools.py
push_file=$(realpath bos_tools.py)
python3 -m pip install -q bce-python-sdk==0.9.29
COV_FILE="FastDeploy/coverage_8cards.tar.gz"
if [ -f "${COV_FILE}" ]; then
python3 ${push_file} ${COV_FILE} ${target_path}
target_path_stripped="${target_path#paddle-github-action/}"
COV_URL=https://paddle-github-action.bj.bcebos.com/${target_path_stripped}/coverage_8cards.tar.gz
echo "coverage_data_url=${COV_URL}" >> $GITHUB_OUTPUT
else
echo "No coverage data found, skipping upload."
echo "coverage_data_url=" >> $GITHUB_OUTPUT
fi
Loading
Loading