Skip to content

Commit 858949c

Browse files
committed
Test on i386
1 parent dcbfa22 commit 858949c

File tree

5 files changed

+47
-5
lines changed

5 files changed

+47
-5
lines changed

.github/workflows/test.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ jobs:
1919
expect_native: 1
2020
werror: 1
2121

22+
- php: '8.1.0'
23+
os: 'ubuntu-20.04'
24+
expect_native: 1
25+
werror: 1
26+
arch: i386
27+
2228
- php: '8.0.0'
2329
os: 'ubuntu-20.04'
2430
expect_native: 1
@@ -42,6 +48,7 @@ jobs:
4248
MEMORY_CHECK: ${{ matrix.memcheck }}
4349
WERROR: ${{ matrix.werror }}
4450
MEMPROF_EXPECT_NATIVE_TRACKING: ${{ matrix.expect_native }}
51+
BUILD_ARCH: ${{ matrix.arch || 'amd64' }}
4552
steps:
4653
- name: 'Check out repository'
4754
uses: 'actions/checkout@v2'
@@ -51,7 +58,10 @@ jobs:
5158
- uses: actions/cache@v2
5259
with:
5360
path: ~/build-cache/php
54-
key: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.memcheck }}
61+
key: ${{ runner.os }}-${{matrix.arch}}-${{ matrix.php }}-${{ matrix.memcheck }}
62+
63+
- name: 'Setup'
64+
run: './ext/.github/workflows/test/setup.sh'
5565

5666
- name: 'Build PHP'
5767
run: './ext/.github/workflows/test/build-php.sh'

.github/workflows/test/build-extension.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ echo "Building extension with PHP version:"
99
php --version
1010

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

21+
case "$BUILD_ARCH" in
22+
i386)
23+
PHP_EXT_CFLAGS="$PHP_EXT_CFLAGS -m32"
24+
;;
25+
esac
26+
2127
cd ext
2228
phpize
2329
CFLAGS="$PHP_EXT_CFLAGS" ./configure

.github/workflows/test/build-php.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ if ! [ -f "$HOME/build-cache/php/$PREFIX/bin/php" ]; then
2323
git clone --depth 1 --branch "$PHP_TAG" https://github.com/php/php-src.git
2424
cd php-src
2525

26-
sudo apt-get -y install re2c
26+
sudo apt-get -y install re2c:$BUILD_ARCH zlib1g-dev:$BUILD_ARCH
2727
fi
2828

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

39-
./configure $PHP_BUILD_FLAGS $PHP_BUILD_EXTRA_FLAGS
39+
case "$BUILD_ARCH" in
40+
i386)
41+
PHP_BUILD_CFLAGS="$PHP_BUILD_CFLAGS -m32"
42+
PHP_BUILD_ASFLAGS="$PHP_BUILD_ASFLAGS -m32"
43+
PHP_BUILD_FLAGS="$PHP_BUILD_FLAGS --host=$BUILD_ARCH"
44+
;;
45+
esac
46+
47+
ASFLAGS="$PHP_BUILD_ASFLAGS=" CFLAGS="$PHP_BUILD_CFLAGS" ./configure $PHP_BUILD_FLAGS
4048
make -j $(nproc)
4149
rm -rf "$HOME/build-cache/php"
4250
mkdir -p ~/build-cache/php

.github/workflows/test/build-xdebug.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ git clone --depth 1 --branch "3.1.2" "https://github.com/xdebug/xdebug.git"
99

1010
cd xdebug
1111

12+
case "$BUILD_ARCH" in
13+
i386)
14+
PHP_EXT_CFLAGS="$PHP_EXT_CFLAGS -m32"
15+
;;
16+
esac
17+
1218
phpize
13-
./configure
19+
CFLAGS="$PHP_EXT_CFLAGS" ./configure
1420
make
1521
sudo make install

.github/workflows/test/setup.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
3+
set -ex
4+
5+
case "$BUILD_ARCH" in
6+
i386)
7+
echo "Setup $BUILD_ARCH architecture"
8+
sudo dpkg --add-architecture "$BUILD_ARCH"
9+
sudo apt-get update
10+
sudo apt-get install gcc-multilib
11+
;;
12+
esac

0 commit comments

Comments
 (0)