Skip to content

Commit 53f53ba

Browse files
committed
windows build
1 parent 6a3f438 commit 53f53ba

File tree

5 files changed

+130
-11
lines changed

5 files changed

+130
-11
lines changed

.semaphore/semaphore.yml

Lines changed: 69 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ global_job_config:
1212
- checkout
1313
blocks:
1414
- name: "Wheels: OSX x64"
15-
run:
16-
when: "tag =~ '.*'"
15+
# run:
16+
# when: "tag =~ '.*'"
1717
dependencies: []
1818
task:
1919
agent:
@@ -31,8 +31,8 @@ blocks:
3131
- tar -czf wheelhouse-macOS-${ARCH}.tgz wheelhouse
3232
- artifact push workflow wheelhouse-macOS-${ARCH}.tgz
3333
- name: "Wheels: OSX arm64"
34-
run:
35-
when: "tag =~ '.*'"
34+
# run:
35+
# when: "tag =~ '.*'"
3636
dependencies: []
3737
task:
3838
agent:
@@ -51,7 +51,6 @@ blocks:
5151
- PIP_INSTALL_OPTIONS="--user" tools/wheels/build-wheels.sh "${LIBRDKAFKA_VERSION#v}" wheelhouse
5252
- tar -czf wheelhouse-macOS-${ARCH}.tgz wheelhouse
5353
- artifact push workflow wheelhouse-macOS-${ARCH}.tgz
54-
5554
- name: Source package verification with Python 3 (OSX x64) +docs
5655
dependencies: []
5756
task:
@@ -81,8 +80,8 @@ blocks:
8180
- python setup.py build && python setup.py install
8281
- make docs
8382
- name: "Wheels: Linux arm64"
84-
run:
85-
when: "tag =~ '.*'"
83+
# run:
84+
# when: "tag =~ '.*'"
8685
dependencies: []
8786
task:
8887
agent:
@@ -99,3 +98,66 @@ blocks:
9998
- ./tools/build-manylinux.sh "${LIBRDKAFKA_VERSION#v}"
10099
- tar -czf wheelhouse-linux-${ARCH}.tgz wheelhouse
101100
- artifact push workflow wheelhouse-linux-${ARCH}.tgz
101+
- name: "Wheels: Windows"
102+
# run:
103+
# when: "tag =~ '.*'"
104+
dependencies: []
105+
task:
106+
agent:
107+
machine:
108+
type: s1-prod-windows
109+
env_vars:
110+
- name: OS_NAME
111+
value: windows
112+
- name: ARCH
113+
value: x64
114+
prologue:
115+
commands:
116+
- cache restore msys2-x64
117+
- ".\\tools\\mingw-w64\\setup-msys2.ps1"
118+
- $env:PATH = 'C:\msys64\usr\bin;' + $env:PATH
119+
- bash -lc './tools/mingw-w64/msys2-dependencies.sh'
120+
- cache delete msys2-x64
121+
- cache store msys2-x64 c:/msys64
122+
jobs:
123+
- name: Build
124+
env_vars:
125+
- name: CHERE_INVOKING
126+
value: 'yes'
127+
- name: MSYSTEM
128+
value: UCRT64
129+
commands:
130+
- bash tools/mingw-w64/semaphore_commands.sh
131+
- bash tools/wheels/install-librdkafka.sh $env:LIBRDKAFKA_VERSION.TrimStart("v") dest
132+
- tools/wheels/build-wheels.bat x64 win_amd64 dest wheelhouse
133+
- ls
134+
- tar -czf wheelhouse-windows-${ARCH}.tgz wheelhouse
135+
- artifact push workflow wheelhouse-windows-${ARCH}.tgz
136+
- name: Source package verification with Python 3 (Linux x64) +docs
137+
dependencies: []
138+
task:
139+
agent:
140+
machine:
141+
type: s1-prod-ubuntu20-04-amd64-3
142+
env_vars:
143+
- name: OS_NAME
144+
value: linux
145+
- name: ARCH
146+
value: x64
147+
jobs:
148+
- name: Build
149+
commands:
150+
# use a virtualenv
151+
- python3 -m venv _venv && source _venv/bin/activate
152+
- pip install -r docs/requirements.txt
153+
- pip install -U protobuf
154+
# install librdkafka
155+
- lib_dir=dest/runtimes/$OS_NAME-$ARCH/native
156+
- tools/wheels/install-librdkafka.sh "${LIBRDKAFKA_VERSION#v}" dest
157+
- export CFLAGS="$CFLAGS -I${PWD}/dest/build/native/include"
158+
- export LDFLAGS="$LDFLAGS -L${PWD}/${lib_dir}"
159+
- export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PWD/$lib_dir"
160+
- export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$PWD/$lib_dir"
161+
# install confluent-kafka
162+
- python setup.py build && python setup.py install
163+
- make docs

