fix(ci): validate venv cache by testing pytest, use python -m pytest
This commit is contained in:
@@ -54,7 +54,7 @@ jobs:
|
|||||||
cd dashboard/backend
|
cd dashboard/backend
|
||||||
if [ "${{ steps.cache-python.outputs.cache-hit }}" = "true" ]; then
|
if [ "${{ steps.cache-python.outputs.cache-hit }}" = "true" ]; then
|
||||||
echo "Restoring venv from cache $CACHE_KEY..."
|
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 -m pytest --version >/dev/null 2>&1; then
|
||||||
echo "Cache restored successfully"
|
echo "Cache restored successfully"
|
||||||
else
|
else
|
||||||
echo "Cache corrupted, installing fresh..."
|
echo "Cache corrupted, installing fresh..."
|
||||||
@@ -88,7 +88,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
cd dashboard/backend
|
cd dashboard/backend
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
pytest tests/ -v --timeout=60
|
python -m pytest tests/ -v --timeout=60
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "❌ Backend tests failed!"
|
echo "❌ Backend tests failed!"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user