forked from Eventual-Inc/Daft
-
Notifications
You must be signed in to change notification settings - Fork 0
193 lines (174 loc) · 6.5 KB
/
build-wheel.yml
File metadata and controls
193 lines (174 loc) · 6.5 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
name: Build Daft wheel
run-name: 'Build Daft wheel for ${{ inputs.os }}-${{ inputs.arch }}-lts=${{ inputs.lts }}-lto=${{ inputs.use_lto }}'
on:
workflow_call:
inputs:
os:
description: The operating system to build for (ubuntu, macos, or windows)
type: string
arch:
description: The architecture to build for (x86_64 or aarch64)
type: string
lts:
description: Whether to build for long term support
type: boolean
build_type:
description: Value to set RUST_DAFT_PKG_BUILD_TYPE to (release, dev, nightly, etc.)
type: string
use_lto:
description: Whether to use link-time optimization (release-lto profile)
type: boolean
default: true
run_tests:
description: Whether to run tests on the built wheels
type: boolean
default: false
permissions:
contents: read
env:
PYTHON_VERSION: 3.11
DAFT_ANALYTICS_ENABLED: '0'
RUST_DAFT_PKG_BUILD_TYPE: ${{ inputs.build_type }}
defaults:
run:
shell: bash
jobs:
build:
runs-on: ${{ inputs.os == 'ubuntu' && 'buildjet-16vcpu-ubuntu-2204' || format('{0}-latest', inputs.os) }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Python and uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ env.PYTHON_VERSION }}
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"
- name: Setup Virtual Env
run: |
uv venv --seed .venv
if [[ "${{ inputs.os }}" == "windows" ]]; then
echo "$GITHUB_WORKSPACE/.venv/Scripts" >> $GITHUB_PATH
source .venv/Scripts/activate
else
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH
source .venv/bin/activate
fi
uv pip install twine yq setuptools_scm
- name: Patch package version
run: |
VERSION="$(python -m setuptools_scm | sed 's/\.dev/-dev/'g)" # replace ".dev" with "-dev" to comply with Cargo SemVer rules
echo "Setting package version to: $VERSION"
tomlq -i -t ".package.version = \"$VERSION\"" Cargo.toml
tomlq -i -t ".workspace.package.version = \"$VERSION\"" Cargo.toml
- name: Patch name to daft-lts if LTS
if: ${{ inputs.lts }}
run: tomlq -i -t ".project.name = \"daft-lts\"" pyproject.toml
- name: Configure RUSTFLAGS for x86
if: ${{ (inputs.arch == 'x86_64') }}
run: |
if [[ "${{ inputs.lts }}" == "true" ]]; then
echo "RUSTFLAGS=-C target-feature=+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt,+cmpxchg16b" >> $GITHUB_ENV && \
echo "CFLAGS=-msse3 -mssse3 -msse4.1 -msse4.2 -mpopcnt -mcx16" >> $GITHUB_ENV
else
echo "RUSTFLAGS=-C target-feature=+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt,+cmpxchg16b,+avx,+avx2,+fma,+bmi1,+bmi2,+lzcnt,+pclmulqdq,+movbe -Z tune-cpu=skylake" >> $GITHUB_ENV && \
echo "CFLAGS=-msse3 -mssse3 -msse4.1 -msse4.2 -mpopcnt -mcx16 -mavx -mavx2 -mfma -mbmi -mbmi2 -mlzcnt -mpclmul -mmovbe -mtune=skylake" >> $GITHUB_ENV
fi
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: "22"
cache: "npm"
cache-dependency-path: src/daft-dashboard/frontend/package-lock.json
- name: Build dashboard
working-directory: ./src/daft-dashboard/frontend
run: |
npm ci
npm run build
- name: Build wheels - Mac and Windows x86
if: ${{ ((inputs.os == 'macos') || (inputs.os == 'windows')) && (inputs.arch == 'x86_64') }}
uses: PyO3/maturin-action@v1
with:
target: x86_64
args: --profile ${{ inputs.use_lto && 'release-lto' || 'release' }} --out dist
env:
GITHUB_ACTIONS: true
- name: Build wheels - Linux x86
if: ${{ (inputs.os == 'ubuntu') && (inputs.arch == 'x86_64') }}
uses: PyO3/maturin-action@v1
with:
target: x86_64
manylinux: 2_24
# only produce sdist for linux x86 to avoid multiple copies
args: --profile ${{ inputs.use_lto && 'release-lto' || 'release' }} --out dist --sdist
env:
GITHUB_ACTIONS: true
- name: Build wheels - Linux aarch64
if: ${{ (inputs.os == 'ubuntu') && (inputs.arch == 'aarch64') }}
uses: PyO3/maturin-action@v1
with:
target: aarch64-unknown-linux-gnu
manylinux: 2_24
# only produce sdist for linux x86 to avoid multiple copies
args: --profile ${{ inputs.use_lto && 'release-lto' || 'release' }} --out dist --sdist
before-script-linux: export JEMALLOC_SYS_WITH_LG_PAGE=16
env:
GITHUB_ACTIONS: true
- name: Build wheels - Mac aarch64
if: ${{ (inputs.os == 'macos') && (inputs.arch == 'aarch64') }}
uses: PyO3/maturin-action@v1
with:
target: aarch64
args: --profile ${{ inputs.use_lto && 'release-lto' || 'release' }} --out dist
env:
RUSTFLAGS: -Ctarget-cpu=apple-m1
CFLAGS: -mtune=apple-m1
GITHUB_ACTIONS: true
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: wheels-${{ inputs.os }}-${{ inputs.arch }}-lts=${{ inputs.lts }}-lto=${{ inputs.use_lto }}
path: dist
test-wheels:
name: Test built wheels
runs-on: ubuntu-latest
needs: build
if: ${{ inputs.run_tests && inputs.os == 'ubuntu' && inputs.arch == 'x86_64' }}
strategy:
fail-fast: false
matrix:
runner: [native, ray]
python-version: ['3.10', '3.11']
env:
package-name: daft
steps:
- uses: actions/checkout@v6
- name: Download built wheels
uses: actions/download-artifact@v8
with:
pattern: wheels-${{ inputs.os }}-${{ inputs.arch }}-lts=${{ inputs.lts }}-lto=${{ inputs.use_lto }}
merge-multiple: true
path: dist
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Setup Virtual Env
run: |
python -m venv venv
echo "$GITHUB_WORKSPACE/venv/bin" >> $GITHUB_PATH
- name: Install wheel and test dependencies
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
max_attempts: 3
retry_wait_seconds: 10
command: |
source venv/bin/activate
pip install ray pytest pandas pytz numpy pyarrow dist/*.whl --force-reinstall
rm -rf daft
- name: Run dataframe tests
run: |
source venv/bin/activate
DAFT_RUNNER=${{ matrix.runner }} pytest tests/dataframe --durations=50