Skip to content

Commit

Permalink
Merge pull request #26 from jazzband/github-actions
Browse files Browse the repository at this point in the history
Migrate from Travis-CI to GitHub Actions
  • Loading branch information
jezdez authored Nov 30, 2020
2 parents 603052b + 3494750 commit 5f8498c
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 46 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 47 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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 }}
33 changes: 0 additions & 33 deletions .travis.yml

This file was deleted.

21 changes: 10 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 changes: 12 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 5f8498c

Please sign in to comment.