Merge remote-tracking branch 'origin/stable' into gh-actions-multi-php-master

This commit is contained in:
Dylan K. Taylor 2021-01-06 18:32:34 +00:00
commit aadbdb375b
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
2 changed files with 50 additions and 83 deletions

View File

@ -9,7 +9,11 @@ jobs:
build-php:
name: Prepare PHP
runs-on: ubuntu-latest
strategy:
matrix:
php: [7.3.25, 7.4.13]
steps:
- uses: actions/checkout@v2 #needed for build.sh
- name: Check for PHP build cache
@ -17,17 +21,21 @@ jobs:
uses: actions/cache@v2
with:
path: "./bin"
key: "php-build-generic-${{ hashFiles('./tests/gh-actions/build.sh') }}"
key: "php-build-generic-${{ matrix.php }}-${{ hashFiles('./tests/gh-actions/build.sh') }}"
- name: Compile PHP
if: steps.php-build-cache.outputs.cache-hit != 'true'
run: ./tests/gh-actions/build.sh
run: ./tests/gh-actions/build.sh "${{ matrix.php }}"
phpstan:
name: PHPStan analysis
needs: build-php
runs-on: ubuntu-latest
strategy:
matrix:
php: [7.3.25, 7.4.13]
steps:
- uses: actions/checkout@v2
@ -36,7 +44,7 @@ jobs:
uses: actions/cache@v2
with:
path: "./bin"
key: "php-build-generic-${{ hashFiles('./tests/gh-actions/build.sh') }}"
key: "php-build-generic-${{ matrix.php }}-${{ hashFiles('./tests/gh-actions/build.sh') }}"
- name: Kill build on PHP build cache miss (should never happen)
if: steps.php-build-cache.outputs.cache-hit != 'true'
@ -54,7 +62,7 @@ jobs:
path: |
~/.cache/composer/files
~/.cache/composer/vcs
key: "composer-v2-cache-${{ hashFiles('./composer.lock') }}"
key: "composer-v2-cache-${{ matrix.php }}-${{ hashFiles('./composer.lock') }}"
restore-keys: |
composer-v2-cache-
@ -68,6 +76,10 @@ jobs:
name: PHPUnit tests
needs: build-php
runs-on: ubuntu-latest
strategy:
matrix:
php: [7.3.25, 7.4.13]
steps:
- uses: actions/checkout@v2
@ -76,7 +88,7 @@ jobs:
uses: actions/cache@v2
with:
path: "./bin"
key: "php-build-generic-${{ hashFiles('./tests/gh-actions/build.sh') }}"
key: "php-build-generic-${{ matrix.php }}-${{ hashFiles('./tests/gh-actions/build.sh') }}"
- name: Kill build on PHP build cache miss (should never happen)
if: steps.php-build-cache.outputs.cache-hit != 'true'
@ -94,7 +106,7 @@ jobs:
path: |
~/.cache/composer/files
~/.cache/composer/vcs
key: "composer-v2-cache-${{ hashFiles('./composer.lock') }}"
key: "composer-v2-cache-${{ matrix.php }}-${{ hashFiles('./composer.lock') }}"
restore-keys: |
composer-v2-cache-
@ -108,6 +120,10 @@ jobs:
name: Integration tests
needs: build-php
runs-on: ubuntu-latest
strategy:
matrix:
php: [7.3.25, 7.4.13]
steps:
- uses: actions/checkout@v2
with:
@ -118,7 +134,7 @@ jobs:
uses: actions/cache@v2
with:
path: "./bin"
key: "php-build-generic-${{ hashFiles('./tests/gh-actions/build.sh') }}"
key: "php-build-generic-${{ matrix.php }}-${{ hashFiles('./tests/gh-actions/build.sh') }}"
- name: Kill build on PHP build cache miss (should never happen)
if: steps.php-build-cache.outputs.cache-hit != 'true'
@ -136,7 +152,7 @@ jobs:
path: |
~/.cache/composer/files
~/.cache/composer/vcs
key: "composer-v2-cache-${{ hashFiles('./composer.lock') }}"
key: "composer-v2-cache-${{ matrix.php }}-${{ hashFiles('./composer.lock') }}"
restore-keys: |
composer-v2-cache-

View File

