Move release from travis to github actions (#360)

- create packaging environment that produces deliverables
- removes travis integration
- configures github actions to call packaging after all the other
  tests are passing and to make a release if tag is present
- test.pypi.org is kept commented until we sort credentials for it
- no credentials are needed as they are already configured in github
This commit is contained in:
Sorin Sbarnea 2020-11-03 07:47:23 +00:00 committed by GitHub
parent d971d0065d
commit ca5ddbc208
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 107 additions and 81 deletions

View File

@ -12,6 +12,8 @@ on:
- >-
**
pull_request:
schedule:
- cron: 1 0 * * * # Run daily at 0:01 UTC
jobs:
build_python:
@ -127,3 +129,70 @@ jobs:
grunt test
env:
CI: true
publish:
name: Publish to PyPI registry
needs:
- build_python
- build_javascript
runs-on: ubuntu-latest
env:
PY_COLORS: 1
TOXENV: packaging
steps:
- name: Switch to using Python 3.6 by default
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install tox
run: python -m pip install --user tox
- name: Check out src from Git
uses: actions/checkout@v2
with:
# Get shallow Git history (default) for tag creation events
# but have a complete clone for any other workflows.
# Both options fetch tags but since we're going to remove
# one from HEAD in non-create-tag workflows, we need full
# history for them.
fetch-depth: >-
${{
(
github.event_name == 'create' &&
github.event.ref_type == 'tag'
) &&
1 || 0
}}
- name: Drop Git tags from HEAD for non-tag-create events
if: >-
github.event_name != 'create' ||
github.event.ref_type != 'tag'
run: >-
git tag --points-at HEAD
|
xargs git tag --delete
- name: Build dists
run: python -m tox
- name: Publish to test.pypi.org
if: >-
(
github.event_name == 'push' &&
github.ref == format(
'refs/heads/{0}', github.event.repository.default_branch
)
) ||
(
github.event_name == 'create' &&
github.event.ref_type == 'tag'
)
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.testpypi_password }}
repository_url: https://test.pypi.org/legacy/
- name: Publish to pypi.org
if: >- # "create" workflows run separately from "push" & "pull_request"
github.event_name == 'create' &&
github.event.ref_type == 'tag'
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.pypi_password }}

View File

@ -1,69 +0,0 @@
language: python
jobs:
allow_failures:
- name: devel
python: 3.8
dist: xenial
env: TOXENV=devel
include:
- stage: tests
language: node_js
node_js: node
install: npm install phantomjs-prebuilt@2.1.15 grunt-cli grunt grunt-contrib-qunit
script: grunt test
-
name: Linting
python: 3.7
dist: xenial
sudo: required
env: TOXENV=linting
cache:
directories:
- $HOME/.cache/pre-commit
-
python: 3.6
env: TOXENV=py36
-
python: 3.7
dist: xenial
sudo: required
env: TOXENV=py37
-
python: 3.8
env: TOXENV=py38
- name: devel
python: 3.8
dist: xenial
env: TOXENV=devel
-
python: pypy3
env: TOXENV=pypy3
- stage: deploy
python: 3.7
dist: xenial
sudo: required
install: skip
script: skip
deploy:
provider: pypi
user: davehunt
password:
secure: QTNaSfTEZnCEINpCfzdOiOPZ1s6co9Fz2cEt5zv/dSZAJCiKNZvvbMzsOsRMQl1MJvp+cSHiuOir46vEGxzh2+FIl+RRSlENqF2G7jGJpfJfukBxYAhSvt9ZLT4UyBbgYz5sv9A4zs+Yo72xAS9eP+zf5bDVaQh0EzudUbb0Mv4=
distributions: sdist bdist_wheel
on:
tags: true
repo: pytest-dev/pytest-html
cache: pip
install: pip install tox
script: tox

View File

@ -13,9 +13,9 @@ HTML report for the test results.
.. image:: https://img.shields.io/conda/vn/conda-forge/pytest-html.svg
:target: https://anaconda.org/conda-forge/pytest-html
:alt: Conda Forge
.. image:: https://img.shields.io/travis/pytest-dev/pytest-html.svg
:target: https://travis-ci.org/pytest-dev/pytest-html/
:alt: Travis
.. image:: https://github.com/pytest-dev/pytest-html/workflows/gh/badge.svg
:target: https://github.com/pytest-dev/pytest-html/actions
:alt: CI
.. image:: https://img.shields.io/github/issues-raw/pytest-dev/pytest-html.svg
:target: https://github.com/pytest-dev/pytest-html/issues
:alt: Issues

View File

@ -23,15 +23,12 @@ If you're not using `Pipenv`_, to install `pre-commit`, run:
Automated Testing
-----------------
All pull requests and merges are tested in `Travis CI <https://travis-ci.org/>`_
based on the ``.travis.yml`` file.
All pull requests and merges are tested in `GitHub Actions <https://github.com/pytest-dev/pytest-html/actions>`_
which are defined inside ``.github`` folder.
Usually, a link to your specific travis build appears in pull requests, but if
not, you can find it on the
`pull requests page <https://travis-ci.org/pytest-dev/pytest-html/pull_requests>`_
The only way to trigger Travis CI to run again for a pull request, is to submit
another change to the pull branch.
To retrigger CI to run again for a pull request, you either use dropdown
option, close and reopen pull-request or to just update the branch containing
it.
You can do this with `git commit --allow-empty`
@ -67,6 +64,6 @@ Follow these steps to release a new version of the project:
5. Once merged, update your local master again (``git pull --rebase upstream master``)
6. Tag the release with the new release version (``git tag v<new tag>``)
7. Push the tag (``git push upstream --tags``)
8. Done. You can monitor the progress on `Travis <https://travis-ci.org/pytest-dev/pytest-html/>`_
8. Done. Check `CI <https://github.com/pytest-dev/pytest-html/actions>`_ for release progress.
.. _Pipenv: https://pipenv.pypa.io/en/latest/

29
tox.ini
View File

@ -34,6 +34,35 @@ deps =
# https://github.com/pytest-dev/pytest-rerunfailures/issues/134
# pytest @ git+https://github.com/pytest-dev/pytest.git
[testenv:packaging]
description =
Do packaging/distribution. If tag is not present or PEP440 compliant upload to
PYPI could fail
# `usedevelop = true` overrides `skip_install` instruction, it's unwanted
usedevelop = false
# don't install package in this env
skip_install = true
deps =
collective.checkdocs >= 0.2
pep517 >= 0.8.2
pip >= 20.2.2
toml >= 0.10.1
twine >= 3.2.0
setenv =
commands =
rm -rfv {toxinidir}/dist/
python -m pep517.build \
--source \
--binary \
--out-dir {toxinidir}/dist/ \
{toxinidir}
# metadata validation
python setup.py check
sh -c "python -m twine check {toxinidir}/dist/*"
whitelist_externals =
rm
sh
[flake8]
max-line-length = 88
exclude = .eggs,.tox