-
Notifications
You must be signed in to change notification settings - Fork 26
75 lines (67 loc) · 2.93 KB
/
python-app-ubuntu.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# 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
cp ./LICENSE 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