From 56fdd07802bbeb95d83d80de461d3d634b93e2fe Mon Sep 17 00:00:00 2001 From: catborise Date: Fri, 25 Sep 2026 21:48:38 +0300 Subject: [PATCH] ci: add GitHub Actions test suite workflow for Python 3.10, 3.11, and 3.12 - Configure matrix testing across Python 3.10, 3.11, and 3.12 on ubuntu-latest - Install system libvirt, ldap, and C build dependencies with pip cache - Run Django database migrations and test suite - Run vrtManager unit test discovery with test_*.py pattern - Fix vrtManager unittest discovery command in README.md --- .github/workflows/test.yml | 66 ++++++++++++++++++++++++++++++++++++++ README.md | 2 +- 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..8e71d94 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,66 @@ +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'] + + 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' + + - name: Install System Dependencies + run: | + sudo apt-get update -qq + sudo apt-get install -y --no-install-recommends \ + libvirt-dev \ + libldap2-dev \ + libsasl2-dev \ + python3-lxml \ + zlib1g-dev \ + libxslt1-dev \ + pkg-config \ + gcc \ + libssl-dev \ + libxml2-dev + + - name: Install Python Dependencies + run: | + python -m pip install --upgrade pip setuptools wheel + pip install -r conf/requirements.txt + if [ -f dev/requirements.txt ]; then pip install -r dev/requirements.txt; fi + + - 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: Run Django Migrations + run: | + python manage.py migrate --noinput + + - name: Run Django Test Suite + run: | + python manage.py test + + - name: Run vrtManager Unit Tests + run: | + python -m unittest discover -s vrtManager -p "test_*.py" diff --git a/README.md b/README.md index a22b8f9..36f876a 100644 --- a/README.md +++ b/README.md @@ -390,7 +390,7 @@ pip install -r dev/requirements.txt python manage.py test # Run vrtManager unit tests: -python -m unittest discover -s vrtManager/tests +python -m unittest discover -s vrtManager -p "test_*.py" ``` > **Live Hypervisor Testing (Optional):**