This commit is contained in:
2025-09-24 10:50:34 +08:00
parent c055a68592
commit ec1705769c
18 changed files with 348 additions and 330 deletions

16
Jenkinsfile vendored
View File

@@ -7,6 +7,8 @@ pipeline {
VENV_NAME = 'venv'
TEST_REPORTS_DIR = 'test-reports'
COVERAGE_DIR = 'coverage-reports'
// 设置Python模块路径
PYTHONPATH = "${WORKSPACE}"
}
stages {
@@ -39,6 +41,10 @@ pipeline {
# 激活虚拟环境并安装依赖
. ${VENV_NAME}/bin/activate
pip config set global.index-url https://mirrors.ustc.edu.cn/pypi/simple
# 设置PYTHONPATH
export PYTHONPATH=\${PWD}:\$PYTHONPATH
# 升级pip
pip install --upgrade pip
@@ -64,12 +70,13 @@ pipeline {
echo 'Running code linting...'
sh """
. ${VENV_NAME}/bin/activate
export PYTHONPATH=\${PWD}:\$PYTHONPATH
# 运行flake8检查
# 运行flake8检查(使用项目配置.flake8)
flake8 entity/ services/ --output-file=${TEST_REPORTS_DIR}/flake8-report.txt --tee || true
# 运行black格式检查
black --check --diff entity/ services/ > ${TEST_REPORTS_DIR}/black-report.txt || true
black --check --diff --line-length 88 entity/ services/ > ${TEST_REPORTS_DIR}/black-report.txt || true
"""
}
}
@@ -94,6 +101,7 @@ pipeline {
echo 'Running type checking...'
sh """
. ${VENV_NAME}/bin/activate
export PYTHONPATH=\${PWD}:\$PYTHONPATH
# 运行mypy类型检查
mypy entity/ services/ --html-report ${TEST_REPORTS_DIR}/mypy-html --txt-report ${TEST_REPORTS_DIR}/mypy-txt || true
@@ -110,6 +118,7 @@ pipeline {
echo 'Running unit tests...'
sh """
. ${VENV_NAME}/bin/activate
export PYTHONPATH=\${PWD}:\$PYTHONPATH
# 运行单元测试
pytest tests/test_effects/ tests/test_ffmpeg_builder/ \\
@@ -158,6 +167,7 @@ pipeline {
echo 'Running integration tests...'
sh """
. ${VENV_NAME}/bin/activate
export PYTHONPATH=\${PWD}:\$PYTHONPATH
# 运行集成测试
pytest tests/test_integration/ \\
@@ -198,6 +208,7 @@ pipeline {
echo 'Running complete test suite with coverage...'
sh """
. ${VENV_NAME}/bin/activate
export PYTHONPATH=\${PWD}:\$PYTHONPATH
# 运行完整测试套件
pytest tests/ \\
@@ -262,6 +273,7 @@ pipeline {
echo 'Running performance tests...'
sh """
. ${VENV_NAME}/bin/activate
export PYTHONPATH=\${PWD}:\$PYTHONPATH
# 运行性能测试
RUN_STRESS_TESTS=1 pytest tests/test_integration/test_ffmpeg_execution.py::TestFFmpegExecution::test_stress_test_large_effects_chain \\