Skip to content

Commit 402d18e

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 b609a1d commit 402d18e

File tree

3 files changed

+98
-69
lines changed

3 files changed

+98
-69
lines changed

.github/workflows/actions.yml

Lines changed: 70 additions & 0 deletions
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:
@@ -63,3 +65,71 @@ jobs:
6365
grunt test
6466
env:
6567
CI: true
68+
publish:
69+
name: Publish to PyPI registry
70+
needs:
71+
- build_python
72+
- build_javascript
73+
runs-on: ubuntu-latest
74+
75+
env:
76+
PY_COLORS: 1
77+
TOXENV: packaging
78+
79+
steps:
80+
- name: Switch to using Python 3.6 by default
81+
uses: actions/setup-python@v2
82+
with:
83+
python-version: 3.6
84+
- name: Install tox
85+
run: python -m pip install --user tox
86+
- name: Check out src from Git
87+
uses: actions/checkout@v2
88+
with:
89+
# Get shallow Git history (default) for tag creation events
90+
# but have a complete clone for any other workflows.
91+
# Both options fetch tags but since we're going to remove
92+
# one from HEAD in non-create-tag workflows, we need full
93+
# history for them.
94+
fetch-depth: >-
95+
${{
96+
(
97+
github.event_name == 'create' &&
98+
github.event.ref_type == 'tag'
99+
) &&
100+
1 || 0
101+
}}
102+
- name: Drop Git tags from HEAD for non-tag-create events
103+
if: >-
104+
github.event_name != 'create' ||
105+
github.event.ref_type != 'tag'
106+
run: >-
107+
git tag --points-at HEAD
108+
|
109+
xargs git tag --delete
110+
- name: Build dists
111+
run: python -m tox
112+
# Disabled until we get pytest-dev account maintainer on test.pypi.org
113+
# - name: Publish to test.pypi.org
114+
# if: >-
115+
# (
116+
# github.event_name == 'push' &&
117+
# github.ref == format(
118+
# 'refs/heads/{0}', github.event.repository.default_branch
119+
# )
120+
# ) ||
121+
# (
122+
# github.event_name == 'create' &&
123+
# github.event.ref_type == 'tag'
124+
# )
125+
# uses: pypa/gh-action-pypi-publish@master
126+
# with:
127+
# password: ${{ secrets.testpypi_password }}
128+
# repository_url: https://test.pypi.org/legacy/
129+
- name: Publish to pypi.org
130+
if: >- # "create" workflows run separately from "push" & "pull_request"
131+
github.event_name == 'create' &&
132+
github.event.ref_type == 'tag'
133+
uses: pypa/gh-action-pypi-publish@master
134+
with:
135+
password: ${{ secrets.pypi_password }}

.travis.yml

Lines changed: 0 additions & 69 deletions
This file was deleted.

tox.ini

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,34 @@ 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+
sh -c "python -m twine check {toxinidir}/dist/*"
61+
whitelist_externals =
62+
rm
63+
sh
64+
3765
[flake8]
3866
max-line-length = 88
3967
exclude = .eggs,.tox

0 commit comments

Comments
 (0)