diff --git a/.gitea/workflows/cd.yaml b/.gitea/workflows/cd.yaml index a6cabe695..08e96e945 100644 --- a/.gitea/workflows/cd.yaml +++ b/.gitea/workflows/cd.yaml @@ -163,7 +163,7 @@ jobs: # 2026-05-19 Codex: CI image runs as root against a bind-mounted # checkout. Remove Python cache artifacts before act-runner cleanup # so successful jobs do not end with root-owned __pycache__ noise. - find tests -type d -name __pycache__ -prune -exec rm -rf {} + 2>/dev/null || true + find tests src -type d -name __pycache__ -prune -exec rm -rf {} + 2>/dev/null || true rm -rf .pytest_cache 2>/dev/null || true } # CI 排除需外部服務的測試 (Redis pool / Ollama — 2026-04-01 Claude Code) @@ -259,7 +259,7 @@ jobs: docker rm -f pg-test-b5 || true # 2026-05-20 Codex: B5 imports shared tests helpers, so cleanup the # whole tests tree to avoid root-owned __pycache__ act-runner noise. - find tests -type d -name __pycache__ -prune -exec rm -rf {} + 2>/dev/null || true + find tests src -type d -name __pycache__ -prune -exec rm -rf {} + 2>/dev/null || true rm -rf .pytest_cache 2>/dev/null || true exit "${PYTEST_EXIT:-0}" CI_SCRIPT diff --git a/scripts/ci/cleanup-host-runner-workspace.sh b/scripts/ci/cleanup-host-runner-workspace.sh index ee379f4b5..6491f5702 100755 --- a/scripts/ci/cleanup-host-runner-workspace.sh +++ b/scripts/ci/cleanup-host-runner-workspace.sh @@ -44,6 +44,9 @@ has_leftovers() { [ -d "$root/apps/web/tests/e2e/.auth" ] && return 0 [ -d "$root/node_modules" ] && return 0 [ -d "$root/apps/web/node_modules" ] && return 0 + find "$root/apps/api/tests" "$root/apps/api/src" \ + -type d -name __pycache__ -print -quit \ + 2>/dev/null | grep -q . && return 0 find "$root/apps" "$root/packages" \ -mindepth 2 -maxdepth 2 -type d -name node_modules -print -quit \ 2>/dev/null | grep -q .