Skip to content

update(ci): bump QGIS 3.40 for testing #551

update(ci): bump QGIS 3.40 for testing

update(ci): bump QGIS 3.40 for testing #551

Workflow file for this run

name: "🎳 Tester"
on:
push:
branches:
- main
paths:
- "**.py"
- .github/workflows/tester.yml
- requirements/testing.txt
pull_request:
branches:
- main
paths:
- "**.py"
- .github/workflows/tester.yml
- requirements/testing.txt
env:
PROJECT_FOLDER: "qtribu"
PYTHON_VERSION: 3.9
jobs:
tests-unit:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Get source code
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
cache: "pip"
cache-dependency-path: "requirements/testing.txt"
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Python requirements
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -U -r requirements/testing.txt
- name: Run Unit tests
run: pytest -p no:qgis tests/unit/ -o junit_family=legacy --junitxml=junit.xml
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
env_vars: PYTHON_VERSION
flags: unittests
name: Code Coverage for unittests on Ubuntu.python-${{ env.PYTHON_VERSION }}]
token: ${{ secrets.CODECOV_TOKEN }}
test-qgis:
runs-on: ubuntu-latest
permissions:
contents: read
container:
image: qgis/qgis:3.40
env:
CI: true
DISPLAY: ":1"
MUTE_LOGS: true
NO_MODALS: 1
PYTHONPATH: "/usr/share/qgis/python/plugins:/usr/share/qgis/python:."
QT_QPA_PLATFORM: "offscreen"
WITH_PYTHON_PEP: false
# be careful, things have changed since QGIS 3.40. So if you are using this setup
# with a QGIS version older than 3.40, you may need to change the way you set up the container
volumes:
# Mount the X11 socket to allow GUI applications to run
- /tmp/.X11-unix:/tmp/.X11-unix
# Mount the workspace directory to the container
- ${{ github.workspace }}:/home/root/
steps:
- name: Get source code
uses: actions/checkout@v6
- name: Print QGIS version
run: qgis --version
- name: Print Python version
run: python3 --version
- name: Install Python requirements
run: |
apt update && apt install -y curl python3-pip python3-venv pipx
# Create a virtual environment
cd /home/root/
pipx run qgis-venv-creator --venv-name ".venv"
# Activate the virtual environment
. .venv/bin/activate
# Install the requirements
python3 -m pip install -U -r requirements/testing.txt
- name: Run Unit tests
run: |
cd /home/root/
# Activate the virtual environment
. .venv/bin/activate
# Run the tests
# xvfb-run is used to run the tests in a virtual framebuffer
# This is necessary because QGIS requires a display to run
xvfb-run python3 -m pytest tests/qgis -o junit_family=legacy --junitxml=junit.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
env_vars: PYTHON_VERSION
flags: qgis-tests
name: Code Coverage for QGIS tests
token: ${{ secrets.CODECOV_TOKEN }}