forked from geoalchemy/geoalchemy2
-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (111 loc) · 3.7 KB
/
github_ci.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
tags:
- '*'
pull_request:
branches: [ master ]
env:
PGHOST: localhost
PGPASSWORD: gis
jobs:
# This workflow runs the tests
tests:
# Setup test matrix
strategy:
matrix:
# python-version: [2.7, 3.x, pypy3]
python-version: [2.7, 3.6]
# python-version: [2.7, 3.5, 3.6, 3.7, 3.8, pypy3]
# The type of runner that the job will run on
runs-on: ubuntu-18.04
services:
postgres:
image: mdillon/postgis:11
env:
POSTGRES_DB: gis
POSTGRES_PASSWORD: gis
POSTGRES_USER: gis
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Setup Python
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: x64
# Config PostgreSQL
- name: Configure PostgreSQL
run: |
# Create schema "gis" into database "gis"
psql -h localhost -p 5432 -U gis -d gis -c 'CREATE SCHEMA gis;'
# Add PostGIS extension to "gis" database
psql -h localhost -p 5432 -U gis -d gis -c 'CREATE EXTENSION IF NOT EXISTS postgis;'
# Check python version
- name: Display Python version
run: python -c "import sys; print(sys.version)"
# Cache dependencies
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip # This path is specific to Ubuntu
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
# Install dependencies
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y git autotools-dev libexpat1-dev libfreexl-dev libgeos-dev libproj-dev libreadline-dev libsqlite3-dev libsqlite3-mod-spatialite libxml2-dev zlib1g-dev
python -m pip install --upgrade pip
pip install tox tox-gh-actions flake8==3.7.9
# Run Flake8
- name: Run Flake8
run: |
# Run the library through flake8
flake8 --ignore=W503,W504 geoalchemy2 tests
# Run the test
- name: Run the tests
# run: tox
env:
SPATIALITE_LIBRARY_PATH: /usr/lib/x86_64-linux-gnu/mod_spatialite.so
run: |
echo "pip show:"
pip show tox tox-gh-actions
echo "which tox:"
which tox
# Run the unit test suite
# tox
# Run the unit test suite with SQLAlchemy=1.1.2
tox -e ${{ matrix.python-version }}
# tox -e ${{ matrix.python-version }}-sqla11
# Run the unit test suite with the latest version of SQLAlchemy
# tox -e ${{ matrix.python-version }}-sqlalatest --sitepackages
- name: Run coverage
run: |
pip install coveralls
coveralls
# Build distribution and deploy to Pypi
# - name: Build and deploy package
# if: startsWith(github.event.ref, 'refs/tags')
# env:
# TWINE_USERNAME: __token__
# TWINE_PASSWORD: ${{ secrets.pypi_token }}
# run: |
# pip install setuptools wheel twine
# python setup.py sdist bdist_wheel
# twine upload dist/*