From 3cbefef773edfcf94d026a7f4658c1cbaae0bec4 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Sat, 1 Aug 2026 15:37:47 +0800 Subject: [PATCH] =?UTF-8?q?fix(ci):=20vitest=E5=A2=9E=E9=87=8F=E6=97=A0?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=96=87=E4=BB=B6=E8=A7=86=E4=B8=BA=E9=80=9A?= =?UTF-8?q?=E8=BF=87=20+=20ci-base=E6=B7=BB=E5=8A=A0git?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- infra/docker/ci.Dockerfile | 1 + scripts/ci/vitest_incremental.sh | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/infra/docker/ci.Dockerfile b/infra/docker/ci.Dockerfile index bbfe6d459..a9422ee40 100644 --- a/infra/docker/ci.Dockerfile +++ b/infra/docker/ci.Dockerfile @@ -16,6 +16,7 @@ RUN sed -i 's|deb.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list.d/debia RUN apt-get update \ && apt-get install -y --no-install-recommends \ curl \ + git \ libpq-dev \ nodejs \ npm \ diff --git a/scripts/ci/vitest_incremental.sh b/scripts/ci/vitest_incremental.sh index 7c5e73c59..b94ec6d0e 100755 --- a/scripts/ci/vitest_incremental.sh +++ b/scripts/ci/vitest_incremental.sh @@ -55,9 +55,17 @@ echo "" # 在Docker Node容器中执行增量测试 set +e -bash scripts/ci/step_frontend_run.sh "npx vitest run related $CHANGED_FILES" +VITEST_OUTPUT=$(bash scripts/ci/step_frontend_run.sh "npx vitest run related $CHANGED_FILES" 2>&1) VITEST_EXIT=$? set -e +echo "$VITEST_OUTPUT" + +# 如果没有找到测试文件,视为通过(改动的文件没有对应测试) +if echo "$VITEST_OUTPUT" | grep -q "No test files found"; then + echo "" + echo "⚠️ 未找到相关测试文件,跳过(非失败)" + exit 0 +fi if [ "$VITEST_EXIT" -eq 0 ]; then echo ""