Skip to content

Commit

Permalink
Test on i386
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaud-lb committed Jan 1, 2022
1 parent dcbfa22 commit 858949c
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 5 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ jobs:
expect_native: 1
werror: 1

- php: '8.1.0'
os: 'ubuntu-20.04'
expect_native: 1
werror: 1
arch: i386

- php: '8.0.0'
os: 'ubuntu-20.04'
expect_native: 1
Expand All @@ -42,6 +48,7 @@ jobs:
MEMORY_CHECK: ${{ matrix.memcheck }}
WERROR: ${{ matrix.werror }}
MEMPROF_EXPECT_NATIVE_TRACKING: ${{ matrix.expect_native }}
BUILD_ARCH: ${{ matrix.arch || 'amd64' }}
steps:
- name: 'Check out repository'
uses: 'actions/checkout@v2'
Expand All @@ -51,7 +58,10 @@ 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 }}

- name: 'Setup'
run: './ext/.github/workflows/test/setup.sh'

- name: 'Build PHP'
run: './ext/.github/workflows/test/build-php.sh'
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/test/build-extension.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ echo "Building extension with PHP version:"
php --version

if which apt-get >/dev/null 2>&1; then
sudo apt-get -y install libjudy-dev
sudo apt-get -y install libjudy-dev:$BUILD_ARCH
else
brew install traildb/judy/judy
fi
Expand All @@ -18,6 +18,12 @@ if [ "$WERROR" = "1" ]; then
PHP_EXT_CFLAGS="-Wall -Werror -Wno-deprecated-declarations"
fi

case "$BUILD_ARCH" in
i386)
PHP_EXT_CFLAGS="$PHP_EXT_CFLAGS -m32"
;;
esac

cd ext
phpize
CFLAGS="$PHP_EXT_CFLAGS" ./configure
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/test/build-php.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if ! [ -f "$HOME/build-cache/php/$PREFIX/bin/php" ]; then
git clone --depth 1 --branch "$PHP_TAG" https://github.com/php/php-src.git
cd php-src

sudo apt-get -y install re2c
sudo apt-get -y install re2c:$BUILD_ARCH zlib1g-dev:$BUILD_ARCH
fi

if ! [ -f "configure" ]; then
Expand All @@ -36,7 +36,15 @@ if ! [ -f "$HOME/build-cache/php/$PREFIX/bin/php" ]; then
PHP_BUILD_FLAGS="$PHP_BUILD_FLAGS --with-valgrind"
fi

./configure $PHP_BUILD_FLAGS $PHP_BUILD_EXTRA_FLAGS
case "$BUILD_ARCH" in
i386)
PHP_BUILD_CFLAGS="$PHP_BUILD_CFLAGS -m32"
PHP_BUILD_ASFLAGS="$PHP_BUILD_ASFLAGS -m32"
PHP_BUILD_FLAGS="$PHP_BUILD_FLAGS --host=$BUILD_ARCH"
;;
esac

ASFLAGS="$PHP_BUILD_ASFLAGS=" CFLAGS="$PHP_BUILD_CFLAGS" ./configure $PHP_BUILD_FLAGS
make -j $(nproc)
rm -rf "$HOME/build-cache/php"
mkdir -p ~/build-cache/php
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/test/build-xdebug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ git clone --depth 1 --branch "3.1.2" "https://github.com/xdebug/xdebug.git"

cd xdebug

case "$BUILD_ARCH" in
i386)
PHP_EXT_CFLAGS="$PHP_EXT_CFLAGS -m32"
;;
esac

phpize
./configure
CFLAGS="$PHP_EXT_CFLAGS" ./configure
make
sudo make install
12 changes: 12 additions & 0 deletions .github/workflows/test/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

set -ex

case "$BUILD_ARCH" in
i386)
echo "Setup $BUILD_ARCH architecture"
sudo dpkg --add-architecture "$BUILD_ARCH"
sudo apt-get update
sudo apt-get install gcc-multilib
;;
esac

0 comments on commit 858949c

Please sign in to comment.