Skip to content

Commit

Permalink
Merge 66becc7 into 0817852
Browse files Browse the repository at this point in the history
  • Loading branch information
hancush committed Mar 18, 2021
2 parents 0817852 + 66becc7 commit 3855fd9
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 4 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Test and build Python package

on:
push:
branches: [ master ]
tags:
- v*
pull_request:
branches: [ master ]

jobs:
test:
runs-on: ubuntu-18.04
services:
postgres:
image: postgis/postgis:10-2.5
env:
POSTGRES_USER: test
POSTGRES_DB: test
POSTGRES_PASSWORD: test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
strategy:
matrix:
python-version: ['3.6', '3.7', '3.8']
django-series: ['2.2', '3.0']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y gdal-bin
pip install .[dev] --pre Django==${{ matrix.django-series }}
pip install -e git+https://github.com/opencivicdata/python-opencivicdata.git#egg=opencivicdata
- name: Lint with flake8
run: |
flake8 pupa
- name: Test with pytest
run: |
./run-tests.sh
- name: Calculate test coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
coveralls
build:
needs: test
name: Build package and upload to PyPI
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Build and publish
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
pip install twine wheel
pip wheel -w dist --no-deps .
python setup.py sdist
twine upload dist/*
continue-on-error: true
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,3 @@ script:
- flake8 pupa
after_success:
- coveralls
notifications:
email:
- james@openstates.org
1 change: 1 addition & 0 deletions pupa/tests/django_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
'USER': 'test',
'PASSWORD': 'test',
'HOST': 'localhost',
'PORT': 5432,
}
}
MIDDLEWARE_CLASSES = ()
3 changes: 2 additions & 1 deletion run-tests.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/bin/sh
export PYTHONPATH=.; pytest --cov pupa --cov-report html --ds=pupa.tests.django_settings
export PYTHONPATH=.
pytest --cov pupa --cov-report html --ds=pupa.tests.django_settings pupa/tests

0 comments on commit 3855fd9

Please sign in to comment.