1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-08 11:16:47 +00:00
webvirtcloud/.github/workflows/test.yml
catborise 964b58778d ci: test Python 3.13, check migrations, schema, deploy and audit
- Matrix 3.10-3.13; pip cache keyed on the requirements.
- New steps: makemigrations --check, spectacular --validate
  --fail-on-warn, check --deploy --fail-level ERROR, pip-audit of the
  installed environment (the Django 4.2.30 advisories are ignored until
  the Django 5.2 upgrade), and a Docker image build.
- The separate vrtManager unittest run is dropped; manage.py test
  already runs those tests.
- CodeQL also runs on pull requests to master.
- Docker installs into a plain venv instead of using the distro's
  python3-lxml and python3-libvirt; lxml>=6.1, since the distro's
  lxml 5.2.1 has CVE-2026-41066.
- dev requirements add ruff and pip-audit.
2026-10-04 01:08:11 +03:00

93 lines
2.8 KiB
YAML

name: Test Suite
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
test:
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
conf/requirements.txt
dev/requirements.txt
# Build headers for the sdist-only bindings (libvirt-python, python-ldap)
- name: Install System Dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
libvirt-dev \
libldap2-dev \
libsasl2-dev \
pkg-config \
gcc
- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip setuptools
pip install -r dev/requirements.txt
- name: Configure WebVirtCloud Settings
run: |
cp webvirtcloud/settings.py.template webvirtcloud/settings.py
SECRET_KEY=$(python -c 'import secrets; print(secrets.token_urlsafe(50))')
sed -i "s|^SECRET_KEY = .*|SECRET_KEY = \"${SECRET_KEY}\"|" webvirtcloud/settings.py
- name: Check For Missing Migrations
run: python manage.py makemigrations --check --dry-run
- name: Run Django Migrations
run: python manage.py migrate --noinput
# Includes the vrtManager tests
- name: Run Test Suite
run: python manage.py test
- name: Validate OpenAPI Schema
run: python manage.py spectacular --validate --fail-on-warn --file /dev/null
# Security warnings (HSTS, secure cookies) depend on the deployment;
# gate on errors only.
- name: Deployment Checks
run: python manage.py check --deploy --fail-level ERROR
# The ignored IDs are Django 4.2.30 advisories, fixed in Django 5.2.17.
# Remove them with the Django 5.2 upgrade.
- name: Audit Installed Packages
run: |
pip-audit \
--ignore-vuln PYSEC-2026-198 \
--ignore-vuln PYSEC-2026-199 \
--ignore-vuln PYSEC-2026-201 \
--ignore-vuln PYSEC-2026-2090 \
--ignore-vuln PYSEC-2026-2091 \
--ignore-vuln PYSEC-2026-2092 \
--ignore-vuln PYSEC-2026-3717 \
--ignore-vuln PYSEC-2026-4035
docker:
name: Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Build Image
run: docker build -t webvirtcloud:ci .