-
Notifications
You must be signed in to change notification settings - Fork 1
157 lines (148 loc) · 6.18 KB
/
Copy pathwheels.yml
File metadata and controls
157 lines (148 loc) · 6.18 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# Build platform wheels for doltlite. Each wheel bundles a libdoltlite
# built from source by scripts/build-libdoltlite.sh.
#
# Triggers:
# - push to main, PRs: build only (validate)
# - tag `v*`: build + publish to PyPI via trusted publisher
# - manual workflow_dispatch: build only
#
# One-time PyPI setup (see RELEASING.md):
# 1. Create the `doltlite` project on PyPI by uploading the first wheel
# manually OR by configuring a "pending" trusted publisher.
# 2. At https://pypi.org/manage/account/publishing/ add a trusted
# publisher with owner=dolthub, repo=doltlite-python,
# workflow=wheels.yml, environment=pypi.
name: wheels
on:
push:
branches: [main]
tags: ["v*"]
pull_request:
workflow_dispatch:
jobs:
build_wheels:
name: ${{ matrix.os }} ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { os: macos-14, arch: arm64, cibw_archs: arm64 }
- { os: ubuntu-latest, arch: x86_64, cibw_archs: x86_64 }
- { os: ubuntu-24.04-arm, arch: aarch64, cibw_archs: aarch64 }
# Intel Mac (macos-13) intentionally omitted: GitHub's free-tier
# macos-13 runners queue for 1+ hours, blocking releases. Intel
# Mac users can build from source via `pip install --no-binary
# doltlite doltlite` (with libdoltlite available locally). Bring
# this row back when GitHub's scheduling improves or we move to
# paid/self-hosted runners.
steps:
- uses: actions/checkout@v4
- uses: pypa/cibuildwheel@v2.21
env:
CIBW_ARCHS: ${{ matrix.cibw_archs }}
# Wheel content is identical across CPython versions (py3-none
# tag, see setup.py), so build for one Python and the resulting
# wheel covers them all.
CIBW_BUILD: "cp312-*"
# macOS: skip delocate. Our wheel ships libdoltlite as package
# data loaded via absolute path; delocate has nothing useful to
# do, and rewriting libdoltlite's install_name could collide
# with the loader's runtime shim. The default macosx_*_<arch>
# tag setuptools picks is already PyPI-acceptable.
CIBW_REPAIR_WHEEL_COMMAND_MACOS: ""
# Linux: keep the default auditwheel repair. We don't need it
# to bundle deps (libdoltlite only links libc / libpthread),
# but auditwheel also renames bare `linux_*` tags to the
# appropriate `manylinux_*_<arch>` — which PyPI requires.
# Build libdoltlite from source for each platform. On Linux this
# runs inside the manylinux container, so build deps go into
# CIBW_BEFORE_ALL_LINUX below.
CIBW_BEFORE_BUILD: bash scripts/build-libdoltlite.sh
# Smoke test: install the wheel into a clean venv and run a
# script that verifies dolt_* functions are wired up.
CIBW_TEST_COMMAND: "python {project}/tests/smoke.py"
# cibuildwheel's macOS Python (python.org-style framework
# build) statically links SQLite into _sqlite3.so — same case
# as python-build-standalone. Our loader has no library
# reference to redirect. The build is unaffected; we run the
# macOS smoke test in a separate job below using Homebrew
# Python (which has dynamic _sqlite3).
CIBW_TEST_SKIP: "*-macosx_*"
# manylinux containers ship a minimal toolchain; doltlite's
# build needs gcc/make (already present), zlib, and tcl for
# configure. yum is available on AlmaLinux 8 (manylinux_2_28).
CIBW_BEFORE_ALL_LINUX: |
yum install -y zlib-devel tcl tcl-devel git
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-${{ matrix.arch }}
path: wheelhouse/*.whl
build_sdist:
name: Source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
smoke_macos:
# Runs against the macOS runner's preinstalled Homebrew Python,
# which links _sqlite3 to a separate libsqlite3.dylib — exactly the
# case the loader targets. cibuildwheel can't run this test inline
# because its bundled Python is framework-style (libsqlite3
# statically linked into _sqlite3.so).
name: macOS smoke (${{ matrix.arch }})
needs: build_wheels
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { os: macos-14, arch: arm64, brew_prefix: /opt/homebrew }
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: wheels-${{ matrix.os }}-${{ matrix.arch }}
path: wheelhouse
- name: Install wheel into Homebrew-Python venv
run: |
set -euxo pipefail
# GitHub-hosted runners ship multiple Homebrew Pythons under
# python@3.x; pick the newest that exists.
PY=""
for v in 3.13 3.12 3.11 3.10; do
cand="${{ matrix.brew_prefix }}/opt/python@$v/bin/python$v"
[ -x "$cand" ] && PY="$cand" && break
done
[ -n "$PY" ] || { echo "No Homebrew Python found"; exit 1; }
echo "Using $PY"
"$PY" -m venv venv
venv/bin/pip install wheelhouse/*.whl
venv/bin/python tests/smoke.py
publish:
name: Publish to PyPI
needs: [build_wheels, build_sdist, smoke_macos]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/doltlite
permissions:
id-token: write # required for trusted publisher OIDC exchange
steps:
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist
# Skip uploads of files that already exist (idempotent re-runs).
skip-existing: true