mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-05 00:33:03 +08:00
12
.github/workflows/_unit_test_coverage.yml
vendored
12
.github/workflows/_unit_test_coverage.yml
vendored
@@ -175,7 +175,7 @@ jobs:
|
||||
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
|
||||
coverage combine coveragedata/
|
||||
coverage combine coveragedata/ || echo "No data to combine"
|
||||
coverage xml -o python_coverage_all.xml
|
||||
COVERAGE_EXIT_CODE=0
|
||||
if [[ "$IS_PR" == "true" ]]; then
|
||||
@@ -276,12 +276,17 @@ jobs:
|
||||
needs: run_tests_with_coverage
|
||||
if: always()
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
fd_archive_url: ${{ inputs.FASTDEPLOY_ARCHIVE_URL }}
|
||||
steps:
|
||||
- name: coverage diff file download
|
||||
shell: bash
|
||||
env:
|
||||
diff_cov_file_url: ${{ needs.run_tests_with_coverage.outputs.diff_cov_file_url }}
|
||||
run: |
|
||||
wget ${fd_archive_url}
|
||||
tar -xf FastDeploy.tar.gz
|
||||
cd FastDeploy
|
||||
if [ -z "${diff_cov_file_url}" ]; then
|
||||
echo "No diff coverage file URL provided."
|
||||
exit 0
|
||||
@@ -291,6 +296,9 @@ jobs:
|
||||
if: ${{ needs.run_tests_with_coverage.outputs.diff_cov_file_url != null && needs.run_tests_with_coverage.outputs.diff_cov_file_url != '' }}
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
files: ./diff_coverage.xml
|
||||
files: ./FastDeploy/diff_coverage.xml
|
||||
name: python diff coverage
|
||||
verbose: true
|
||||
disable_search: true
|
||||
commit_parent: false
|
||||
flags: diff
|
||||
|
@@ -1,4 +1,5 @@
|
||||
[run]
|
||||
branch = True
|
||||
source = fastdeploy
|
||||
parallel = True
|
||||
concurrency = multiprocessing
|
||||
@@ -15,3 +16,4 @@ omit =
|
||||
*/site-packages/*/tests/*
|
||||
*/site-packages/setuptools/*
|
||||
*/dist-packages/*
|
||||
*/site-packages/*/fastdeploy/model_executor/ops/gpu*
|
||||
|
@@ -1,7 +1,11 @@
|
||||
#!/bin/bash
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
run_path="$DIR/../tests/"
|
||||
export PYTEST_INI="$DIR/../tests/pytest.ini"
|
||||
export PYTEST_INI="$DIR/../tests/cov_pytest.ini"
|
||||
|
||||
export COVERAGE_FILE=${COVERAGE_FILE:-$DIR/../coveragedata/.coverage}
|
||||
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"
|
||||
@@ -46,7 +50,7 @@ done
|
||||
# 执行 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} --disable-warnings | grep -Eo '^.*test_.*\.py' | sort | uniq)
|
||||
|
||||
|
||||
failed_pytest=0
|
||||
@@ -54,7 +58,7 @@ success_pytest=0
|
||||
|
||||
for file in $TEST_FILES; do
|
||||
echo "Running pytest file: $file"
|
||||
python -m coverage run --parallel-mode -m pytest "$file" -vv -s
|
||||
python -m pytest -c ${PYTEST_INI} --cov-config=${COVERAGE_RCFILE} "$file" -vv -s
|
||||
status=$?
|
||||
if [ "$status" -ne 0 ]; then
|
||||
echo "$file" >> "$failed_tests_file"
|
||||
|
@@ -22,6 +22,10 @@ addopts =
|
||||
--ignore=operators/test_flash_mask_attn.py
|
||||
--ignore=operators/test_w4afp8_gemm.py
|
||||
--ignore=operators/test_tree_mask.py
|
||||
--cov=fastdeploy
|
||||
--cov-branch
|
||||
--cov-append
|
||||
--cov-report=
|
||||
|
||||
# 输出更详细的结果
|
||||
console_output_style = progress
|
Reference in New Issue
Block a user