-
Notifications
You must be signed in to change notification settings - Fork 2
137 lines (111 loc) · 4.01 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Wheels
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
tag:
- '*'
release:
types:
- published
env:
# Python 3.12+ is handled using the stable ABI, no need to build later versions
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8, <=3.12"
# Only build for PyPy 3.9-
CIBW_SKIP: "pp37* pp38*"
# can be used for testing ->
#CIBW_BUILD: "cp310-manylinux_x86_64" # for testing, build single wheel.
# Target 64 bit architectures (x86_64, and arm64 on macOS)
CIBW_ARCHS_WINDOWS: auto64
CIBW_ARCHS_LINUX: auto64
CIBW_ARCHS_MACOS: x86_64 arm64
# Target older versions of macOS and Linux for good compatibility
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=10.14
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014
# Necessary to see build output from the actual compilation
CIBW_BUILD_VERBOSITY: 1
# GitHub Actions doesn't have macOS/arm64 runners, skip test on this platform
CIBW_TEST_SKIP: "*-macosx_arm64"
# Run pytest to ensure that the package was correctly built
CIBW_TEST_COMMAND: pytest {project}/tests
CIBW_TEST_REQUIRES: pytest
jobs:
build_sdist:
name: Build SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Build SDist
run: pipx run build --sdist
- name: Check metadata
run: pipx run twine check dist/*
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
build_wheels:
name: Wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' || github.event_name == 'release'
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: build wheels
uses: pypa/[email protected]
- name: Verify clean directory
run: git diff --exit-code
shell: bash
- name: upload wheels
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} # unique name for the artifact
path: wheelhouse/*.whl # location of the wheels
upload_to_pypi:
name: Upload if release
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
# run on published release or manual trigger
if: github.event_name == 'release' && github.event.action == 'published' || github.event_name == 'workflow_dispatch'
permissions: # Added OIDC permissions
contents: read
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/setup-python@v4
- uses: actions/download-artifact@v4
with:
pattern: cibw-* # download all artifacts
path: dist
merge-multiple: true
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
upload_to_test_pypi:
# runs for distributions or tags
name: Upload to Test PyPI
needs: [build_wheels, build_sdist]
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions: # Added OIDC permissions
contents: read
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/setup-python@v4
- uses: actions/download-artifact@v4
with:
pattern: cibw-* # download all artifacts
path: dist
merge-multiple: true
- name: Publish package distributions to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: false