Skip to content

Move release from travis to github actions #360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ on:
- >-
**
pull_request:
schedule:
- cron: 1 0 * * * # Run daily at 0:01 UTC

jobs:
build_python:
Expand Down Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why we're using 3.6 and not a newer version @ssbarnea @gnikonorov ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure Sorin wanted to support the oldest possible version that the devs/contributors may use.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, use of oldest supported is usually better than newest in order to avoid regressions. Based on experience using oldest proved to catch more issues than the newest, especially in this area.

Any CI failure that prevents a bad release is better than making a user unhappy. Note to myself: add comments on action tasks like this documenting their purpose.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ssbarnea! Makes sense. 👍

- 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 }}
69 changes: 0 additions & 69 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 6 additions & 9 deletions development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: 'inside the .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`

Expand Down Expand Up @@ -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 changes: 29 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down