Skip to content

Merge pull request #174 from ziyadsheeba/devel #214

Merge pull request #174 from ziyadsheeba/devel

Merge pull request #174 from ziyadsheeba/devel #214

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python application
on:
push:
branches: [ master, devel ]
pull_request:
branches: [ master, devel ]
jobs:
build:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Prepare directory for packing with zip
run: |
mkdir -p out/deepness
cp -r src/deepness/ out/deepness/deepness
- name: Update
run: |
sudo apt update
- if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt install gnupg software-properties-common
sudo mkdir -m755 -p /etc/apt/keyrings
sudo wget -O /etc/apt/keyrings/qgis-archive-keyring.gpg https://download.qgis.org/downloads/qgis-archive-keyring.gpg
echo $'Types: deb deb-src\nURIs: https://qgis.org/debian\nSuites: focal\nArchitectures: amd64\nComponents: main\nSigned-By: /etc/apt/keyrings/qgis-archive-keyring.gpg' | sudo tee -a /etc/apt/sources.list.d/qgis.sources
sudo apt update
- name: Install qgis
run: |
sudo apt install -yq qgis
- name: Install dependencies
run: |
pip install --upgrade pip
pip install --upgrade -r ./src/deepness/python_requirements/requirements.txt
pip install --upgrade -r ./src/deepness/python_requirements/requirements_development.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
python3 -m flake8 src/deepness/ --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
python3 -m flake8 src/deepness/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
export PYTHONPATH="/usr/lib/python3/dist-packages":PYTHONPATH && echo "import qgis" | python3
export PYTHONPATH="$PYTHONPATH:$(pwd)/src"
export PYTHONPATH="$PYTHONPATH:$(pwd)"
# apparently there is some issue with opencv-python-headless, we need to reinstall it
pip uninstall opencv-python-headless --yes
pip install --upgrade -r ./src/deepness/python_requirements/requirements.txt
# we need 'xvfb-run' to simulate UI - otherwise qgis crushes
xvfb-run -e /dev/stdout python3 -m pytest --cov=src/deepness/ --cov-report html test/
- name: 'Upload Artifact - test coverage'
uses: actions/upload-artifact@v3
with:
name: htmlcov
path: htmlcov/
retention-days: 30
- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
with:
name: deepness
path: out/deepness
retention-days: 89