ci: add venv corruption detection and auto-rebuild in package tests
Some checks failed
Package Tests / Python package - aitbc-agent-sdk (push) Failing after 3s
Package Tests / Python package - aitbc-core (push) Failing after 2s
Package Tests / Python package - aitbc-crypto (push) Failing after 4s
Package Tests / Python package - aitbc-sdk (push) Failing after 1s
Package Tests / JavaScript package - aitbc-sdk-js (push) Successful in 6m12s
Package Tests / JavaScript package - aitbc-token (push) Failing after 10s

Added validation checks for venv and venv-build directories with automatic rebuild on corruption detection. Checks for executable pip/python binaries and rebuilds the venv if not found.
This commit is contained in:
aitbc
2026-04-19 21:28:26 +02:00
parent 3a5e8782ca
commit 097cd9cccf

View File

@@ -59,6 +59,17 @@ jobs:
--mode copy \ --mode copy \
--extra-packages "pytest mypy black" --extra-packages "pytest mypy black"
# Validate venv and rebuild if corrupted
if [[ ! -x "venv/bin/pip" ]]; then
echo "⚠️ Corrupted venv detected, rebuilding..."
rm -rf venv
bash "$WORKSPACE/repo/scripts/ci/setup-python-venv.sh" \
--repo-dir "$PWD" \
--venv-dir "$PWD/venv" \
--mode copy \
--extra-packages "pytest mypy black"
fi
if [[ "${{ matrix.package.name }}" == "aitbc-sdk" ]]; then if [[ "${{ matrix.package.name }}" == "aitbc-sdk" ]]; then
venv/bin/pip install -q -e "$WORKSPACE/repo/packages/py/aitbc-crypto" venv/bin/pip install -q -e "$WORKSPACE/repo/packages/py/aitbc-crypto"
fi fi
@@ -99,6 +110,18 @@ jobs:
--venv-dir "$PWD/venv-build" \ --venv-dir "$PWD/venv-build" \
--skip-requirements \ --skip-requirements \
--extra-packages "build" --extra-packages "build"
# Validate venv-build and rebuild if corrupted
if [[ ! -x "venv-build/bin/python" ]]; then
echo "⚠️ Corrupted venv-build detected, rebuilding..."
rm -rf venv-build
bash "$WORKSPACE/repo/scripts/ci/setup-python-venv.sh" \
--repo-dir "$PWD" \
--venv-dir "$PWD/venv-build" \
--skip-requirements \
--extra-packages "build"
fi
venv-build/bin/python -m build venv-build/bin/python -m build
echo "✅ Package built" echo "✅ Package built"
fi fi