@ -1,4 +1,5 @@
VERSION=7.4.13
VERSION="$1"
sudo apt update && sudo apt install -y \
re2c \
libtool \
@ -11,10 +12,11 @@ sudo apt update && sudo apt install -y \
libzip-dev \
libssl-dev
curl -sSL https://www.php.net/distributions/php-$VERSION.tar.gz | tar -xz
INSTALL_DIR="$(pwd)/bin/php7"
export CFLAGS="$CFLAGS -march=x86-64"
export CXXFLAGS="$CXXFLAGS -march=x86-64"
function build_leveldb {
local LEVELDB_VERSION="$1"
echo "Building LevelDB"
@ -39,81 +41,30 @@ function build_leveldb {
}
build_leveldb 84348b9b826cc280cde659185695d2170b54824c
cd php-$VERSION
cd ext/
# 1: extension name
# 2: extension version
# 3: URL to get .tar.gz from
# 4: Name of extracted directory to move
function get_extension_tar_gz {
curl -sSL "$3" | tar -zx
mv "$4" "$1"
}
# 1: extension name
# 2: extension version
# 3: github user name
# 4: github repo name
# 5: version prefix (optional)
function get_github_extension {
get_extension_tar_gz "$1" "$2" "https://github.com/$3/$4/archive/$5$2.tar.gz" "$4-$2"
}
get_github_extension pthreads 2bcd8b8c10395d58b8a9bc013e3a5328080c867f pmmp pthreads
get_github_extension yaml 2.2.0 php pecl-file_formats-yaml
get_github_extension leveldb 2e3f740b55af1eb6dfc648dd451bcb7d6151c26c pmmp php-leveldb
get_github_extension chunkutils2 5a4dcd6ed74e0db2ca9a54948d4f3a065e386db5 pmmp ext-chunkutils2
get_github_extension morton 0.1.2 pmmp ext-morton
get_github_extension igbinary 3.1.4 igbinary igbinary
get_github_extension ds 2ddef84d3e9391c37599cb716592184315e23921 php-ds ext-ds
git clone https://github.com/php-build/php-build.git
cd php-build
./install-dependencies.sh
echo '"pthreads",,"https://github.com/pmmp/pthreads.git",,,"extension",' >> share/php-build/extension/definition
echo '"leveldb",,"https://github.com/pmmp/php-leveldb.git",,"--with-leveldb=\\"$INSTALL_DIR\\","extension",' >> share/php-build/extension/definition
echo '"chunkutils2",,"https://github.com/pmmp/ext-chunkutils2.git",,,"extension",' >> share/php-build/extension/definition
echo '"morton",,"https://github.com/pmmp/ext-morton.git",,,"extension",' >> share/php-build/extension/definition
PHP_BUILD_INSTALL_EXTENSION="\
pthreads=@2bcd8b8c10395d58b8a9bc013e3a5328080c867f \
yaml=2.2.0 \
leveldb=@2e3f740b55af1eb6dfc648dd451bcb7d6151c26c \
chunkutils2=@5a4dcd6ed74e0db2ca9a54948d4f3a065e386db5 \
morton=@0.1.2 \
igbinary=3.1.4 \
ds=1.3.0 \
" PHP_BUILD_ZTS_ENABLE=on PHP_BUILD_CONFIGURE_OPTS='--with-gmp' ./bin/php-build "$VERSION" "$INSTALL_DIR"
rm -rf crypto
git clone --recursive https://github.com/bukka/php-crypto.git crypto
cd crypto
git checkout -qf 5f26ac91b0ba96742cc6284cd00f8db69c3788b2
git submodule update --init --recursive
cd ..
cd ..
CFLAGS="$CFLAGS -march=x86-64"
CXXFLAGS="$CXXFLAGS -march=x86-64"
./buildconf --force
./configure \
--prefix="$INSTALL_DIR" \
--exec-prefix="$INSTALL_DIR" \
--enable-maintainer-zts \
--enable-cli \
--disable-cgi \
--disable-phpdbg \
--disable-mbregex \
--disable-pdo \
--disable-session \
--enable-chunkutils2 \
--enable-ds \
--enable-igbinary \
--enable-mbstring \
--enable-morton \
--enable-pthreads \
--enable-simplexml \
--enable-sockets \
--enable-xml \
--enable-xmlreader \
--enable-xmlwriter \
--with-crypto \
--with-curl \
--with-gmp \
--with-leveldb="$INSTALL_DIR" \
--with-libxml \
--with-openssl \
--with-openssl \
--with-yaml \
--with-zip \
--with-zlib \
--without-pear \
--without-sqlite3
"$INSTALL_DIR/bin/phpize"
./configure --with-php-config="$INSTALL_DIR/bin/php-config"
make -j8 install
echo "extension=crypto.so" >> "$INSTALL_DIR/etc/conf.d/crypto.ini"
cd ..