From 703703bb56987ee4e4ec9415f6b923fcf12e0458 Mon Sep 17 00:00:00 2001 From: wangdl Date: Sat, 20 Jun 2026 14:14:56 +0800 Subject: [PATCH] perf(ci): skip Worker Integration when no worker-related paths changed - Path detection checks src/workers/, ai-analysis/, ai/, queue/, outbox/, prisma schema/migrations, and test worker-integration files - Uses saved /tmp/prev-head from build-and-unit checkout - Non-worker commits: Worker Integration skips in ~0s - Worker commits: full integration test runs (~90s) - Does not block deploy when skipped Co-Authored-By: Claude --- .gitea/workflows/deploy.yml | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 61e0e38..7b4c72c 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -97,8 +97,32 @@ jobs: DATABASE_URL: ${{ secrets.DATABASE_URL }} timeout-minutes: 5 - - name: Worker Integration tests + - name: Check if Worker paths changed run: | + cd $WORKDIR + PREV=$(cat /tmp/prev-head 2>/dev/null || echo "") + if [ -n "$PREV" ]; then + CHANGED=$(git diff --name-only $PREV..HEAD 2>/dev/null || echo "") + else + CHANGED=$(git diff --name-only HEAD~1..HEAD 2>/dev/null || echo "") + fi + echo "Changed files: $CHANGED" + if echo "$CHANGED" | grep -qE "src/workers/|src/modules/ai-analysis/|src/modules/ai/|src/infrastructure/queue/|src/infrastructure/outbox/|prisma/schema.prisma|prisma/migrations/|test/worker-integration|test/run-integration"; then + echo "Worker-related changes detected — running integration tests" + echo "run_int=true" > /tmp/int-decision + else + echo "No Worker-related changes — skipping integration tests" + echo "run_int=false" > /tmp/int-decision + fi + + - name: Worker Integration tests + if: success() + run: | + RUN=$(cat /tmp/int-decision 2>/dev/null | grep -o 'true\|false' || echo "false") + if [ "$RUN" != "true" ]; then + echo "[integration] Skipped — no Worker-related changes" + exit 0 + fi cd $WORKDIR bash test/run-integration-tests.sh env: