Skip to content

Commit 43a4945

Browse files
committed
Updated python-package.yml
1 parent f5b30aa commit 43a4945

File tree

4 files changed

+85
-25
lines changed

4 files changed

+85
-25
lines changed

.github/workflows/python-package.yml

+81-21
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,89 @@ on:
1010
branches: [ main ]
1111

1212
jobs:
13+
1314
build:
14-
1515
runs-on: ubuntu-latest
1616
strategy:
1717
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+
2236
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

cli_tools/.my.cnf

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
user="travis"
33
password="Password12!"
44
host="mysqldb_retriever"
5-
port="3306"
5+
port="3306"

cli_tools/.pgpass

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
python_retriever:*:testdb_retriever:postgres:Password12!
1+
localhost:*:*:postgres:Password12!

cli_tools/entrypoint.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -e
33

44
# Copy config files to $HOME
5-
cp -r /retriever/cli_tools/.pgpass ~/
6-
cp -r /retriever/cli_tools/.my.cnf ~/
5+
cp -r retriever/cli_tools/.pgpass ~/
6+
cp -r retriever/cli_tools/.my.cnf ~/
77

88
exec "$@"

0 commit comments

Comments
 (0)