forked from hpyproject/hpy
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (66 loc) · 2.06 KB
/
release-pypi.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
---
name: Release to PyPI
on:
release:
types: [created]
jobs:
build_sdist:
name: Build source package
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v2
- name: Install/Upgrade Python dependencies
run: python -m pip install --upgrade pip wheel
- name: Build and install Python source package
run: |
python setup.py sdist
python -m pip install dist/*.tar.gz
- name: Run tests
run: |
pip install pytest pytest-xdist
pytest -n auto test/
- uses: actions/upload-artifact@v2
with:
path: dist/*.tar.gz
build_bdist:
name: Build binary wheels
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Windows tests fail when built as a binary wheel for some reason
os: [ubuntu-latest, macos-latest] # windows-latest
steps:
- uses: actions/checkout@v2
# setup Python for cibuildwheel
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
# for other architectures, see: https://cibuildwheel.readthedocs.io/en/stable/faq/#emulation
- name: Build wheels for CPython
uses: pypa/[email protected]
env:
CIBW_BUILD: 'cp*' # no PyPI builds
CIBW_SKIP: 'cp310-*' # 3.10 builds are broken
CIBW_ARCHS: 'auto64' # only 64-bit
CIBW_TEST_REQUIRES: pytest pytest-xdist
CIBW_TEST_COMMAND: pytest -n auto {project}/test/
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl
upload_pypi:
name: Publish packages to PyPI
# only publish packages once everything is successful
needs: [build_bdist, build_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist
- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.pypi_api_token }}
# uncomment the following to upload to test.pypi.org
# repository_url: https://test.pypi.org/legacy/