124 lines (115 loc) · 4.27 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: tests
on: [push, pull_request]
env:
PYTHONHASHSEED: 1042466059
ZOPE_INTERFACE_STRICT_IRO: 1
PYTHONUNBUFFERED: 1
PYTHONDONTWRITEBYTECODE: 1
PIP_UPGRADE_STRATEGY: eager
# Don't get warnings about Python 2 support being deprecated. We
# know. The env var works for pip 20.
PIP_NO_PYTHON_VERSION_WARNING: 1
PIP_NO_WARN_SCRIPT_LOCATION: 1
# Uploading built wheels for releases.
# TWINE_PASSWORD is encrypted and stored directly in the
# repo settings.
TWINE_USERNAME: __token__
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10.0-beta.1]
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('setup.*') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -U twine
- name: Install greenlet
run: |
python setup.py bdist_wheel
python -m pip install -U -e ".[test,docs]"
- name: Check greenlet build
run: |
ls -l dist
twine check dist/*
- name: Store greenlet wheel
uses: actions/upload-artifact@v2
with:
name: greenlet-${{ runner.os }}-${{ matrix.python-version }}.whl
path: dist/*whl
- name: Test
run: |
python -m unittest discover -v greenlet.tests
sphinx-build -b doctest -d docs/_build/doctrees2 docs docs/_build/doctest2
- name: Publish package to PyPI (mac)
# We cannot 'uses: pypa/gh-action-pypi-publish@v1.4.1' because
# that's apparently a container action, and those don't run on
# the Mac.
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && startsWith(runner.os, 'Mac')
env:
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
run: |
twine upload --skip-existing dist/*
manylinux:
runs-on: ubuntu-latest
# We use a regular Python matrix entry to share as much code as possible.
strategy:
matrix:
python-version: [3.9]
image: [manylinux2010_x86_64, manylinux2014_aarch64, manylinux2014_ppc64le, manylinux2014_x86_64]
steps:
- name: checkout
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Enable emulation
run: |
docker run --rm --privileged hypriot/qemu-register
# This one was seen in pyca/bcrypt. What's the difference?
# (Other than this one not working.)
#run: |
# docker run --rm --privileged multiarch/qemu-user-static:register --reset
- name: Build and test greenlet
if: matrix.image == 'manylinux2010_x86_64'
# An alternate way to do this is to run the container directly with a uses:
# and then the script runs inside it. That may work better with caching.
# See https://github.com/pyca/bcrypt/blob/f6b5ee2eda76d077c531362ac65e16f045cf1f29/.github/workflows/wheel-builder.yml
# The 2010 image is the last one that comes with Python 2.7,
# and only up through the tag 2021-02-06-3d322a5
env:
DOCKER_IMAGE: quay.io/pypa/${{ matrix.image }}:2021-02-06-3d322a5
run: bash ./make-manylinux
- name: Build and test greenlet (other)
if: matrix.image != 'manylinux2010_x86_64'
env:
DOCKER_IMAGE: quay.io/pypa/${{ matrix.image }}
run: bash ./make-manylinux
- name: Store greenlet wheels
uses: actions/upload-artifact@v2
with:
path: wheelhouse/*whl
name: ${{ matrix.image }}_wheels.zip
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@v1.4.1
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
with:
user: __token__
password: ${{ secrets.TWINE_PASSWORD }}
skip_existing: true
packages_dir: wheelhouse/