clean project ahead of each test #250
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests for Plugin LoS Tools | |
on: | |
push: | |
paths: | |
- "los_tools/**" | |
- ".github/workflows/test_plugin.yaml" | |
- "tests/**" | |
jobs: | |
Tests-plugin-LoS-Tools: | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Install | |
run: | | |
sudo apt-get install python3-pytest python3-pytest-cov python3-pytestqt | |
- name: Prepare QGIS | |
run: | | |
sudo gpg -k && \ | |
KEYRING=/usr/share/keyrings/qgis-archive-keyring.gpg && \ | |
wget -O $KEYRING https://download.qgis.org/downloads/qgis-archive-keyring.gpg && \ | |
sudo touch /etc/apt/sources.list.d/qgis.sources && \ | |
echo 'Types: deb deb-src' | sudo tee -a /etc/apt/sources.list.d/qgis.sources && \ | |
echo 'URIs: https://qgis.org/ubuntugis' | sudo tee -a /etc/apt/sources.list.d/qgis.sources && \ | |
echo 'Suites: '$(lsb_release -c -s) | sudo tee -a /etc/apt/sources.list.d/qgis.sources && \ | |
echo 'Architectures: '$(dpkg --print-architecture) | sudo tee -a /etc/apt/sources.list.d/qgis.sources && \ | |
echo 'Components: main' | sudo tee -a /etc/apt/sources.list.d/qgis.sources && \ | |
echo 'Signed-By: '$KEYRING | sudo tee -a /etc/apt/sources.list.d/qgis.sources && \ | |
LASTSUPPORTED=focal && \ | |
KEYRING=/usr/share/keyrings/ubuntugis-archive-keyring.gpg && \ | |
sudo gpg --no-default-keyring --keyring $KEYRING --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 6B827C12C2D425E227EDCA75089EBE08314DF160 && \ | |
sudo touch /etc/apt/sources.list.d/ubuntugis-unstable.sources && \ | |
echo 'Types: deb deb-src' | sudo tee -a /etc/apt/sources.list.d/ubuntugis-unstable.sources && \ | |
echo 'URIs:https://ppa.launchpadcontent.net/ubuntugis/ubuntugis-unstable/ubuntu' | sudo tee -a /etc/apt/sources.list.d/ubuntugis-unstable.sources && \ | |
echo 'Suites: '$(lsb_release -c -s)| sudo tee -a /etc/apt/sources.list.d/ubuntugis-unstable.sources && \ | |
echo 'Architectures: '$(dpkg --print-architecture) | sudo tee -a /etc/apt/sources.list.d/ubuntugis-unstable.sources && \ | |
echo 'Components: main' | sudo tee -a /etc/apt/sources.list.d/ubuntugis-unstable.sources && \ | |
echo 'Signed-By: '$KEYRING | sudo tee -a /etc/apt/sources.list.d/ubuntugis-unstable.sources | |
- name: Install | |
run: | | |
sudo apt-get update && \ | |
sudo apt-get -y -q install --no-install-recommends wget software-properties-common build-essential ca-certificates python3-pip dialog apt-utils && \ | |
sudo apt -y -q install qgis qgis-dev qgis-plugin-grass | |
- name: QGIS Version | |
run: qgis --version | |
- name: Install Python packages | |
run: pip install pytest-qgis --break-system-packages | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Add Python Path | |
run: | | |
echo "PYTHONPATH=$PYTHONPATH:/usr/share/qgis/python/plugins:/usr/share/qgis/python:$PWD" >> $GITHUB_ENV | |
echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV | |
echo "QT_QPA_PLATFORM=offscreen" >> $GITHUB_ENV | |
echo "XDG_RUNTIME_DIR=/tmp" >> $GITHUB_ENV | |
- name: Print Python Path | |
run: echo $PYTHONPATH | |
- name: Run Tests | |
run: | | |
pytest tests --cov=los_tools --cov-report=term-missing:skip-covered -rP -s |