forked from duckdb/duckdb-python
-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (105 loc) · 5.05 KB
/
Copy pathpackaging_wheels.yml
File metadata and controls
112 lines (105 loc) · 5.05 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
name: Wheels packaging
on:
workflow_call:
inputs:
minimal:
type: boolean
description: Build a minimal set of wheels to do a sanity check
default: false
testsuite:
type: string
description: Testsuite to run (none, fast, all)
required: true
default: all
duckdb-python-sha:
type: string
description: The commit or ref to build against (defaults to latest commit of current ref)
required: false
duckdb-sha:
type: string
description: Override the DuckDB submodule commit or ref to build against
required: false
set-version:
description: Force version (vX.Y.Z-((rc|post)N))
required: false
type: string
jobs:
build_wheels:
name: 'Wheel: ${{ matrix.python }}-${{ matrix.platform.cibw_system }}_${{ matrix.platform.arch }}'
strategy:
fail-fast: false
matrix:
python: [ cp39, cp310, cp311, cp312, cp313, cp314 ]
platform:
- { os: windows-2025, arch: amd64, cibw_system: win }
- { os: windows-11-arm, arch: arm64, cibw_system: win }
- { os: ubuntu-24.04, arch: x86_64, cibw_system: manylinux }
- { os: ubuntu-24.04-arm, arch: aarch64, cibw_system: manylinux }
- { os: macos-15, arch: arm64, cibw_system: macosx }
- { os: macos-15, arch: universal2, cibw_system: macosx }
- { os: macos-13, arch: x86_64, cibw_system: macosx }
minimal:
- ${{ inputs.minimal }}
exclude:
- { minimal: true, python: cp310 }
- { minimal: true, python: cp311 }
- { minimal: true, python: cp312 }
- { minimal: true, python: cp313 }
- { minimal: true, platform: { arch: universal2 } }
runs-on: ${{ matrix.platform.os }}
env:
### cibuildwheel configuration
#
# This is somewhat brittle, so be careful with changes. Some notes for our future selves (and others):
# - cibw will change its cwd to a temp dir and create a separate venv for testing. It then installs the wheel it
# built into that venv, and run the CIBW_TEST_COMMAND. We have to install all dependencies ourselves, and make
# sure that the pytest config in pyproject.toml is available.
# - CIBW_BEFORE_TEST installs the test dependencies by exporting them into a pylock.toml. At the time of writing,
# `uv sync --no-install-project` had problems correctly resolving dependencies using resolution environments
# across all platforms we build for. This might be solved in newer uv versions.
# - CIBW_TEST_COMMAND specifies pytest conf from pyproject.toml. --confcutdir is needed to prevent pytest from
# traversing the full filesystem, which produces an error on Windows.
# - CIBW_TEST_SKIP we always skip tests for *-macosx_universal2 builds, because we run tests for arm64 and x86_64.
CIBW_TEST_SKIP: ${{ inputs.testsuite == 'none' && '*' || '*-macosx_universal2' }}
CIBW_TEST_SOURCES: tests
CIBW_BEFORE_TEST: >
uv export --only-group test --no-emit-project --quiet --output-file pylock.toml --directory {project} &&
uv pip install -r pylock.toml
CIBW_TEST_COMMAND: >
uv run -v pytest --confcutdir=. --rootdir . -c {project}/pyproject.toml ${{ inputs.testsuite == 'fast' && './tests/fast' || './tests' }}
steps:
- name: Checkout DuckDB Python
uses: actions/checkout@v4
with:
ref: ${{ inputs.duckdb-python-sha }}
fetch-depth: 0
submodules: true
- name: Checkout DuckDB
shell: bash
if: ${{ inputs.duckdb-sha }}
run: |
cd external/duckdb
git fetch origin
git checkout ${{ inputs.duckdb-sha }}
# Make sure that OVERRIDE_GIT_DESCRIBE is propagated to cibuildwhel's env, also when it's running linux builds
- name: Set OVERRIDE_GIT_DESCRIBE
shell: bash
if: ${{ inputs.set-version != '' }}
run: echo "CIBW_ENVIRONMENT=OVERRIDE_GIT_DESCRIBE=${{ inputs.set-version }}" >> $GITHUB_ENV
# Install Astral UV, which will be used as build-frontend for cibuildwheel
- uses: astral-sh/setup-uv@v7
with:
version: "0.9.0"
enable-cache: false
cache-suffix: -${{ matrix.python }}-${{ matrix.platform.cibw_system }}_${{ matrix.platform.arch }}
- name: Build${{ inputs.testsuite != 'none' && ' and test ' || ' ' }}wheels
uses: pypa/cibuildwheel@v3.2
env:
CIBW_ARCHS: ${{ matrix.platform.arch == 'amd64' && 'AMD64' || matrix.platform.arch == 'arm64' && matrix.platform.cibw_system == 'win' && 'ARM64' || matrix.platform.arch }}
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform.cibw_system }}_${{ matrix.platform.arch }}
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.python }}-${{ matrix.platform.cibw_system }}_${{ matrix.platform.arch }}
path: wheelhouse/*.whl
compression-level: 0