ci: add pytest --maxfail=1 and simple pip/venv cache at /cache if available
Some checks failed
CI / Lint, test, and build (push) Failing after 33s

This commit is contained in:
ngxstat-bot 2025-08-16 05:15:59 -05:00
commit 136b4196ea

View file

@ -65,11 +65,33 @@ jobs:
- name: Set up venv and install deps - name: Set up venv and install deps
run: | run: |
set -euo pipefail set -euo pipefail
python3 -m venv .venv # Prefer persistent cache if runner provides /cache
USE_CACHE=0
if [ -d /cache ] && [ -w /cache ]; then
export PIP_CACHE_DIR=/cache/pip
mkdir -p "$PIP_CACHE_DIR"
REQ_HASH=$(sha256sum requirements.txt | awk '{print $1}')
PYVER=$(python3 -c 'import sys;print(".".join(map(str, sys.version_info[:2])))')
CACHE_VENV="/cache/venv-${REQ_HASH}-py${PYVER}"
if [ -d "$CACHE_VENV" ]; then
echo "Using cached virtualenv: $CACHE_VENV"
ln -s "$CACHE_VENV" .venv
USE_CACHE=1
else
echo "Creating cached virtualenv: $CACHE_VENV"
python3 -m venv "$CACHE_VENV"
ln -s "$CACHE_VENV" .venv
fi
fi
. .venv/bin/activate . .venv/bin/activate
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -r requirements.txt if [ "$USE_CACHE" = "1" ]; then
pip install pytest # Ensure required packages are present; pip will use cache
pip install -r requirements.txt pytest || pip install -r requirements.txt pytest
else
pip install -r requirements.txt pytest
fi
- name: Format check (black) - name: Format check (black)
run: | run: |
@ -84,7 +106,7 @@ jobs:
- name: Run tests (pytest) - name: Run tests (pytest)
run: | run: |
. .venv/bin/activate . .venv/bin/activate
pytest -q pytest -q --maxfail=1
- name: Build sample reports (no artifact upload) - name: Build sample reports (no artifact upload)
run: | run: |