-
Notifications
You must be signed in to change notification settings - Fork 4
87 lines (74 loc) · 2.12 KB
/
release.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
# adapted from: https://github.com/pypa/cibuildwheel/tree/main/examples
name: Release
on:
release:
types: [ published ]
workflow_dispatch:
defaults:
run:
shell: bash -l {0}
jobs:
build_wheels_and_sdist:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-20.04, macOS-12, windows-2019 ]
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
fetch-tags: 'true'
fetch-depth: 0
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Cythonize C-extensions
run: |
python3 -m pip install --upgrade pip cibuildwheel==2.19.2
python3 -m pip install -r requirements-dev.txt
cythonize polyagamma/*.pyx
- name: Build wheels
uses: pypa/[email protected]
with:
package-dir: .
output-dir: wheelhouse
config-file: "pyproject.toml"
- name: Build source distribution
if: ${{ matrix.os == 'ubuntu-20.04' }}
run: |
python3 -m pip install --upgrade pip cython==3.0.* build
cythonize polyagamma/*.pyx
python -m pip install build
python -m build --sdist
mv dist/*.gz wheelhouse
- name: Store the wheelhouse directory
uses: actions/upload-artifact@v3
with:
name: wheels_and_sdist
path: wheelhouse
if-no-files-found: error
upload_pypi:
needs: [ build_wheels_and_sdist ]
runs-on: ubuntu-20.04
environment:
name: pypi
url: https://pypi.org/p/polyagamma
permissions:
id-token: write
steps:
- name: Pull built wheels and sdist
uses: actions/download-artifact@v3
with:
name: wheels_and_sdist
path: wheelhouse
- name: Publish to PyPI
uses: pypa/[email protected]
with:
packages_dir: wheelhouse