Skip to content

Commit 96ea661

Browse files
committed
Create python-app.yml
First try at github actions
1 parent d83691b commit 96ea661

File tree

2 files changed

+116
-2
lines changed

2 files changed

+116
-2
lines changed

.github/workflows/python-app.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# This workflow will install Python dependencies, run tests and lint with a single version of Python
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Python application
5+
6+
on:
7+
push:
8+
branches: [ master ]
9+
pull_request:
10+
branches: [ master ]
11+
12+
jobs:
13+
tests_python:
14+
name: Test on Python ${{ matrix.python_version }} and Django ${{ matrix.django_version }} on ${{ matrix.database }}
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
django_version: [ '1.11', '2.0', '2.1', '2.2', '3.0', '3.1' ]
19+
python_version: [ '3.4', '3.5', '3.6', '3.7', '3.8', '3.9' ]
20+
database: [ 'postgres' ]
21+
exclude:
22+
- django_version: '1.11'
23+
python_version: '3.8'
24+
- django_version: '1.11'
25+
python_version: '3.9'
26+
27+
- django_version: '2.0'
28+
python_version: '3.8'
29+
- django_version: '2.0'
30+
python_version: '3.9'
31+
32+
- django_version: '2.1'
33+
python_version: '3.4'
34+
- django_version: '2.1'
35+
python_version: '3.8'
36+
- django_version: '2.1'
37+
python_version: '3.9'
38+
39+
- django_version: '2.2'
40+
python_version: '3.4'
41+
42+
- django_version: '3.0'
43+
python_version: '3.4'
44+
- django_version: '3.0'
45+
python_version: '3.5'
46+
47+
- django_version: '3.1'
48+
python_version: '3.4'
49+
- django_version: '3.1'
50+
python_version: '3.5'
51+
include:
52+
- django_version: '2.2'
53+
python_version: '3.7'
54+
database: 'sqlite'
55+
env:
56+
SPATIALITE_LIBRARY_PATH: 'mod_spatialite'
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
59+
60+
services:
61+
postgres:
62+
image: postgis/postgis:10-2.5
63+
env:
64+
# must specify password for PG Docker container image, see: https://registry.hub.docker.com/_/postgres?tab=description&page=1&name=10
65+
POSTGRES_PASSWORD: password
66+
POSTGRES_DB: test_db
67+
ports:
68+
- 5432:5432
69+
# needed because the postgres container does not provide a healthcheck
70+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
71+
72+
steps:
73+
- uses: actions/checkout@v2
74+
- name: Set up Python ${{ matrix.python_version }}
75+
uses: actions/setup-python@v2
76+
with:
77+
python-version: ${{ matrix.python_version }}
78+
- name: Install dependencies
79+
run: |
80+
sudo apt-get update -qq
81+
sudo apt-get install -y libproj-dev libgeos-dev gdal-bin libgdal-dev
82+
python -m pip install --upgrade pip
83+
pip install flake8 coveralls psycopg2-binary argparse
84+
pip install Django~=${{ matrix.django_version }}
85+
- name: Lint with flake8
86+
run: |
87+
flake8 --ignore=E501,W504 leaflet
88+
- name: Test Django >= 2.0
89+
if: matrix.django_version != '1.11'
90+
run: |
91+
python -W error::DeprecationWarning -W error::PendingDeprecationWarning -m coverage run ./quicktest.py leaflet --db=${{ matrix.database }}
92+
- name: Test Django 1.11
93+
if: matrix.django_version == '1.11'
94+
run: |
95+
python -m coverage run ./quicktest.py leaflet --db=${{ matrix.database }}
96+
- name: Coverage
97+
if: ${{ success() }}
98+
run: |
99+
coveralls
100+
101+
tests_node:
102+
runs-on: ubuntu-latest
103+
steps:
104+
- uses: actions/checkout@v2
105+
- name: Use Node.js
106+
uses: actions/setup-node@v1
107+
with:
108+
node-version: 8.12.0
109+
- name: Install dependencies
110+
run: |
111+
npm install leaflet/tests/
112+
- name: Test node
113+
run: |
114+
node node_modules/mocha-phantomjs/bin/mocha-phantomjs leaflet/tests/index.html

quicktest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ def run_tests(self):
4242
'default': {
4343
'ENGINE': 'django.contrib.gis.db.backends.postgis',
4444
'NAME': 'test_db',
45-
'HOST': '127.0.0.1',
45+
'HOST': 'localhost',
4646
'USER': 'postgres',
47-
'PASSWORD': '',
47+
'PASSWORD': 'password',
4848
}
4949
}
5050

0 commit comments

Comments
 (0)