perf(ci): skip Worker Integration when no worker-related paths changed
All checks were successful
Deploy API Server / build-and-unit (push) Successful in 31s
Deploy API Server / current-integration (push) Successful in 30s
Deploy API Server / backward-compat (push) Successful in 16s
Deploy API Server / deploy (push) Successful in 1m2s

- 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 <noreply@anthropic.com>
This commit is contained in:
wangdl 2026-06-20 14:14:56 +08:00
parent e0a799de6c
commit 703703bb56

View File

@ -97,8 +97,32 @@ jobs:
DATABASE_URL: ${{ secrets.DATABASE_URL }} DATABASE_URL: ${{ secrets.DATABASE_URL }}
timeout-minutes: 5 timeout-minutes: 5
- name: Worker Integration tests - name: Check if Worker paths changed
run: | 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 cd $WORKDIR
bash test/run-integration-tests.sh bash test/run-integration-tests.sh
env: env: