Skip to content

Commit 45ac7e6

Browse files
committed
Move release from travis to github actions
- 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
1 parent d971d00 commit 45ac7e6

File tree

5 files changed

+107
-81
lines changed

5 files changed

+107
-81
lines changed

.github/workflows/actions.yml

+69
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ on:
1212
- >-
1313
**
1414
pull_request:
15+
schedule:
16+
- cron: 1 0 * * * # Run daily at 0:01 UTC
1517

1618
jobs:
1719
build_python:
@@ -127,3 +129,70 @@ jobs:
127129
grunt test
128130
env:
129131
CI: true
132+
publish:
133+
name: Publish to PyPI registry
134+
needs:
135+
- build_python
136+
- build_javascript
137+
runs-on: ubuntu-latest
138+
139+
env:
140+
PY_COLORS: 1
141+
TOXENV: packaging
142+
143+
steps:
144+
- name: Switch to using Python 3.6 by default
145+
uses: actions/setup-python@v2
146+
with:
147+
python-version: 3.6
148+
- name: Install tox
149+
run: python -m pip install --user tox
150+
- name: Check out src from Git
151+
uses: actions/checkout@v2
152+
with:
153+
# Get shallow Git history (default) for tag creation events
154+
# but have a complete clone for any other workflows.
155+
# Both options fetch tags but since we're going to remove
156+
# one from HEAD in non-create-tag workflows, we need full
157+
# history for them.
158+
fetch-depth: >-
159+
${{
160+
(
161+
github.event_name == 'create' &&
162+
github.event.ref_type == 'tag'
163+
) &&
164+
1 || 0
165+
}}
166+
- name: Drop Git tags from HEAD for non-tag-create events
167+
if: >-
168+
github.event_name != 'create' ||
169+
github.event.ref_type != 'tag'
170+
run: >-
171+
git tag --points-at HEAD
172+
|
173+
xargs git tag --delete
174+
- name: Build dists
175+
run: python -m tox
176+
- name: Publish to test.pypi.org
177+
if: >-
178+
(
179+
github.event_name == 'push' &&
180+
github.ref == format(
181+
'refs/heads/{0}', github.event.repository.default_branch
182+
)
183+
) ||
184+
(
185+
github.event_name == 'create' &&
186+
github.event.ref_type == 'tag'
187+
)
188+
uses: pypa/gh-action-pypi-publish@master
189+
with:
190+
password: ${{ secrets.testpypi_password }}
191+
repository_url: https://test.pypi.org/legacy/
192+
- name: Publish to pypi.org
193+
if: >- # "create" workflows run separately from "push" & "pull_request"
194+
github.event_name == 'create' &&
195+
github.event.ref_type == 'tag'
196+
uses: pypa/gh-action-pypi-publish@master
197+
with:
198+
password: ${{ secrets.pypi_password }}

.travis.yml

-69
This file was deleted.

README.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ HTML report for the test results.
1313
.. image:: https://img.shields.io/conda/vn/conda-forge/pytest-html.svg
1414
:target: https://anaconda.org/conda-forge/pytest-html
1515
:alt: Conda Forge
16-
.. image:: https://img.shields.io/travis/pytest-dev/pytest-html.svg
17-
:target: https://travis-ci.org/pytest-dev/pytest-html/
18-
:alt: Travis
16+
.. image:: https://github.com/pytest-dev/pytest-html/workflows/gh/badge.svg
17+
:target: https://github.com/pytest-dev/pytest-html/actions
18+
:alt: CI
1919
.. image:: https://img.shields.io/github/issues-raw/pytest-dev/pytest-html.svg
2020
:target: https://github.com/pytest-dev/pytest-html/issues
2121
:alt: Issues

development.rst

+6-9
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,12 @@ If you're not using `Pipenv`_, to install `pre-commit`, run:
2323
Automated Testing
2424
-----------------
2525

26-
All pull requests and merges are tested in `Travis CI <https://travis-ci.org/>`_
27-
based on the ``.travis.yml`` file.
26+
All pull requests and merges are tested in `GitHub Actions <https://github.com/pytest-dev/pytest-html/actions>`_
27+
which are defined inside ``.github`` folder.
2828

29-
Usually, a link to your specific travis build appears in pull requests, but if
30-
not, you can find it on the
31-
`pull requests page <https://travis-ci.org/pytest-dev/pytest-html/pull_requests>`_
32-
33-
The only way to trigger Travis CI to run again for a pull request, is to submit
34-
another change to the pull branch.
29+
To retrigger CI to run again for a pull request, you either use dropdown
30+
option, close and reopen pull-request or to just update the branch containing
31+
it.
3532

3633
You can do this with `git commit --allow-empty`
3734

@@ -67,6 +64,6 @@ Follow these steps to release a new version of the project:
6764
5. Once merged, update your local master again (``git pull --rebase upstream master``)
6865
6. Tag the release with the new release version (``git tag v<new tag>``)
6966
7. Push the tag (``git push upstream --tags``)
70-
8. Done. You can monitor the progress on `Travis <https://travis-ci.org/pytest-dev/pytest-html/>`_
67+
8. Done. Check `CI <https://github.com/pytest-dev/pytest-html/actions>`_ for release progress.
7168

7269
.. _Pipenv: https://pipenv.pypa.io/en/latest/

tox.ini

+29
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,35 @@ deps =
3434
# https://github.com/pytest-dev/pytest-rerunfailures/issues/134
3535
# pytest @ git+https://github.com/pytest-dev/pytest.git
3636

37+
[testenv:packaging]
38+
description =
39+
Do packaging/distribution. If tag is not present or PEP440 compliant upload to
40+
PYPI could fail
41+
# `usedevelop = true` overrides `skip_install` instruction, it's unwanted
42+
usedevelop = false
43+
# don't install package in this env
44+
skip_install = true
45+
deps =
46+
collective.checkdocs >= 0.2
47+
pep517 >= 0.8.2
48+
pip >= 20.2.2
49+
toml >= 0.10.1
50+
twine >= 3.2.0
51+
setenv =
52+
commands =
53+
rm -rfv {toxinidir}/dist/
54+
python -m pep517.build \
55+
--source \
56+
--binary \
57+
--out-dir {toxinidir}/dist/ \
58+
{toxinidir}
59+
# metadata validation
60+
python setup.py check
61+
sh -c "python -m twine check {toxinidir}/dist/*"
62+
whitelist_externals =
63+
rm
64+
sh
65+
3766
[flake8]
3867
max-line-length = 88
3968
exclude = .eggs,.tox

0 commit comments

Comments
 (0)