forked from kaizhang/SnapATAC2
-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (104 loc) · 3.55 KB
/
wheels.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
# This workflow triggers when commit message contains "wheel" or when a tag is pushed.
# It will build a Python project using CIBW, then upload the wheel and source
# distribution to PyPI.
name: build-wheels
on:
push:
workflow_call:
inputs:
wheel:
required: false
type: string
nightly:
required: false
type: string
jobs:
build_wheels:
name: Wheel on ${{ matrix.os }} for ${{ matrix.python_version }}
runs-on: ${{ matrix.os }}
if: ${{ startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, 'wheel') || inputs.wheel }}
strategy:
matrix:
os: [ubuntu-latest, macos-11]
python_version: ["cp39-*", "cp310-*", "cp311-*", "cp312-*"]
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_BEFORE_ALL_LINUX: >
curl https://sh.rustup.rs -sSf | sh -s -- -y && yum install -y openssl-devel zlib-devel
CIBW_ARCHS_LINUX: "auto64"
CIBW_ENVIRONMENT: 'PATH="$PATH:$HOME/.cargo/bin"'
CIBW_SKIP: "pp* *-win32 *-musllinux*"
CIBW_BUILD: ${{ matrix.python_version }}
CIBW_TEST_REQUIRES: pytest hypothesis
CIBW_TEST_COMMAND: "pytest {project}/snapatac2-python/tests"
steps:
- name: Checkout code
uses: nschloe/action-cached-lfs-checkout@v1
- uses: ./.github/actions/setup-rust
- if: runner.os != 'Linux'
name: Setup env when not using docker
run: python -m pip install --upgrade wheel setuptools setuptools-rust
# Used to host cibuildwheel
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.16.2
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse snapatac2-python
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
make_sdist:
name: Build source distribution
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') }} || inputs.nightly
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.10'
- name: Install setuptools and setuptools-rust
run: |
python -m pip install --upgrade wheel setuptools setuptools-rust
- name: Build sdist
run: python setup.py sdist
working-directory: snapatac2-python
- uses: actions/upload-artifact@v3
with:
path: snapatac2-python/dist/*.tar.gz
publish:
needs: [build_wheels, make_sdist]
runs-on: ubuntu-latest
if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) || inputs.nightly
steps:
- uses: actions/checkout@v4
- name: Delete Release
if: inputs.nightly
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if gh release view nightly > /dev/null 2>&1; then
gh release delete nightly -y --cleanup-tag
fi
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- name: Publish to PyPI
uses: pypa/[email protected]
if: startsWith(github.ref, 'refs/tags')
with:
user: __token__
password: ${{ secrets.pypi_password }}
- name: Create nightly release
uses: ncipollo/release-action@v1
if: inputs.nightly
with:
allowUpdates: true
tag: nightly
name: Nightly Release
prerelease: true
removeArtifacts: true
artifacts: "dist/*.whl,dist/*.tar.gz"