10
10
branches : [ main ]
11
11
12
12
jobs :
13
+
13
14
build :
14
-
15
15
runs-on : ubuntu-latest
16
16
strategy :
17
17
matrix :
18
- python-version : [3.7, 3.8] # 3.9] removed to reduce testing time
19
- os :
20
- - " ubuntu-latest"
21
- - " macos-latest"
18
+ python-version : [3.7, 3.8]
19
+
20
+ services :
21
+ mysqldb_retriever :
22
+ image : mysql:5.7
23
+ env :
24
+ MYSQL_USER : travis
25
+ MYSQL_PASSWORD : Password12!
26
+ MYSQL_ROOT_PASSWORD : Password12!
27
+ MYSQL_DATABASE : testdb_retriever
28
+ ports :
29
+ - 3306:3306
30
+ options : >-
31
+ --health-cmd="mysqladmin ping"
32
+ --health-interval=10s
33
+ --health-timeout=5s
34
+ --health-retries=3
35
+
22
36
steps :
23
- - uses : actions/checkout@v2
24
- - name : Set up Python ${{ matrix.python-version }}
25
- uses : actions/setup-python@v2
26
- with :
27
- python-version : ${{ matrix.python-version }}
28
- - name : Install dependencies
29
- run : |
30
- python -m pip install --upgrade pip
31
- python -m pip install flake8 pytest
32
- if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
33
- - name : Run Tests in docker
34
- run : |
35
- docker-compose run --service-ports python_retriever pytest -v -k "not test_geojson2csv and not test_mysql_integration" --cov=retriever
36
- docker-compose run python_retriever flake8 --ignore=E501,W503,E402,F401,F403,E722,F841,W504 retriever --max-line-length=90 2>&1
37
- docker-compose run python_retriever yapf -d --recursive retriever/ --style=.style.yapf 2>&1
38
-
37
+ - uses : actions/checkout@v2
38
+
39
+ - name : Set up Postgresql with Postgis
40
+ uses : huaxk/postgis-action@v1
41
+ with :
42
+ postgresql version : ' 11'
43
+ postgresql user : ' postgres'
44
+ postgresql password : ' Password12!'
45
+ postgresql db : ' testdb_retriever'
46
+
47
+ - name : Set up Python ${{ matrix.python-version }}
48
+ uses : actions/setup-python@v2
49
+ with :
50
+ python-version : ${{ matrix.python-version }}
51
+
52
+ - name : Install dependencies
53
+ env :
54
+ LC_ALL : en_US.UTF-8
55
+ ENV LANG : en_US.UTF-8
56
+ ENV LANGUAGE : en_US.UTF-8
57
+ TZ : America/New_York
58
+ DEBIAN_FRONTEND : noninteractive
59
+ run : |
60
+ sudo apt-get update && sudo apt-get install -y --no-install-recommends apt-utils
61
+ sudo apt-get install -y --force-yes tzdata
62
+ sudo apt-get install -y --force-yes build-essential wget git locales locales-all > /dev/null
63
+ sudo apt-get install -y --force-yes libpq-dev
64
+ sudo apt-get install -y --force-yes postgis
65
+
66
+ - name : Setup paths and files
67
+ run : |
68
+ cd ..
69
+ chmod 0755 retriever/cli_tools/entrypoint.sh
70
+ sh retriever/cli_tools/entrypoint.sh
71
+ echo "export PATH="/usr/bin/python:$PATH"" >> ~/.profile
72
+ echo "export PYTHONPATH="/usr/bin/python:$PYTHONPATH"" >> ~/.profile
73
+ echo "export PGPASSFILE="~/.pgpass"" >> ~/.profile
74
+ chmod 0644 ~/.profile
75
+
76
+ - name : PostGIS check version
77
+ run : |
78
+ export PGPASSWORD='Password12!'
79
+ psql -d testdb_retriever -U postgres -h localhost -p 5432 -c "SELECT PostGIS_version();"
80
+
81
+ - name : Install python dependencies
82
+ run : |
83
+ python -m pip install --upgrade pip
84
+ python -m pip install flake8 pytest yapf codecov pytest-cov pytest-xdist -U
85
+ if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
86
+
87
+ - name : Install retriever
88
+ run : |
89
+ pip install -e .
90
+ export PGPASSFILE="~/.pgpass"
91
+ chmod 600 ~/.pgpass
92
+ chmod 600 ~/.my.cnf
93
+
94
+ - name : Run pytest
95
+ run : |
96
+ pytest -v -k "not test_geojson2csv and not test_mysql_integration" --cov=retriever
97
+ flake8 --ignore=E501,W503,E402,F401,F403,E722,F841,W504 retriever --max-line-length=90 2>&1
98
+ yapf -d --recursive ./retriever/ --style=.style.yapf 2>&1
0 commit comments