Skip to content

Commit

Permalink
Merge pull request opencivicdata#140 from opencivicdata/hcg/gh-actions
Browse files Browse the repository at this point in the history
Migrate from Travis to GH Actions
  • Loading branch information
hancush authored Aug 12, 2021
2 parents 7862be4 + d30bb7f commit 488b8d6
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 26 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.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 -U setuptools six
pip install .[dev] --pre Django==${{ matrix.django-series }}
- name: Lint with flake8
run: |
flake8
- name: Test with pytest
run: |
./run-tests.sh
- name: Calculate test coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
coveralls --service=github
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
26 changes: 0 additions & 26 deletions .travis.yml

This file was deleted.

0 comments on commit 488b8d6

Please sign in to comment.