6666 contents : read
6767
6868 container :
69- image : qgis/qgis:release-3_28
69+ image : qgis/qgis:3.40
7070 env :
7171 CI : true
7272 DISPLAY : " :1"
7575 PYTHONPATH : " /usr/share/qgis/python/plugins:/usr/share/qgis/python:."
7676 QT_QPA_PLATFORM : " offscreen"
7777 WITH_PYTHON_PEP : false
78- options : -v /tmp/.X11-unix:/tmp/.X11-unix -v ${{ github.workspace }}:/tests_directory
78+ # be careful, things have changed since QGIS 3.40. So if you are using this setup
79+ # with a QGIS version older than 3.40, you may need to change the way you set up the container
80+ volumes :
81+ # Mount the X11 socket to allow GUI applications to run
82+ - /tmp/.X11-unix:/tmp/.X11-unix
83+ # Mount the workspace directory to the container
84+ - ${{ github.workspace }}:/home/root/
7985
8086 steps :
8187 - name : Get source code
@@ -87,16 +93,26 @@ jobs:
8793 - name : Print Python version
8894 run : python3 --version
8995
90- - name : Setup plugin
91- run : qgis_setup.sh qtribu
92-
9396 - name : Install Python requirements
9497 run : |
95- python3 -m pip install -U pip setuptools wheel
98+ apt update && apt install -y curl python3-pip python3-venv pipx
99+ # Create a virtual environment
100+ cd /home/root/
101+ pipx run qgis-venv-creator --venv-name ".venv"
102+ # Activate the virtual environment
103+ . .venv/bin/activate
104+ # Install the requirements
96105 python3 -m pip install -U -r requirements/testing.txt
97106
98107 - name : Run Unit tests
99- run : pytest tests/qgis -o junit_family=legacy --junitxml=junit.xml
108+ run : |
109+ cd /home/root/
110+ # Activate the virtual environment
111+ . .venv/bin/activate
112+ # Run the tests
113+ # xvfb-run is used to run the tests in a virtual framebuffer
114+ # This is necessary because QGIS requires a display to run
115+ xvfb-run python3 -m pytest tests/qgis -o junit_family=legacy --junitxml=junit.xml
100116
101117 - name : Upload coverage to Codecov
102118 uses : codecov/codecov-action@v5
0 commit comments