tools/mingw-w64/msys2-dependencies.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
export msys2='cmd //C RefreshEnv.cmd '
6+
export msys2+='& set MSYS=winsymlinks:nativestrict '
7+
export msys2+='& C:\\msys64\\msys2_shell.cmd -defterm -no-start'
8+
export mingw64="$msys2 -mingw64 -full-path -here -c "\"\$@"\" --"
9+
export msys2+=" -msys2 -c "\"\$@"\" --"
10+
11+
# Have to update pacman first or choco upgrade will failure due to migration
12+
# to zstd instead of xz compression
13+
$msys2 pacman -Sy --noconfirm pacman
14+
15+
## Install more MSYS2 packages from https://packages.msys2.org/base here
16+
$msys2 pacman --sync --noconfirm --needed mingw-w64-x86_64-gcc
17+
18+
## Install unzip
19+
$msys2 pacman --sync --noconfirm --needed unzip

tools/mingw-w64/semaphore_commands.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
pacman -S python --version 3.8.0
3+
4+
set -e
5+
6+
export PATH="$PATH;C:\Python38;C:\Python38\Scripts"
7+
export MAKE=mingw32-make # so that Autotools can find it
8+
9+
cmd /c mklink /D C:\Python38\python3.exe C:\Python38\python.exe
10+
11+
python -m pip install cibuildwheel==2.12.0

tools/mingw-w64/setup-msys2.ps1

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Install (if necessary) and set up msys2.
2+
3+
4+
$url="https://github.com/msys2/msys2-installer/releases/download/2022-10-28/msys2-base-x86_64-20221028.sfx.exe"
5+
$sha256="e365b79b4b30b6f4baf34bd93f3d2a41c0a92801c7a96d79cddbfca1090a0554"
6+
7+
8+
if (!(Test-Path -Path "c:\msys64\usr\bin\bash.exe")) {
9+
echo "Downloading and installing msys2 to c:\msys64"
10+
11+
(New-Object System.Net.WebClient).DownloadFile($url, './msys2-installer.exe')
12+
13+
# Verify checksum
14+
(Get-FileHash -Algorithm "SHA256" .\msys2-installer.exe).hash -eq $sha256
15+
16+
# Install msys2
17+
.\msys2-installer.exe -y -oc:\
18+
19+
Remove-Item msys2-installer.exe
20+
21+
# Set up msys2 the first time
22+
echo "Setting up msys"
23+
c:\msys64\usr\bin\bash -lc ' '
24+
25+
} else {
26+
echo "Using previously installed msys2"
27+
}
28+
29+
# Update packages
30+
echo "Updating msys2 packages"
31+
c:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syuu --overwrite '*'"

tools/wheels/build-wheels.bat

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,8 @@ set CIBW_REPAIR_WHEEL_COMMAND=python -m delvewheel repair --add-path %DLL_DIR% -
2525

2626
set PATH=%PATH%;c:\Program Files\Git\bin\
2727

28-
python -m pip install cibuildwheel==2.12.0 || goto :error
29-
3028
python -m cibuildwheel --output-dir %WHEELHOUSE% --platform windows || goto :error
3129

32-
dir %WHEELHOUSE%
33-
3430
goto :eof
3531

3632
:usage

0 commit comments

Comments
 (0)