Skip to content

Commit eba2d0d

Browse files
committed
macOS semaphore pipeline for x64 and arm64
1 parent 3e343bb commit eba2d0d

File tree

6 files changed

+115
-78
lines changed

6 files changed

+115
-78
lines changed

.semaphore/semaphore.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
version: v1.0
2+
name: Test on PR or create and upload wheels on tag.
3+
agent:
4+
machine:
5+
type: s1-prod-mac-m1
6+
global_job_config:
7+
secrets:
8+
- name: vault_sem2_approle
9+
env_vars:
10+
- name: LIBRDKAFKA_VERSION
11+
value: v1.9.2-RC3
12+
blocks:
13+
- name: "Wheels: OSX x64"
14+
run:
15+
when: "tag =~ '.*'"
16+
dependencies: []
17+
task:
18+
agent:
19+
machine:
20+
type: s1-prod-macos
21+
env_vars:
22+
- name: OS_NAME
23+
value: osx
24+
- name: ARCH
25+
value: x64
26+
jobs:
27+
- name: Build
28+
commands:
29+
- cd $SEM_WORKSPACE
30+
- export HOME=$SEM_WORKSPACE
31+
- checkout
32+
# needed on the self-hosted agent
33+
- if [ ! -d ./tools ]; then cd $SEM_WORKSPACE/confluent-kafka-python; fi
34+
- PIP_INSTALL_OPTIONS="--user" tools/wheels/build-wheels.sh "${LIBRDKAFKA_VERSION#v}" wheelhouse
35+
- tar -czf wheelhouse-macOS-${ARCH}.tgz wheelhouse
36+
- artifact push workflow wheelhouse-macOS-${ARCH}.tgz
37+
- name: "Wheels: OSX arm64"
38+
run:
39+
when: "tag =~ '.*'"
40+
dependencies: []
41+
task:
42+
env_vars:
43+
- name: OS_NAME
44+
value: osx
45+
- name: CIBW_ARCHS
46+
value: arm64
47+
- name: ARCH
48+
value: arm64
49+
jobs:
50+
- name: Build
51+
commands:
52+
- cd $SEM_WORKSPACE
53+
- export HOME=$SEM_WORKSPACE
54+
- checkout
55+
# needed on the self-hosted agent
56+
- if [ ! -d ./tools ]; then cd $SEM_WORKSPACE/confluent-kafka-python; fi
57+
- PIP_INSTALL_OPTIONS="--user" tools/wheels/build-wheels.sh "${LIBRDKAFKA_VERSION#v}" wheelhouse
58+
- tar -czf wheelhouse-macOS-${ARCH}.tgz wheelhouse
59+
- artifact push workflow wheelhouse-macOS-${ARCH}.tgz
60+
61+
- name: Source package verification with Python 3 (OSX x64) +docs
62+
dependencies: []
63+
task:
64+
agent:
65+
machine:
66+
type: s1-prod-macos
67+
env_vars:
68+
- name: OS_NAME
69+
value: osx
70+
- name: ARCH
71+
value: arm64
72+
jobs:
73+
- name: Build
74+
commands:
75+
- cd $SEM_WORKSPACE
76+
- export HOME=$SEM_WORKSPACE
77+
- checkout
78+
# needed on the self-hosted agent
79+
- if [ ! -d ./tools ]; then cd $SEM_WORKSPACE/confluent-kafka-python; fi
80+
# use a virtualenv
81+
- python3 -m venv _venv && source _venv/bin/activate
82+
- pip install -r docs/requirements.txt
83+
- pip install -U protobuf
84+
# install librdkafka
85+
- lib_dir=dest/runtimes/$OS_NAME-$ARCH/native
86+
- tools/wheels/install-librdkafka.sh "${LIBRDKAFKA_VERSION#v}" dest
87+
- export CFLAGS="$CFLAGS -I${PWD}/dest/build/native/include"
88+
- export LDFLAGS="$LDFLAGS -L${PWD}/${lib_dir}"
89+
- export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PWD/$lib_dir"
90+
- export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$PWD/$lib_dir"
91+
# install confluent-kafka
92+
- python setup.py build && python setup.py install
93+
- make docs

.travis.yml

Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,17 @@
11
env:
22
global:
3-
- LIBRDKAFKA_VERSION=v1.9.2-RC2
3+
- LIBRDKAFKA_VERSION=v1.9.2-RC3
44

55
jobs:
66
include:
7-
- name: "Source package verification with Python 2.7 (Linux)"
8-
if: false
7+
- name: "Source package verification with Python 3.8 (Linux)"
98
os: linux
109
language: python
1110
dist: xenial
12-
python: "2.7"
13-
env: LD_LIBRARY_PATH="$PWD/tmp-build/lib"
14-
services: docker
15-
16-
- name: "Source package verification with Python 3.6 (Linux)"
17-
os: linux
18-
language: python
19-
dist: xenial
20-
python: "3.6"
11+
python: "3.8"
2112
env: LD_LIBRARY_PATH="$PWD/tmp-build/lib"
2213
services: docker
2314

