Skip to content

Commit 3ec4e35

Browse files
committed
Refreshed tox and CI config
1 parent e8ad492 commit 3ec4e35

File tree

3 files changed

+148
-42
lines changed

3 files changed

+148
-42
lines changed

.github/workflows/tox.yml

Lines changed: 130 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,142 @@
1-
name: Python package
1+
name: tox
22

3-
on: [push]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- "[0-9]+.[0-9]+.x"
8+
tags:
9+
- "*"
410

5-
jobs:
6-
7-
linters:
8-
9-
runs-on: ubuntu-latest
10-
steps:
11-
- uses: actions/checkout@v2
12-
- name: Setup Python
13-
uses: actions/setup-python@v1
14-
with:
15-
python-version: 3.6
16-
- name: Install Tox and any other packages
17-
run: pip install tox
18-
- name: Run Tox
19-
run: tox -e linters
11+
pull_request:
12+
branches:
13+
- master
14+
- "[0-9]+.[0-9]+.x"
2015

16+
jobs:
2117
build:
18+
name: ${{ matrix.name }}
19+
runs-on: ${{ matrix.os }}
2220

23-
runs-on: ubuntu-latest
2421
strategy:
22+
fail-fast: false
2523
matrix:
26-
python: [3.6, 3.7, 3.8]
24+
name: [
25+
# "docs",
26+
"py36",
27+
"py37",
28+
"py38",
29+
"linters",
30+
"packaging",
31+
]
32+
os: [
33+
"ubuntu-latest",
34+
]
35+
36+
include:
37+
38+
# - name: docs
39+
# python: "3.6"
40+
# os: ubuntu-latest
41+
# tox_env: docs
42+
- name: py36
43+
python: "3.6"
44+
os: ubuntu-latest
45+
tox_env: py36
46+
- name: py37
47+
python: "3.7"
48+
os: ubuntu-latest
49+
tox_env: py37
50+
- name: py38
51+
python: "3.8"
52+
os: ubuntu-latest
53+
tox_env: py38
54+
55+
- name: "linters"
56+
python: "3.7"
57+
os: ubuntu-latest
58+
tox_env: "linters"
59+
- name: "packaging"
60+
python: "3.7"
61+
os: ubuntu-latest
62+
tox_env: "packaging"
2763

2864
steps:
29-
- uses: actions/checkout@v2
30-
- name: Setup Python
65+
- uses: actions/checkout@v1
66+
- name: Set up Python ${{ matrix.python }}
3167
uses: actions/setup-python@v1
3268
with:
3369
python-version: ${{ matrix.python }}
34-
- name: Install Tox and any other packages
35-
run: pip install tox
36-
- name: Run Tox
37-
run: tox -e py # Run tox using the version of Python in `PATH`
70+
- name: Install dependencies
71+
run: |
72+
python -m pip install --upgrade pip
73+
pip install tox
74+
- name: Test
75+
run: "tox -e ${{ matrix.tox_env }}"
76+
77+
publish:
78+
name: Publish to PyPI registry
79+
needs:
80+
- build
81+
runs-on: ubuntu-latest
82+
83+
env:
84+
PY_COLORS: 1
85+
TOXENV: packaging
86+
87+
steps:
88+
- name: Switch to using Python 3.6 by default
89+
uses: actions/setup-python@v2
90+
with:
91+
python-version: 3.6
92+
- name: Install tox
93+
run: python -m pip install --user tox
94+
- name: Check out src from Git
95+
uses: actions/checkout@v2
96+
with:
97+
# Get shallow Git history (default) for tag creation events
98+
# but have a complete clone for any other workflows.
99+
# Both options fetch tags but since we're going to remove
100+
# one from HEAD in non-create-tag workflows, we need full
101+
# history for them.
102+
fetch-depth: >-
103+
${{
104+
(
105+
github.event_name == 'create' &&
106+
github.event.ref_type == 'tag'
107+
) &&
108+
1 || 0
109+
}}
110+
- name: Drop Git tags from HEAD for non-tag-create events
111+
if: >-
112+
github.event_name != 'create' ||
113+
github.event.ref_type != 'tag'
114+
run: >-
115+
git tag --points-at HEAD
116+
|
117+
xargs git tag --delete
118+
- name: Build dists
119+
run: python -m tox
120+
- name: Publish to test.pypi.org
121+
if: >-
122+
(
123+
github.event_name == 'push' &&
124+
github.ref == format(
125+
'refs/heads/{0}', github.event.repository.default_branch
126+
)
127+
) ||
128+
(
129+
github.event_name == 'create' &&
130+
github.event.ref_type == 'tag'
131+
)
132+
uses: pypa/gh-action-pypi-publish@master
133+
with:
134+
password: ${{ secrets.testpypi_password }}
135+
repository_url: https://test.pypi.org/legacy/
136+
- name: Publish to pypi.org
137+
if: >- # "create" workflows run separately from "push" & "pull_request"
138+
github.event_name == 'create' &&
139+
github.event.ref_type == 'tag'
140+
uses: pypa/gh-action-pypi-publish@master
141+
with:
142+
password: ${{ secrets.pypi_password }}

mypy.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ ignore_missing_imports = True
1919

2020
[mypy-github3]
2121
ignore_missing_imports = True
22+
23+
[mypy-setuptools]
24+
ignore_missing_imports = True

tox.ini

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = linters,py{36,37,38}
2+
envlist = linters,py{36,37,38},packaging
33
minversion = 3.7
44
isolated_build = true
55
skip_missing_interpreters = true
@@ -21,41 +21,39 @@ passenv =
2121
no_proxy
2222
deps =
2323
pip == 19.1.1
24+
extra =
25+
test
2426
whitelist_externals = bash
2527
commands =
2628
python -m tender
2729

2830
[testenv:linters]
29-
basepython = python3.7
3031
passenv = {[testenv]passenv}
3132
# without PROGRAMDATA cloning using git for Windows will fail with an
3233
# `error setting certificate verify locations` error
3334
PROGRAMDATA
34-
extras = lint
35-
deps =
36-
pre-commit >= 1.14.4, < 2
37-
twine
38-
readme-renderer[md] >= 24.0
39-
pip >= 18.0.0
40-
pep517
35+
deps = pre-commit >= 2.6.0
4136
# `usedevelop = true` overrides `skip_install` instruction, it's unwanted
4237
usedevelop = false
4338
# don't install molecule itself in this env
4439
skip_install = true
4540
commands =
4641
python -m pre_commit run --all-files --show-diff-on-failure
42+
43+
[testenv:packaging]
44+
description = Builds the packages
45+
skip_install = true
46+
deps =
47+
twine >= 3.2.0
48+
readme-renderer[md] >= 24.0
49+
pip >= 18.0.0
50+
pep517
51+
commands =
4752
bash -c "rm -rf {toxinidir}/dist/ && mkdir -p {toxinidir}/dist/"
4853
python -m pep517.build \
4954
--source \
5055
--binary \
5156
--out-dir {toxinidir}/dist/ \
5257
{toxinidir}
5358
twine check dist/*
54-
55-
[testenv:upload]
56-
description = Builds the packages and uploads them to https://pypi.org
57-
envdir={toxworkdir}/linters
58-
deps={[testenv:linters]deps}
59-
commands =
60-
{[testenv:linters]commands}
61-
twine upload --disable-progress-bar --skip-existing --verbose dist/*
59+
# twine upload --disable-progress-bar --skip-existing --verbose dist/*

0 commit comments

Comments
 (0)