-
Notifications
You must be signed in to change notification settings - Fork 108
84 lines (72 loc) · 2.07 KB
/
build_and_publush.yaml
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
name: Build and publish distribution
on:
workflow_dispatch:
push:
tags:
- v*
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [38, 39, 310, 311]
cibw-arch: [auto, aarch64]
exclude:
# Do not build wheel for linux-aarch64 temporarily
- os: ubuntu-latest
cibw-arch: aarch64
- os: macos-latest
cibw-arch: aarch64
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: cp${{ matrix.python-version }}-*
CIBW_ARCHS_LINUX: ${{ matrix.cibw-arch }}
CIBW_ARCHS_MACOS: ${{ matrix.cibw-arch }}
- name: Build sdist
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
apt install libopenblas-dev
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install openblas
pip install build
python -m build . --sdist -o wheelhouse
if: ${{ matrix.python-version == '311' && runner.os == 'Linux' && matrix.cibw-arch == 'auto' }}
- uses: actions/upload-artifact@v2
with:
name: wheels
path: wheelhouse
publish:
name: Publish
needs: [build_wheels]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v3
with:
name: wheels
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install twine
run: pip install twine
- name: Publish to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
pip install --upgrade twine
twine upload --skip-existing *
rm -f *