From 951d68f022de767d828aee9a1efe44ab48f52953 Mon Sep 17 00:00:00 2001 From: "Gan, Jimmy" Date: Wed, 3 Jun 2026 11:42:24 +0800 Subject: [PATCH] Validate cached venv before use (test python binary works) Cached venvs from NAS Docker containers have broken symlinks when restored on the VPS host, causing "pytest: command not found". Add a functional check that venv/bin/python runs before accepting the cache as valid. Co-Authored-By: Claude Opus 4.8 --- .gitea/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index bb4b766..34e15b5 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -55,7 +55,7 @@ jobs: cd dashboard/backend if [ "${{ steps.cache-python.outputs.cache-hit }}" = "true" ]; then echo "Restoring venv from cache $CACHE_KEY..." - if cp -a $CACHE_DIR/venv . && [ -f venv/bin/activate ]; then + if cp -a $CACHE_DIR/venv . && [ -f venv/bin/activate ] && venv/bin/python -c "import sys; sys.exit(0)"; then echo "Cache restored successfully" else echo "Cache corrupted, installing fresh..."