Skip to content

Commit 1393fde

Browse files
committed
Test on i386
1 parent dcbfa22 commit 1393fde

File tree

5 files changed

+52
-6
lines changed

5 files changed

+52
-6
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-18.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: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22

33
set -ex
44

5+
if which apt-get >/dev/null 2>&1; then
6+
sudo apt-get -y install zlib1g-dev:$BUILD_ARCH
7+
fi
8+
59
if [ "$MEMORY_CHECK" = "1" ]; then
610
if which apt-get >/dev/null 2>&1; then
7-
sudo apt-get -y install valgrind
11+
sudo apt-get -y install valgrind:$BUILD_ARCH
812
else
9-
break install valgrind
13+
brew install valgrind
1014
fi
1115
fi
1216

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

39-
./configure $PHP_BUILD_FLAGS $PHP_BUILD_EXTRA_FLAGS
43+
case "$BUILD_ARCH" in
44+
i386)
45+
PHP_BUILD_CFLAGS="$PHP_BUILD_CFLAGS -m32"
46+
PHP_BUILD_ASFLAGS="$PHP_BUILD_ASFLAGS -m32"
47+
PHP_BUILD_FLAGS="$PHP_BUILD_FLAGS --host=$BUILD_ARCH"
48+
;;
49+
esac
50+
51+
ASFLAGS="$PHP_BUILD_ASFLAGS=" CFLAGS="$PHP_BUILD_CFLAGS" ./configure $PHP_BUILD_FLAGS
4052
make -j $(nproc)
4153
rm -rf "$HOME/build-cache/php"
4254
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)