diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f905a1c --- /dev/null +++ b/.github/workflows/release.yml @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..a02eaf0 --- /dev/null +++ b/.github/workflows/test.yml @@ -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 }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a74b060..0000000 --- a/.travis.yml +++ /dev/null @@ -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 diff --git a/README.rst b/README.rst index 7fe170f..84f25c5 100644 --- a/README.rst +++ b/README.rst @@ -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 `_ 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 diff --git a/tox.ini b/tox.ini index 5d2589a..d682619 100644 --- a/tox.ini +++ b/tox.ini @@ -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