Switch to GH actions (#361)

* Switch to GH actions

Removes the travis config and adds a GH actions config. Resolves #360.

As part of this:

- only runs the README check once, instead of for each python version
- only runs mypy once, removing it from tox
- unifies the pypy and cpython tests in tox by separating dev and test
  requirements, and only installing the latter for running tests in tox

* Update README w/badge & link to GH actions tests
This commit is contained in:
Matthew Planchard 2020-11-15 20:08:58 -06:00 committed by GitHub
parent 4b1bd1c9db
commit d0694d9e15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 112 additions and 64 deletions

91
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,91 @@
# Run tests
name: Test
on:
push:
# standalone is an old branch containing a fully functional pypiserver
# executable, from back in the day before docker & a better pip.
branches-ignore:
- standalone
pull_request: {}
jobs:
test-cpython:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9"]
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: pip install tox
- name: Run tests
# Create a tox env specification by stripping the dot out of the version
# specification and appending it to "py"
run: |
tox -e "py$(echo ${{ matrix.python-version }} | tr -d .)"
test-pypy:
# Run a a separate job so we don't need to mess with conditionally
# splitting the python version from the build matrix.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: pypy3
- name: Install dependencies
run: pip install tox
- name: Run tests
run: tox -e pypy3
check:
# These checks only need to be done once, not for every python version we s
# upport
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
# Pretty much any python version will do
python-version: "3.9"
- name: Install dependencies
run: pip install -r "requirements/dev.pip"
- name: Check types
# individual mypy files for now, until we get the rest
# of the project typechecking
run: |
mypy \
pypiserver/config.py \
tests/test_init.py
- name: Check formatting
run: black --diff --check .
- name: Validate README
run: ./bin/check_readme.sh
# Full-flow docker tests, again not python version dependent
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
# Pretty much any python version will do
python-version: "3.9"
- name: Install dependencies
run: pip install --use-feature 2020-resolver -U twine
- name: Run tests
run: ./bin/test-docker.sh

View File

@ -1,33 +0,0 @@
sudo: required
language: python
services: docker
python:
- 3.6
- 3.7
- 3.8
- 3.9
- pypy3
install:
- pip install -U pip
- pip install --use-feature=2020-resolver -U setuptools twine sphinx tox tox-travis
script:
- tox
- ./bin/check_readme.sh
branches:
except:
- standalone
jobs:
include:
- python: 3.9
install: pip install -U black
script: black --check .
- python: 3.9
install:
- pip install -U pip
- pip install --use-feature 2020-resolver -U twine
script: ./bin/test-docker.sh

View File

@ -7,13 +7,13 @@
==============================================================================
pypiserver - minimal PyPI server for use with pip/easy_install
==============================================================================
|pypi-ver| |travis-status| |dependencies| |python-ver| |proj-license|
|pypi-ver| |test-status| |dependencies| |python-ver| |proj-license|
:Version: 2.0.0dev1
:Date: 2020-10-10
:Source: https://github.com/pypiserver/pypiserver
:PyPI: https://pypi.org/project/pypiserver/
:Travis: https://travis-ci.org/pypiserver/pypiserver
:Tests: https://github.com/pypiserver/pypiserver/actions
:Maintainers: Kostis Anagnostopoulos <ankostis@gmail.com>,
Matthew Planchard <mplanchard@gmail.com>
:License: zlib/libpng + MIT
@ -983,10 +983,10 @@ See the ``LICENSE.txt`` file.
.. _twine: https://pypi.org/project/twine/
.. _pypi-uploader: https://pypi.org/project/pypi-uploader/
.. _python-pam: https://pypi.org/project/python-pam/
.. |travis-status| image:: https://travis-ci.org/pypiserver/pypiserver.svg
:alt: Travis build status
.. |test-status| image:: https://github.com/pypiserver/pypiserver/workflows/Test/badge.svg
:alt: test status
:scale: 100%
:target: https://travis-ci.org/pypiserver/pypiserver
:target: https://github.com/pypiserver/pypiserver/actions?query=workflow%3ATest
.. |pypi-ver| image:: https://img.shields.io/pypi/v/pypiserver.svg
:target: https://pypi.org/project/pypiserver/

View File

@ -4,17 +4,8 @@
# pip install -r requirements/dev.pip
-r exe.pip
-r test.pip
black
docopt # For `/bin/bumpver.py`.
gevent>=1.1b4; python_version >= '3'
mypy; implementation_name == 'cpython'
pip>=7
passlib>=1.6
pytest>=2.3
pytest-cov
setuptools
setuptools-git>=0.3
tox
twine
webtest
wheel>=0.25.0

13
requirements/test.pip Normal file
View File

@ -0,0 +1,13 @@
# Just the absolutely necessary extra requirements for
# running tests
gevent>=1.1b4; python_version >= '3'
pip>=7
passlib>=1.6
pytest>=2.3
pytest-cov
setuptools
tox
twine
webtest
wheel>=0.25.0

16
tox.ini
View File

@ -2,26 +2,12 @@
envlist = py36, py37, py38, py39, pypy3
[testenv]
deps=-r{toxinidir}/requirements/dev.pip
deps=-r{toxinidir}/requirements/test.pip
allowlist_externals=
/bin/sh
mypy
sitepackages=False
[testenv:py{36,37,38,39}]
commands=
/bin/sh -c "{env:PYPISERVER_SETUP_CMD:true}"
# individual mypy files for now, until we get the rest
# of the project typechecking
mypy \
pypiserver/config.py \
tests/test_init.py
pytest --cov=pypiserver {posargs}
[testenv:pypy3]
commands=
/bin/sh -c "{env:PYPISERVER_SETUP_CMD:true}"
# no mypy in pypy
pytest --cov=pypiserver {posargs}