Optimize coverage jobs (#3683)
Some checks failed
CE Compile Job / ce_job_pre_check (push) Has been cancelled
CE Compile Job / print_ce_job_pre_check_outputs (push) Has been cancelled
CE Compile Job / FD-Clone-Linux (push) Has been cancelled
CE Compile Job / Show Code Archive Output (push) Has been cancelled
CE Compile Job / BUILD_SM8090 (push) Has been cancelled
CE Compile Job / BUILD_SM8689 (push) Has been cancelled
CE Compile Job / CE_UPLOAD (push) Has been cancelled
Deploy GitHub Pages / deploy (push) Has been cancelled

This commit is contained in:
YUNSHEN XIE
2025-08-30 00:12:40 +08:00
committed by GitHub
parent cd252ec673
commit a18afcfdd9
4 changed files with 35 additions and 38 deletions

View File

@@ -164,8 +164,8 @@ jobs:
git config --global --add safe.directory /workspace/FastDeploy git config --global --add safe.directory /workspace/FastDeploy
cd FastDeploy cd FastDeploy
git diff origin/${BASE_REF}..HEAD --unified=0 > diff.txt
python -m pip install --pre paddlepaddle-gpu -i https://www.paddlepaddle.org.cn/packages/nightly/cu126/ python -m pip install --pre paddlepaddle-gpu -i https://www.paddlepaddle.org.cn/packages/nightly/cu126/
pip config set global.extra-index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple pip config set global.extra-index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
python -m pip install coverage python -m pip install coverage
@@ -173,6 +173,10 @@ jobs:
python -m pip install pytest-cov python -m pip install pytest-cov
python -m pip install jsonschema aistudio_sdk==0.3.5 python -m pip install jsonschema aistudio_sdk==0.3.5
python -m pip install ${fd_wheel_url} python -m pip install ${fd_wheel_url}
rm -rf fastdeploy
# coverage subprocess use
python -m pip install ${fd_wheel_url} --no-deps --target=/workspace/FastDeploy
export PYTHONPATH=/workspace/FastDeploy/
if [ -d "tests/plugins" ]; then if [ -d "tests/plugins" ]; then
cd tests/plugins cd tests/plugins
python setup.py install python setup.py install
@@ -182,12 +186,11 @@ jobs:
fi fi
export COVERAGE_FILE=/workspace/FastDeploy/coveragedata/.coverage export COVERAGE_FILE=/workspace/FastDeploy/coveragedata/.coverage
export COVERAGE_RCFILE=/workspace/FastDeploy/scripts/.coveragerc export COVERAGE_RCFILE=/workspace/FastDeploy/scripts/.coveragerc
export COVERAGE_PROCESS_START=/workspace/FastDeploy/scripts/.coveragerc
TEST_EXIT_CODE=0 TEST_EXIT_CODE=0
bash scripts/coverage_run.sh || TEST_EXIT_CODE=8 bash scripts/coverage_run.sh || TEST_EXIT_CODE=8
git diff origin/${BASE_REF}..HEAD --unified=0 > diff.txt
echo "TEST_EXIT_CODE=${TEST_EXIT_CODE}" >> exit_code.env echo "TEST_EXIT_CODE=${TEST_EXIT_CODE}" >> exit_code.env
coverage combine coveragedata/ || echo "No data to combine" coverage combine coveragedata/ || echo "No data to combine"
coverage report
coverage xml -o python_coverage_all.xml coverage xml -o python_coverage_all.xml
COVERAGE_EXIT_CODE=0 COVERAGE_EXIT_CODE=0
if [[ "$IS_PR" == "true" ]]; then if [[ "$IS_PR" == "true" ]]; then
@@ -228,7 +231,7 @@ jobs:
echo "diff_cov_result_json_url=${DIFF_COV_JSON_URL}" >> $GITHUB_OUTPUT echo "diff_cov_result_json_url=${DIFF_COV_JSON_URL}" >> $GITHUB_OUTPUT
echo "diff_cov_result_json_url=${DIFF_COV_JSON_URL}" >> $GITHUB_ENV echo "diff_cov_result_json_url=${DIFF_COV_JSON_URL}" >> $GITHUB_ENV
fi fi
unittest_result="tests/failed_tests.log" unittest_result="failed_tests.log"
if [ -s ${unittest_result} ];then if [ -s ${unittest_result} ];then
python ${push_file} ${unittest_result} ${target_path}/UnitTestResult python ${push_file} ${unittest_result} ${target_path}/UnitTestResult
target_path_stripped="${target_path#paddle-github-action/}" target_path_stripped="${target_path#paddle-github-action/}"

View File

@@ -1,8 +1,9 @@
[run] [run]
branch = True branch = True
source = fastdeploy source = fastdeploy
parallel = True
concurrency = multiprocessing concurrency = multiprocessing
patch = subprocess
parallel = True
[paths] [paths]
source = source =

View File

@@ -1,12 +1,12 @@
#!/bin/bash #!/bin/bash
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
run_path="$DIR/../tests/" tests_path="$DIR/../tests/"
export PYTEST_INI="$DIR/../tests/cov_pytest.ini" export PYTEST_INI="$DIR/../tests/cov_pytest.ini"
run_path=$( realpath "$DIR/../")
export COVERAGE_FILE=${COVERAGE_FILE:-$DIR/../coveragedata/.coverage} export COVERAGE_FILE=${COVERAGE_FILE:-$DIR/../coveragedata/.coverage}
export COVERAGE_RCFILE=${COVERAGE_RCFILE:-$DIR/../scripts/.coveragerc} export COVERAGE_RCFILE=${COVERAGE_RCFILE:-$DIR/../scripts/.coveragerc}
export COVERAGE_PROCESS_START=${COVERAGE_PROCESS_START:-$DIR/../scripts/.coveragerc}
cd "$run_path" || exit 1
failed_tests_file="failed_tests.log" failed_tests_file="failed_tests.log"
> "$failed_tests_file" > "$failed_tests_file"
@@ -16,7 +16,7 @@ failed_tests_file="failed_tests.log"
# 执行 pytest每个文件单独跑 # 执行 pytest每个文件单独跑
################################## ##################################
# 收集 pytest 文件 # 收集 pytest 文件
TEST_FILES=$(python -m pytest --collect-only -q -c ${PYTEST_INI} --disable-warnings | grep -Eo '^.*test_.*\.py' | sort | uniq) TEST_FILES=$(python -m pytest --collect-only -q -c ${PYTEST_INI} ${tests_path} --rootdir=${run_path} --disable-warnings | grep -Eo '^.*test_.*\.py' | sort | uniq)
failed_pytest=0 failed_pytest=0
@@ -24,7 +24,7 @@ success_pytest=0
for file in $TEST_FILES; do for file in $TEST_FILES; do
echo "Running pytest file: $file" echo "Running pytest file: $file"
python -m pytest -c ${PYTEST_INI} --cov-config=${COVERAGE_RCFILE} "$file" -vv -s python -m coverage run -m pytest -c ${PYTEST_INI} "$file" -vv -s
status=$? status=$?
if [ "$status" -ne 0 ]; then if [ "$status" -ne 0 ]; then
echo "$file" >> "$failed_tests_file" echo "$file" >> "$failed_tests_file"

View File

@@ -1,31 +1,24 @@
[pytest] [pytest]
# 跳过目录 # 跳过目录
addopts = addopts =
--ignore=ci_use --ignore=tests/ci_use
--ignore=ce --ignore=tests/ce
--ignore=layers/test_append_attention.py --ignore=tests/layers/test_append_attention.py
--ignore=layers/test_attention.py --ignore=tests/layers/test_attention.py
--ignore=operators/test_rejection_top_p_sampling.py --ignore=tests/operators/test_rejection_top_p_sampling.py
--ignore=operators/test_perchannel_gemm.py --ignore=tests/operators/test_perchannel_gemm.py
--ignore=operators/test_scaled_gemm_f8_i4_f16.py --ignore=tests/operators/test_scaled_gemm_f8_i4_f16.py
--ignore=operators/test_topp_sampling.py --ignore=tests/operators/test_topp_sampling.py
--ignore=operators/test_stop_generation.py --ignore=tests/operators/test_stop_generation.py
--ignore=operators/test_air_topp_sampling.py --ignore=tests/operators/test_air_topp_sampling.py
--ignore=operators/test_fused_moe.py --ignore=tests/operators/test_fused_moe.py
--ignore=operators/test_stop_generation_multi_ends.py --ignore=tests/operators/test_stop_generation_multi_ends.py
--ignore=graph_optimization/test_cuda_graph.py --ignore=tests/graph_optimization/test_cuda_graph.py
--ignore=graph_optimization/test_cuda_graph_dynamic_subgraph.py --ignore=tests/graph_optimization/test_cuda_graph_dynamic_subgraph.py
--ignore=graph_optimization/test_cuda_graph_spec_decode --ignore=tests/graph_optimization/test_cuda_graph_spec_decode
--ignore=layers/test_quant_layer.py --ignore=tests/layers/test_quant_layer.py
--ignore=operators/test_token_penalty.py --ignore=tests/operators/test_token_penalty.py
--ignore=operators/test_split_fuse.py --ignore=tests/operators/test_split_fuse.py
--ignore=operators/test_flash_mask_attn.py --ignore=tests/operators/test_flash_mask_attn.py
--ignore=operators/test_w4afp8_gemm.py --ignore=tests/operators/test_w4afp8_gemm.py
--ignore=operators/test_tree_mask.py --ignore=tests/operators/test_tree_mask.py
--cov=fastdeploy
--cov-branch
--cov-append
--cov-report=
# 输出更详细的结果
console_output_style = progress