1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
#!/bin/bash
set -eu # Exit on error and treat unset variables as errors
cd "$WORK_DIR"
# Ensure the PHP version is provided
if [ -z "${PHP_VERSION:-}" ]; then
echo "Error: PHP version not specified. Make sure to pass it as an environment variable."
exit 1
fi
export DEBIAN_FRONTEND=noninteractive
apt-get update -y
# general dependencies
apt-get install -y sudo software-properties-common wget curl git python3 python3-pip
sudo ln -s /usr/bin/python3 /usr/bin/python
# for pre-installed software see
# https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md
# both swig and php are included, so removed these
sudo apt-get -qq remove "php*-cli" "php*-dev"
sudo apt-get -qq remove "swig*"
# https://github.com/oerdnj/deb.sury.org/issues/56
add-apt-repository ppa:ondrej/php -y
LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php -y
sudo apt-get -qq update
sudo apt-get -qq install php"${PHP_VERSION}"-cli php"${PHP_VERSION}"-dev php"${PHP_VERSION}"-mbstring php"${PHP_VERSION}"-xml php"${PHP_VERSION}"-pcov
# install build dependencies
ci/ubuntu/setup.sh
# build the project
export CC="ccache gcc"
export CXX="ccache g++"
make cmakebuild_mapscript_php
echo "PHP includes"
php-config --includes
cd "$WORK_DIR"
make php-testcase
echo "Done!"
|