forked from zzzeek/sqlalchemy
-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (102 loc) · 3.83 KB
/
create-wheels.yaml
File metadata and controls
119 lines (102 loc) · 3.83 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
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:
- "cp39-*"
- "cp310-* cp311-*"
- "cp312-* cp313-*"
wheel_mode:
- compiled
os:
- "windows-2022"
# TODO: macos-14 uses arm macs (only python 3.10+) - make arm wheel on it
- "macos-13"
- "ubuntu-22.04"
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-311*"
exclude:
- os: "windows-2022"
linux_archs: "aarch64"
- os: "macos-13"
linux_archs: "aarch64"
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
- 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@v2.21.3
env:
CIBW_ARCHS_LINUX: ${{ matrix.linux_archs }}
CIBW_BUILD: ${{ matrix.python }}
# 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.12"
- 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/*