forked from sqlalchemy/sqlalchemy
-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (112 loc) · 4.25 KB
/
create-wheels.yaml
File metadata and controls
129 lines (112 loc) · 4.25 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
name: Create wheel
on:
# run when a release has been created
release:
types: [created]
# push:
# branches:
# - "go_wheel_*"
# env:
# # comment TWINE_REPOSITORY_URL to use the real pypi. NOTE: change also the secret used in TWINE_PASSWORD
# TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
jobs:
build_wheels:
name: ${{ matrix.wheel_mode }} wheels ${{ matrix.python }} on ${{ matrix.os }} ${{ matrix.os == 'ubuntu-22.04' && matrix.linux_archs || '' }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# emulated wheels on linux take too much time, split wheels into multiple runs
python:
- "cp310-* cp311-*"
- "cp312-* cp313-* cp314-*"
- "cp313t-* cp314t-*"
wheel_mode:
- compiled
os:
- "windows-2022"
- "windows-11-arm"
- "macos-15"
- "ubuntu-22.04"
- "ubuntu-22.04-arm"
linux_archs:
# this is only meaningful on linux. windows and macos ignore exclude all but one arch
- "aarch64"
- "x86_64"
include:
# create pure python build
- os: ubuntu-22.04
wheel_mode: pure-python
python: "cp-314*"
exclude:
- os: "windows-2022"
linux_archs: "aarch64"
# ignored on windows, just avoid to run it multiple times
- os: "windows-11-arm"
linux_archs: "aarch64"
- os: "macos-15"
linux_archs: "x86_64"
- os: "ubuntu-22.04"
linux_archs: "aarch64"
- os: "ubuntu-22.04-arm"
linux_archs: "x86_64"
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Remove tag-build from pyproject.toml
# sqlalchemy has `tag-build` set to `dev` in pyproject.toml. It needs to be removed before creating the wheel
# otherwise it gets tagged with `dev0`
shell: pwsh
# This is equivalent to the sed commands:
# `sed -i '/tag-build="dev"/d' pyproject.toml`
# `sed -i '/tag-build = "dev"/d' pyproject.toml`
# `-replace` uses a regexp match
run: |
(get-content pyproject.toml) | %{$_ -replace 'tag-build.?=.?"dev"',""} | set-content pyproject.toml
# See details at https://cibuildwheel.readthedocs.io/en/stable/faq/#emulation
# no longer needed since arm runners are now available
# - name: Set up QEMU on linux
# if: ${{ runner.os == 'Linux' }}
# uses: docker/setup-qemu-action@v3
# with:
# platforms: all
- name: Build compiled wheels
if: ${{ matrix.wheel_mode == 'compiled' }}
uses: pypa/cibuildwheel@v3.3.0
env:
CIBW_ARCHS_LINUX: ${{ matrix.linux_archs }}
CIBW_BUILD: ${{ matrix.python }}
CIBW_ENABLE: ${{ matrix.python == 'cp313t-*' && 'cpython-freethreading' || '' }}
# setting it here does not work on linux
# PYTHONNOUSERSITE: "1"
- name: Set up Python for twine and pure-python wheel
uses: actions/setup-python@v5
with:
python-version: "3.14"
- name: Build pure-python wheel
if: ${{ matrix.wheel_mode == 'pure-python' && runner.os == 'Linux' }}
run: |
python -m pip install --upgrade pip
pip --version
pip install build
pip list
DISABLE_SQLALCHEMY_CEXT=y python -m build --wheel --outdir ./wheelhouse
# - uses: actions/upload-artifact@v3
# with:
# path: ./wheelhouse/*.whl
- name: Upload wheels to release
# upload the generated wheels to the github release
uses: sqlalchemyorg/upload-release-assets@sa
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
files: './wheelhouse/*.whl'
- name: Publish wheel
# the action https://github.com/marketplace/actions/pypi-publish runs only on linux and we cannot specify
# additional options
env:
TWINE_USERNAME: __token__
# replace TWINE_PASSWORD with token for real pypi
# TWINE_PASSWORD: ${{ secrets.test_pypi_token }}
TWINE_PASSWORD: ${{ secrets.pypi_token }}
run: |
pip install -U twine
twine upload --skip-existing ./wheelhouse/*