-
Notifications
You must be signed in to change notification settings - Fork 17
139 lines (133 loc) · 4.09 KB
/
pythonpackage.yml
File metadata and controls
139 lines (133 loc) · 4.09 KB
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: samplerate
on:
push:
branches: [master]
tags: ["v*", "test-*"]
pull_request:
types: [opened, synchronize, reopened, labeled]
workflow_dispatch:
jobs:
build_sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.9"
- name: Build sdist
run: |
python -m pip install --upgrade pip
pip install -U setuptools setuptools_scm build twine
python -m build --sdist
twine check dist/*
- uses: actions/upload-artifact@v6
with:
name: sdist
path: dist/*.tar.gz
build_wheels_pr:
if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'full-build')
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
cibw_build: "cp314-manylinux_x86_64"
cibw_archs: "x86_64"
- os: macos-latest
cibw_build: "cp314-macosx_universal2"
cibw_archs: "universal2"
- os: windows-latest
cibw_build: "cp314-win_amd64"
cibw_archs: "AMD64"
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
fetch-depth: 0
- uses: pypa/cibuildwheel@v3.4.0
env:
CIBW_BUILD: ${{ matrix.cibw_build }}
CIBW_ARCHS: ${{ matrix.cibw_archs }}
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_TEST_REQUIRES: "pytest numpy"
CIBW_TEST_COMMAND: "pytest {project}/tests"
build_wheels:
if: >-
github.event_name == 'push' ||
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'full-build'))
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
fetch-depth: 0
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all
- uses: pypa/cibuildwheel@v3.4.0
env:
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-* cp314-*"
CIBW_SKIP: "*-musllinux_* cp39-*aarch64 cp310-*aarch64"
CIBW_ARCHS_LINUX: "x86_64 aarch64"
CIBW_ARCHS_MACOS: "universal2"
CIBW_ARCHS_WINDOWS: "AMD64"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
CIBW_TEST_REQUIRES: "pytest numpy"
CIBW_TEST_COMMAND: "pytest {project}/tests"
CIBW_TEST_SKIP: "cp314-*"
- uses: actions/upload-artifact@v6
with:
name: wheels-${{ matrix.os }}
path: wheelhouse/*.whl
publish:
needs: [build_sdist, build_wheels]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v8
with:
path: dist
merge-multiple: true
- name: Validate wheels
run: |
pip install --upgrade twine packaging
twine check dist/*
- name: Publish to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload --skip-existing dist/*
publish-test:
needs: [build_sdist, build_wheels]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/test-')
steps:
- uses: actions/download-artifact@v8
with:
path: dist
merge-multiple: true
- name: Validate wheels
run: |
pip install --upgrade twine packaging
twine check dist/*
- name: Publish to PyPI Test
env:
TWINE_USERNAME: ${{ secrets.PYPITEST_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPITEST_PASSWORD }}
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
run: |
twine upload --skip-existing dist/*