Skip to content

Commit 4ea60b0

Browse files
authored
Merge pull request #67 from graingert/github-actions
2 parents 095a134 + 654a485 commit 4ea60b0

File tree

4 files changed

+109
-45
lines changed

4 files changed

+109
-45
lines changed

.github/workflows/main.yaml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- master
6+
tags:
7+
- v*
8+
pull_request:
9+
10+
jobs:
11+
tox:
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
python-version: [3.7, 3.8, 3.9, '3.10']
17+
os: [macOS-latest, ubuntu-latest, windows-latest]
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v2
22+
23+
- name: Set Up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v2
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
28+
- name: Get pip cache dir
29+
id: pip-cache
30+
run: |
31+
echo "::set-output name=dir::$(pip cache dir)"
32+
33+
- name: pip cache
34+
uses: actions/cache@v2
35+
with:
36+
path: ${{ steps.pip-cache.outputs.dir }}
37+
key:
38+
${{ runner.os }}-pip-${{ hashFiles('pyproject.toml', 'setup.py',
39+
'setup.cfg') }}
40+
restore-keys: |
41+
${{ runner.os }}-pip-
42+
43+
- name: Install
44+
run: |
45+
pip install tox
46+
47+
- name: tox
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
run: tox -e py,release
51+
52+
- name: upload dist
53+
uses: actions/upload-artifact@v2
54+
with:
55+
name: ${{ matrix.os }}_${{ matrix.python-version}}_dist
56+
path: dist
57+
58+
all-successful:
59+
# https://github.community/t/is-it-possible-to-require-all-github-actions-tasks-to-pass-without-enumerating-them/117957/4?u=graingert
60+
runs-on: ubuntu-latest
61+
needs: [tox]
62+
steps:
63+
- name: Download dists for PyPI
64+
uses: actions/download-artifact@v2
65+
with:
66+
name: ubuntu-latest_3.10_dist
67+
path: dist
68+
69+
- name: Display structure of donwloaded files
70+
run: ls -R
71+
72+
- name: Publish package
73+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
74+
uses: pypa/gh-action-pypi-publish@master
75+
with:
76+
user: __token__
77+
password: ${{ secrets.pypi_password }}
78+
79+
- name: note that all tests succeeded
80+
run: echo "🎉"

.github/workflows/main.yml

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

setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
description="Easily test your HTTP library against a local copy of httpbin",
2424
long_description=long_description,
25+
long_description_content_type="text/x-rst",
2526

2627
# The project URL.
2728
url='https://github.com/kevin1024/pytest-httpbin',
@@ -53,6 +54,7 @@
5354
packages=find_packages(exclude=["contrib", "docs", "tests*"]),
5455
include_package_data = True, # include files listed in MANIFEST.in
5556
install_requires = ['httpbin','six'],
57+
extras_require = {"test": ["requests", "pytest"]},
5658

5759
# the following makes a plugin available to pytest
5860
entry_points = {

tox.ini

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,32 @@
11
# content of: tox.ini , put in same dir as setup.py
22

33
[tox]
4-
envlist = py26, py27, py33, py34, py35, py36, pypy, pypy3
4+
minversion=3.24.5
5+
requires=
6+
virtualenv>=20.13.2
7+
tox-wheel>=0.7.0
8+
tox-gh-actions>=2.9.1
9+
envlist = py37, py38, py39, py310, pypy3
510

611
[testenv]
7-
deps = pytest
8-
requests
9-
py26: httpbin==0.5.0
10-
py27: ipaddress
11-
py35: ipaddress
12-
py36: ipaddress
13-
pypy: ipaddress
14-
commands = ./runtests.sh {posargs:tests/}
12+
wheel = True
13+
wheel_build_env = build
14+
extras = test
15+
commands = pytest -v -s
16+
17+
[testenv:build]
18+
# empty environment to build universal wheel once per tox invocation
19+
# https://github.com/ionelmc/tox-wheel#build-configuration
20+
21+
[testenv:release]
22+
deps =
23+
build
24+
twine
25+
whitelist_externals =
26+
cp
27+
rm
28+
commands =
29+
rm -rf {toxinidir}/dist
30+
cp -r {distdir} {toxinidir}/dist # copy the wheel built by tox-wheel
31+
{envpython} -m build --sdist
32+
twine check {toxinidir}/dist/*.*

0 commit comments

Comments
 (0)