-
Notifications
You must be signed in to change notification settings - Fork 132
111 lines (94 loc) · 3.69 KB
/
python-package.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python package
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.11]
services:
mysqldb_retriever:
image: mysql:5.7
env:
MYSQL_USER: travis
MYSQL_PASSWORD: Password12!
MYSQL_ROOT_PASSWORD: Password12!
MYSQL_DATABASE: testdb_retriever
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- uses: actions/checkout@v2
- name: Set up Postgresql with Postgis
uses: huaxk/postgis-action@v1
with:
postgresql version: '11'
postgresql user: 'postgres'
postgresql password: 'Password12!'
postgresql db: 'testdb_retriever'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
env:
LC_ALL : en_US.UTF-8
ENV LANG : en_US.UTF-8
ENV LANGUAGE : en_US.UTF-8
TZ: America/New_York
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update && sudo apt-get install -y --no-install-recommends apt-utils
sudo apt-get install -y --force-yes tzdata
sudo apt-get install -y --force-yes build-essential wget git locales locales-all > /dev/null
sudo apt-get install -y --force-yes libpq-dev
sudo apt-get install libgdal-dev
sudo apt-get install gdal-bin
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
pip install GDAL
sudo apt-get install -y --force-yes postgis
- name: Setup paths and files
run : |
chmod 0755 cli_tools/entrypoint.sh
sh cli_tools/entrypoint.sh
echo "export PATH="/usr/bin/python:$PATH"" >> ~/.profile
echo "export PYTHONPATH="/usr/bin/python:$PYTHONPATH"" >> ~/.profile
echo "export PGPASSFILE="~/.pgpass"" >> ~/.profile
chmod 0644 ~/.profile
- name: PostGIS check version
run : |
export PGPASSWORD='Password12!'
psql -d testdb_retriever -U postgres -h localhost -p 5432 -c "SELECT PostGIS_version();"
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest yapf codecov pytest-cov pytest-xdist openpyxl -U
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install retriever
run: |
pip install -e .
export PGPASSFILE="~/.pgpass"
chmod 600 ~/.pgpass
chmod 600 ~/.my.cnf
- name: Run pytest
run: |
pytest -v -k "not test_geojson2csv and not test_mysql_integration" --cov=./retriever --cov-report=xml
flake8 --ignore=E501,W503,E402,F401,F403,E722,F841,W504 retriever --max-line-length=90 2>&1
yapf -d --recursive ./retriever/ --style=.style.yapf 2>&1
- name: Upload coverage to Codecov
if: matrix.python-version == 3.8
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}