24-
- name: "Source package verification with Python 2.7 (OSX)"
25-
if: false
26-
os: osx
27-
python: "2.7"
28-
env: DYLD_LIBRARY_PATH="$PWD/tmp-build/lib" INTERPRETER_VERSION="2.7.17"
29-
30-
- name: "Source package verification with Python 3.6 (OSX) +docs"
31-
os: osx
32-
python: "3.6"
33-
env: DYLD_LIBRARY_PATH="$PWD/tmp-build/lib" MK_DOCS="y" INTERPRETER_VERSION="3.6.5"
34-
3515
- name: "Wheels: Windows x64"
3616
if: tag is present
3717
os: windows
@@ -70,19 +50,12 @@ jobs:
7050
env: BUILD_WHEELS=1
7151
script: tools/wheels/build-wheels.sh ${LIBRDKAFKA_VERSION#v} wheelhouse
7252

73-
- name: "Wheels: MacOSX x64"
74-
if: tag is present
75-
os: osx
76-
language: shell
77-
env: BUILD_WHEELS=1
78-
script: tools/wheels/build-wheels.sh ${LIBRDKAFKA_VERSION#v} wheelhouse
79-
80-
81-
# Install test dependencies unconditionally
82-
# Travis OSX envs requires some setup; see tools/prepare-osx.sh
83-
# Install cibuildwheel if this is a tagged PR
84-
before_install:
85-
- if [[ $TRAVIS_OS_NAME == "osx" && $BUILD_WHEELS != 1 ]]; then tools/prepare-osx.sh ${INTERPRETER_VERSION} /tmp/venv && source /tmp/venv/bin/activate; fi
53+
# - name: "Wheels: MacOSX x64"
54+
# if: tag is present
55+
# os: osx
56+
# language: shell
57+
# env: BUILD_WHEELS=1
58+
# script: tools/wheels/build-wheels.sh ${LIBRDKAFKA_VERSION#v} wheelhouse
8659

8760
install:
8861
# Install interceptors

examples/docker/Dockerfile.alpine

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ FROM alpine:3.12
3030

3131
COPY . /usr/src/confluent-kafka-python
3232

33-
ENV LIBRDKAFKA_VERSION v1.9.2-RC2
33+
ENV LIBRDKAFKA_VERSION v1.9.2-RC3
3434
ENV KAFKACAT_VERSION master
3535

3636

tools/prepare-osx.sh

Lines changed: 0 additions & 31 deletions
This file was deleted.

tools/wheels/build-wheels.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ this_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
88

99

1010
# Skip PyPy, Python2, old Python3 versions, musl, and x86 builds.
11-
export CIBW_SKIP="pp* cp27-* cp35-* *i686 *musllinux*"
11+
export CIBW_SKIP="pp* cp27-* cp35-* *i686 *musllinux* $CIBW_SKIP"
1212
# Run a simple test suite
1313
export CIBW_TEST_REQUIRES="-r tests/requirements.txt"
1414
export CIBW_TEST_COMMAND="pytest {project}/tests/test_Producer.py"
@@ -26,19 +26,20 @@ set -ex
2626

2727
[[ -d $wheeldir ]] || mkdir -p "$wheeldir"
2828

29+
ARCH=${ARCH:-x64}
2930

3031
case $OSTYPE in
3132
linux*)
3233
os=linux
3334
# Need to set up env vars (in docker) so that setup.py
3435
# finds librdkafka.
35-
lib_dir=dest/runtimes/linux-x64/native
36+
lib_dir=dest/runtimes/linux-$ARCH/native
3637
export CIBW_ENVIRONMENT="CFLAGS=-I\$PWD/dest/build/native/include LDFLAGS=-L\$PWD/$lib_dir LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$PWD/$lib_dir"
3738
;;
3839
darwin*)
3940
os=macos
4041
# Need to set up env vars so that setup.py finds librdkafka.
41-
lib_dir=dest/runtimes/osx-x64/native
42+
lib_dir=dest/runtimes/osx-$ARCH/native
4243
export CFLAGS="-I${PWD}/dest/build/native/include"
4344
export LDFLAGS="-L${PWD}/$lib_dir"
4445
;;
@@ -51,10 +52,10 @@ esac
5152

5253
$this_dir/install-librdkafka.sh $librdkafka_version dest
5354

54-
install_pkgs=cibuildwheel==2.7.0
55+
install_pkgs=cibuildwheel==2.8.1
5556

56-
python3 -m pip install $install_pkgs ||
57-
pip3 install $install_pkgs
57+
python3 -m pip install ${PIP_INSTALL_OPTS} $install_pkgs ||
58+
pip3 install ${PIP_INSTALL_OPTS} $install_pkgs
5859

5960
if [[ -z $TRAVIS ]]; then
6061
cibw_args="--platform $os"

tools/wheels/install-librdkafka.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,23 @@ curl -L -o lrk$VER.zip https://www.nuget.org/api/v2/package/librdkafka.redist/$V
2323

2424
unzip lrk$VER.zip
2525

26+
ARCH=${ARCH:-x64}
2627

2728
if [[ $OSTYPE == linux* ]]; then
2829
# Linux
2930

3031
# Copy the librdkafka build with least dependencies to librdkafka.so.1
31-
cp -v runtimes/linux-x64/native/{centos6-librdkafka.so,librdkafka.so.1}
32-
ldd runtimes/linux-x64/native/librdkafka.so.1
32+
cp -v runtimes/linux-$ARCH/native/{centos6-librdkafka.so,librdkafka.so.1}
33+
ldd runtimes/linux-$ARCH/native/librdkafka.so.1
3334

3435
elif [[ $OSTYPE == darwin* ]]; then
3536
# MacOS X
3637

3738
# Change the library's self-referencing name from
3839
# /Users/travis/.....somelocation/librdkafka.1.dylib to its local path.
39-
install_name_tool -id $PWD/runtimes/osx-x64/native/librdkafka.dylib runtimes/osx-x64/native/librdkafka.dylib
40+
install_name_tool -id $PWD/runtimes/osx-$ARCH/native/librdkafka.dylib runtimes/osx-$ARCH/native/librdkafka.dylib
4041

41-
otool -L runtimes/osx-x64/native/librdkafka.dylib
42+
otool -L runtimes/osx-$ARCH/native/librdkafka.dylib
4243
fi
4344

4445
popd

0 commit comments

Comments
 (0)