Use project venv in CI to satisfy PEP 668 on Ubuntu runner.
All checks were successful
CI / lint-and-test (pull_request) Successful in 59s
CI / security-scan (pull_request) Successful in 51s
CI / docker-build-test (pull_request) Successful in 7s
CI / dependency-scan (pull_request) Successful in 14s
CI / workflow-summary (pull_request) Successful in 4s

Gitea act_runner images block system-wide pip; install deps into .venv and invoke tools from .venv/bin.
This commit is contained in:
ilia 2026-05-26 20:17:56 -04:00
parent 648d5ac742
commit bc68f8a752

View File

@ -28,19 +28,20 @@ jobs:
- name: Check out code
uses: actions/checkout@v4
- name: Install Python dependencies
- name: Set up Python venv
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -e ".[dev]"
python3 -m venv .venv
.venv/bin/pip install --upgrade pip
.venv/bin/pip install -e ".[dev]"
- name: Run linters
run: |
echo "Running ruff..."
ruff check src/ tests/ || true
.venv/bin/ruff check src/ tests/ || true
echo "Running black check..."
black --check src/ tests/ || true
.venv/bin/black --check src/ tests/ || true
echo "Running mypy..."
mypy src/ --install-types --non-interactive || true
.venv/bin/mypy src/ --install-types --non-interactive || true
- name: Run tests with coverage
env:
@ -51,16 +52,16 @@ jobs:
SMTP_PASSWORD: ${{ secrets.SMTP_PASSWORD || 'dummy' }}
FROM_EMAIL: ${{ secrets.FROM_EMAIL || 'test@example.com' }}
run: |
python3 -m pytest tests/ -v --cov=src/pote --cov-report=term --cov-report=xml
.venv/bin/pytest tests/ -v --cov=src/pote --cov-report=term --cov-report=xml
- name: Test scripts
env:
DATABASE_URL: postgresql://poteuser:${{ secrets.DB_PASSWORD || 'testpass123' }}@postgres:5432/potedb_test
run: |
echo "Testing database migrations..."
alembic upgrade head
.venv/bin/alembic upgrade head
echo "Testing price loader..."
python scripts/fetch_sample_prices.py || true
.venv/bin/python scripts/fetch_sample_prices.py || true
security-scan:
runs-on: ubuntu-latest
@ -68,21 +69,21 @@ jobs:
- name: Check out code
uses: actions/checkout@v4
- name: Install dependencies
- name: Set up Python venv
run: |
python3 -m pip install --upgrade pip
python3 -m pip install safety bandit
python3 -m venv .venv
.venv/bin/pip install --upgrade pip
.venv/bin/pip install -e ".[dev]" safety bandit
- name: Run safety check
run: |
python3 -m pip install -e .
python3 -m safety check --json || true
.venv/bin/safety check --json || true
continue-on-error: true
- name: Run bandit security scan
run: |
python3 -m bandit -r src/ -f json -o bandit-report.json || true
python3 -m bandit -r src/ -f screen
.venv/bin/bandit -r src/ -f json -o bandit-report.json || true
.venv/bin/bandit -r src/ -f screen
continue-on-error: true
dependency-scan: