Skip to content

Commit 854ac59

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

File tree

2 files changed

+122
-2
lines changed

2 files changed

+122
-2
lines changed

.github/workflows/python-app.yml

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
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: Cache pip
79+
uses: actions/cache@v2
80+
with:
81+
# This path is specific to Ubuntu
82+
path: ~/.cache/pip
83+
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ matrix.django_version }}-${{ matrix.database }}
84+
- name: Install dependencies
85+
run: |
86+
sudo apt-get update -qq
87+
sudo apt-get install -y libproj-dev libgeos-dev gdal-bin libgdal-dev
88+
python -m pip install --upgrade pip
89+
pip install -U flake8 coveralls psycopg2-binary argparse
90+
pip install -U Django~=${{ matrix.django_version }}
91+
- name: Lint with flake8
92+
run: |
93+
flake8 --ignore=E501,W504 leaflet
94+
- name: Test Django >= 2.0
95+
if: matrix.django_version != '1.11'
96+
run: |
97+
python -W error::DeprecationWarning -W error::PendingDeprecationWarning -m coverage run ./quicktest.py leaflet --db=${{ matrix.database }}
98+
- name: Test Django 1.11
99+
if: matrix.django_version == '1.11'
100+
run: |
101+
python -m coverage run ./quicktest.py leaflet --db=${{ matrix.database }}
102+
- name: Coverage
103+
if: ${{ success() }}
104+
run: |
105+
coveralls
106+
107+
tests_node:
108+
runs-on: ubuntu-latest
109+
steps:
110+
- uses: actions/checkout@v2
111+
- name: Use Node.js
112+
uses: actions/setup-node@v1
113+
with:
114+
node-version: 8.12.0
115+
- name: Install dependencies
116+
run: |
117+
npm install leaflet/tests/
118+
- name: Test node
119+
run: |
120+
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)