Skip to content

Commit 0c3e75c

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 b9bb5a9 commit 0c3e75c

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:
@@ -127,3 +129,71 @@ 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+
# Disabled until we get pytest-dev account maintainer on test.pypi.org
177+
# - name: Publish to test.pypi.org
178+
# if: >-
179+
# (
180+
# github.event_name == 'push' &&
181+
# github.ref == format(
182+
# 'refs/heads/{0}', github.event.repository.default_branch
183+
# )
184+
# ) ||
185+
# (
186+
# github.event_name == 'create' &&
187+
# github.event.ref_type == 'tag'
188+
# )
189+
# uses: pypa/gh-action-pypi-publish@master
190+
# with:
191+
# password: ${{ secrets.testpypi_password }}
192+
# repository_url: https://test.pypi.org/legacy/
193+
- name: Publish to pypi.org
194+
if: >- # "create" workflows run separately from "push" & "pull_request"
195+
github.event_name == 'create' &&
196+
github.event.ref_type == 'tag'
197+
uses: pypa/gh-action-pypi-publish@master
198+
with:
199+
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)