Skip to content

Commit

Permalink
Add X32 CI build
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaud-lb committed Oct 25, 2024
1 parent 6c1a72c commit dca3f43
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 9 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,27 @@ jobs:
strategy:
fail-fast: false
matrix:
arch: ['X64']
include:
# Latest librdkafka 2.x with memcheck
- php: '8.3.0'
librdkafka: 'v1.9.2'
memcheck: '1'
werror: 'werror'
- php: '8.2.0'
librdkafka: 'v1.9.2'
memcheck: '1'
- php: '8.1.0'
librdkafka: 'v1.9.2'
memcheck: '1'

# X32
- php: '8.3.0'
librdkafka: 'v2.6.0'
memcheck: '1'
arch: 'X32'
werror: 'werror'

# Latest librdkafka 1.x with memcheck
- php: '8.3.0'
librdkafka: 'v1.9.2'
Expand Down Expand Up @@ -172,6 +181,8 @@ jobs:
SKIP_OAUTH: ${{ matrix.skipoauth }}
TEST_KAFKA_BROKERS: kafka:9092
TEST_KAFKA_BROKER_VERSION: 2.6
ARCH: ${{ matrix.arch }}
WERROR: ${{ matric.werror }}
steps:
- name: 'Check out repository'
uses: 'actions/checkout@v2'
Expand All @@ -181,12 +192,15 @@ jobs:
- uses: actions/cache@v2
with:
path: ~/build-cache/php
key: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.memcheck }}
key: ${{ runner.os }}-${{ matrix.arch }}-${{ matrix.php }}-${{ matrix.memcheck }}

- uses: actions/cache@v2
with:
path: ~/build-cache/librdkafka
key: ${{ runner.os }}-${{ matrix.librdkafka }}
key: ${{ runner.os }}-${{ matrix.arch }}-${{ matrix.librdkafka }}

- name: 'Install dependencies'
run: './php-rdkafka/.github/workflows/test/install-dependencies.sh'

- name: 'Build librdkafka'
run: './php-rdkafka/.github/workflows/test/build-librdkafka.sh'
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/test/build-librdkafka.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,18 @@ if ! [ -f ~/build-cache/librdkafka/usr/local/include/librdkafka/rdkafka.h ] || !

git clone --depth 1 --branch "${LIBRDKAFKA_VERSION:-v2.3.0}" "${LIBRDKAFKA_REPOSITORY_URL:-https://github.com/edenhill/librdkafka.git}"

LIBRDKAFKA_BUILD_FLAGS=

if [ "$ARCH" = "X32" ]; then
export CC="${CC:-gcc} -m32"
export CFLAGS="$CFLAGS -m32"
export CXXFLAGS="$CXXFLAGS -m32"
export LDFLAGS="$LDFLAGS -m32"
LIBRDKAFKA_BUILD_FLAGS="$LIBRDKAFKA_BUILD_FLAGS --build=i686-pc-linux-gnu"
fi

cd librdkafka
./configure
./configure $LIBRDKAFKA_BUILD_FLAGS
make
mkdir -p ~/build-cache/librdkafka
sudo make install DESTDIR=$HOME/build-cache/librdkafka
Expand Down
18 changes: 14 additions & 4 deletions .github/workflows/test/build-php.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

set -ex

if [ $MEMORY_CHECK -eq 1 ]; then
sudo apt-get -y install valgrind
fi

if ! [ -f ~/build-cache/php/usr/local/bin/php ]; then
echo "PHP build is not cached"

Expand All @@ -29,6 +25,20 @@ if ! [ -f ~/build-cache/php/usr/local/bin/php ]; then
esac
fi

export CFLAGS="$CFLAGS -Wall -Wno-deprecated-declarations"

if [ -n "$WERROR" ]; then
export CFLAGS="$CFLAGS -Werror"
fi

if [ "$ARCH" = "X32" ]; then
export CC="${CC:-gcc} -m32"
export CFLAGS="$CFLAGS -m32"
export CXXFLAGS="$CXXFLAGS -m32"
export LDFLAGS="$LDFLAGS -m32"
PHP_BUILD_FLAGS="$PHP_BUILD_FLAGS --build=i686-pc-linux-gnu"
fi

./configure $PHP_BUILD_FLAGS $PHP_BUILD_EXTRA_FLAGS
make -j $(nproc)
mkdir -p ~/build-cache/php
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/test/install-dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

set -ex

export DEBIAN_FRONTEND=noninteractive

DEPS="zlib1g-dev"

if [ "$ARCH" = "X32" ]; then
sudo dpkg --add-architecture i386
sudo apt-get update
DEPS="$DEPS gcc-multilib g++-multilib zlib1g-dev:i686"
fi

if [ "$MEMORY_CHECK" = "1" ]; then
DEPS="$DEPS valgrind"
fi

if [ -n "$DEPS" ]; then
sudo apt-get -y install $DEPS
fi
4 changes: 2 additions & 2 deletions conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ static void kafka_conf_log_cb(const rd_kafka_t *rk, int level, const char *facil
zval_ptr_dtor(&args[3]);
}

#ifdef HAS_RD_KAFKA_OAUTHBEARER
/*
void rd_kafka_conf_set_oauthbearer_token_refresh_cb(
rd_kafka_conf_t *conf,
Expand Down Expand Up @@ -371,8 +372,7 @@ static void kafka_conf_set_oauthbearer_token_refresh_cb(rd_kafka_t *rk, const ch
zval_ptr_dtor(&args[0]);
zval_ptr_dtor(&args[1]);
}


#endif

/* {{{ proto RdKafka\Conf::__construct() */
PHP_METHOD(RdKafka_Conf, __construct)
Expand Down

0 comments on commit dca3f43

Please sign in to comment.