Merge pull request #26 from jazzband/github-actions

Migrate from Travis-CI to GitHub Actions
This commit is contained in:
Jannis Leidel 2020-11-30 12:51:12 +01:00 committed by GitHub
commit 5f8498c19f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 122 additions and 46 deletions

53
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,53 @@
name: Release
on:
push:
tags:
- '*'
jobs:
build:
if: github.repository == 'jazzband/contextlib2'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: release-${{ hashFiles('**/tox.ini') }}
restore-keys: |
release-
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U setuptools twine wheel
- name: Build package
run: |
python setup.py --version
python setup.py sdist --format=gztar bdist_wheel
twine check dist/*
- name: Upload packages to Jazzband
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: jazzband
password: ${{ secrets.JAZZBAND_RELEASE_KEY }}
repository_url: https://jazzband.co/projects/contextlib2/upload

47
.github/workflows/test.yml vendored Normal file
View file

@ -0,0 +1,47 @@
name: Test
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 5
matrix:
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 'pypy2', 'pypy3']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key:
${{ matrix.os }}-${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ matrix.os }}-${{ matrix.python-version }}-v1-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade tox tox-gh-actions
- name: Tox tests
run: |
tox -v
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
name: Python ${{ matrix.python-version }}

View file

@ -1,33 +0,0 @@
language: python
matrix:
include:
- python: 2.7
env: TOXENV=py27
- python: 3.4
env: TOXENV=py34
- python: 3.5
env: TOXENV=py35
- python: 3.6
env: TOXENV=py36
- python: 3.7
env: TOXENV=py37
dist: xenial # required for Python >= 3.7
- python: pypy
env: TOXENV=pypy
- python: pypy3
env: TOXENV=pypy3
install: pip install tox coveralls && tox --notest
script: tox
after_success: coveralls
deploy:
provider: pypi
user: jazzband
server: https://jazzband.co/projects/contextlib2/upload
distributions: sdist bdist_wheel
password:
secure: lmCsNEmxcYTcdDz1ZdoegDvZxIRFBsjoQoT5O1t9GsYKzEMebPxEMZKRIxWXLIu1HKXSSAnb6foDvK+v61VK1PiGBfn2KMeOr1y7G+gm2sOSXRiWtvnzz7LTWTW6cHdwOz6Un3FNxhTRqrQ4Jz9Nsik0YuA+MOn8bhWvTAxY5iIYRuDoyNpUDBwMOTQchfpjJhID0Zhuvk1gTX5Jrp425FPhTvGgUEefBh48PFN/1qBFmV45X5Y0bZEcd8lRGXxrUFej2Pk54sSVurhIAJLmWE9S9VsnBeRZMCB04jWBSGNrrUF11LK2EtzZ701liZzET6NLztLc9ZXdrpSWWQ07W0QinHo4v1PNA7b5JHEhhqEIHlE/XBDSqQrKWbonBlNXp9YXMtTfF5OFPmc2V33ad1WMnqvo0w76twRigGWQsKwWrtJUG0SrSybQg8YxsyH9DfVhUwQ56WhaBZSL8vTN4L8v+rmv2yyAkgmx6GicCF5lDqZs3NpRrK5jWrZSu6prfkfoZhfLz29em75t6JP8d1Q1a9JqFQJTGCe78cDuOj+KAlcIz43G59iGyE63nBJ7VlezUE2XouQs3G2Uf0+bx8YIH43uMbiNb9ITghqPFJEOjcKcv0B3VSUhaV91co+D5NL0AZ9E4dF5jCTrNmt0X20EVOucpm/KWruujXEoCSY=
on:
tags: true
repo: jazzband/contextlib2
condition: "$TOXENV = py35" # only release once per test run for a Git tag

View file

@ -2,19 +2,18 @@
:target: https://jazzband.co/
:alt: Jazzband
.. image:: https://github.com/jazzband/contextlib2/workflows/Test/badge.svg
:target: https://github.com/jazzband/contextlib2/actions
:alt: Tests
.. image:: https://codecov.io/gh/jazzband/contextlib2/branch/master/graph/badge.svg
:target: https://codecov.io/gh/jazzband/contextlib2
:alt: Coverage
.. image:: https://readthedocs.org/projects/contextlib2/badge/?version=latest
:target: https://contextlib2.readthedocs.org/
:alt: Latest Docs
.. image:: https://img.shields.io/travis/jazzband/contextlib2/master.svg
:target: http://travis-ci.org/jazzband/contextlib2
.. image:: https://coveralls.io/repos/github/jazzband/contextlib2/badge.svg?branch=master
:target: https://coveralls.io/github/jazzband/contextlib2?branch=master
.. image:: https://landscape.io/github/jazzband/contextlib2/master/landscape.svg
:target: https://landscape.io/github/jazzband/contextlib2/
contextlib2 is a backport of the `standard library's contextlib
module <https://docs.python.org/3.5/library/contextlib.html>`_ to
earlier Python versions.
@ -37,12 +36,12 @@ You can test against multiple versions of Python with
pip install tox
tox
Versions currently tested in both tox and Travis CI are:
Versions currently tested in both tox and GitHub Actions are:
* CPython 2.7
* CPython 3.4
* CPython 3.5
* CPython 3.6
* CPython 3.7
* CPython 3.8
* PyPy
* PyPy3

14
tox.ini
View file

@ -1,13 +1,23 @@
[tox]
envlist = py{27,34,35,36,37,py,py3}
envlist = py{27,35,36,37,py,py3}
skip_missing_interpreters = True
[testenv]
commands =
coverage erase
coverage run test_contextlib2.py
coverage report
coverage xml
deps =
coverage
py27: unittest2
pypy: unittest2
[gh-actions]
python =
2.7: py27
3.5: py35
3.6: py36
3.7: py37
3.8: py38
pypy2: pypy
pypy3: pypy3