Merge pull request #135 from scoutapp/add-php-8-3-support #231
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI Build | |
on: | |
push: | |
pull_request: | |
jobs: | |
curl-compilation-test: | |
name: "Curl Compile" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
with_curl_ext: ["yes", "no"] | |
with_libcurl: ["yes", "no"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Build the tester tool | |
run: | | |
docker build \ | |
--build-arg WITH_CURL_EXT=${{ matrix.with_curl_ext }} \ | |
--build-arg WITH_LIBCURL=${{ matrix.with_libcurl }} \ | |
--file .github/test-curl-compilation/Dockerfile \ | |
--tag scoutapm_ext_test \ | |
. | |
- name: Run the tool | |
run: | | |
docker run scoutapm_ext_test > results.txt | |
cat results.txt | |
- name: Check the output | |
run: | | |
diff .github/test-curl-compilation/expected-curlext-${{ matrix.with_curl_ext }}-libcurl-${{ matrix.with_libcurl }}.txt results.txt | |
windows-test: | |
name: "Win PHPT" | |
defaults: | |
run: | |
shell: cmd | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ windows-2019, windows-2022 ] | |
php: [ "8.3", "8.2", "8.1", "8.0", "7.4", "7.3", "7.2", "7.1" ] | |
arch: [ x64, x86 ] | |
ts: [ ts, nts ] | |
exclude: | |
- { os: windows-2019, php: "8.3" } | |
- { os: windows-2019, php: "8.2" } | |
- { os: windows-2019, php: "8.1" } | |
- { os: windows-2019, php: "8.0" } | |
- { os: windows-2019, php: "7.4" } | |
- { os: windows-2019, php: "7.3" } | |
- { os: windows-2022, php: "7.2" } | |
- { os: windows-2022, php: "7.1" } | |
runs-on: ${{matrix.os}} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup PHP SDK | |
id: setup-php | |
uses: php/[email protected] | |
with: | |
version: ${{matrix.php}} | |
arch: ${{matrix.arch}} | |
ts: ${{matrix.ts}} | |
deps: libcurl, sqlite3 | |
- name: Enable Developer Command Prompt | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: ${{matrix.arch}} | |
toolset: ${{steps.setup-php.outputs.toolset}} | |
- name: Enable required extensions | |
run: | | |
cp .github/workflows/windows-php.ini ${{steps.setup-php.outputs.prefix}}/php.ini | |
echo extension_dir="${{steps.setup-php.outputs.prefix}}\ext" >> ${{steps.setup-php.outputs.prefix}}/php.ini | |
dir ${{steps.setup-php.outputs.prefix}}\ext | |
- name: phpize | |
run: phpize | |
- name: configure | |
run: configure --enable-scoutapm --with-prefix=${{steps.setup-php.outputs.prefix}} | |
- name: Zend extension | |
run: sed -i 's/-d extension=/-d zend_extension=/g' Makefile | |
- name: make | |
run: nmake | |
- name: test | |
run: nmake test | |
- name: Copy DLL to a known location | |
if: ${{ github.event_name == 'push' }} | |
run: | | |
cp .github/workflows/get-build-dir.bat . | |
for /F "usebackq tokens=*" %%i in (`get-build-dir.bat`) do set DLL_FILE=%%i\php_scoutapm.dll | |
echo %DLL_FILE% | |
cp %DLL_FILE% . | |
- name: Upload DLL as artifact | |
if: ${{ github.event_name == 'push' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: DLL only ${{github.sha}}-${{matrix.php}}-${{matrix.ts}}-${{matrix.arch}} | |
path: php_scoutapm.dll | |
retention-days: 2 | |
phpt-test: | |
name: "PHPT Tests" | |
services: | |
elasticsearch: | |
image: elasticsearch:8.1.2 | |
env: | |
discovery.type: single-node | |
# Disable TLS which is on by default now: https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html | |
xpack.security.enabled: false | |
xpack.security.enrollment.enabled: false | |
xpack.security.http.ssl.enabled: false | |
xpack.security.transport.ssl.enabled: false | |
ports: | |
- 9200:9200 | |
memcached: | |
image: memcached | |
ports: | |
- 11211:11211 | |
redis: | |
image: redis | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 6379:6379 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-20.04 | |
- ubuntu-22.04 | |
php-version: | |
- 7.1.9 | |
- 7.1.33 | |
- 7.2.0 | |
- 7.2.34 | |
- 7.3.0 | |
- 7.3.33 | |
- 7.4.0 | |
- 7.4.33 | |
- 8.0.0 | |
- 8.0.30 | |
- 8.1.0 | |
- 8.1.24 | |
- 8.2.0 | |
- 8.2.11 | |
- 8.3.0 | |
zts-mode: | |
- zts | |
- nts | |
php-options: | |
- "--with-curl" | |
- "" | |
exclude: | |
- { os: ubuntu-22.04, php-version: 7.1.9 } | |
- { os: ubuntu-22.04, php-version: 7.1.33 } | |
- { os: ubuntu-22.04, php-version: 7.2.0 } | |
- { os: ubuntu-22.04, php-version: 7.2.34 } | |
- { os: ubuntu-22.04, php-version: 7.3.0 } | |
- { os: ubuntu-22.04, php-version: 7.3.33 } | |
- { os: ubuntu-22.04, php-version: 7.4.0 } | |
- { os: ubuntu-22.04, php-version: 7.4.33 } | |
- { os: ubuntu-22.04, php-version: 8.0.0 } | |
- { os: ubuntu-22.04, php-version: 8.0.30 } | |
steps: | |
- name: "Purge built-in PHP version" | |
run: | | |
echo "libmemcached11 php* hhvm libhashkit2" | xargs -n 1 sudo apt-get purge --assume-yes || true | |
sudo apt-add-repository --remove ppa:ondrej/php -y | |
sudo apt-get update | |
- uses: actions/checkout@v3 | |
- name: "Set ZTS mode, PHP 8+" | |
if: ${{ matrix.zts-mode == 'zts' && startsWith(matrix.php-version, '8.') }} | |
run: echo "zts_flag=--enable-zts" >> $GITHUB_ENV | |
- name: "Set ZTS mode, PHP 7" | |
if: ${{ matrix.zts-mode == 'zts' && startsWith(matrix.php-version, '7.') }} | |
run: echo "zts_flag=--enable-maintainer-zts" >> $GITHUB_ENV | |
- name: "Set NTS mode" | |
if: ${{ matrix.zts-mode == 'nts' }} | |
run: echo "zts_flag=" >> $GITHUB_ENV | |
- name: "Set php-src download URL" | |
run: echo "php_src_download_url=https://www.php.net/distributions/php-${{ matrix.php-version }}.tar.gz" >> $GITHUB_ENV | |
- name: "Install PHP ${{ matrix.php-version }} (${{ env.zts_flag}} ${{ matrix.php-options }})" | |
run: | | |
sudo DEBIAN_FRONTEND=noninteractive apt-get update | |
sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install software-properties-common build-essential autoconf libxml2-dev libsqlite3-dev libcurl4-openssl-dev re2c | |
mkdir -p /tmp/php | |
cd /tmp/php | |
echo "Downloading release from ${{ env.php_src_download_url }} ..." | |
wget -O php.tgz ${{ env.php_src_download_url }} | |
tar zxf php.tgz | |
rm php.tgz | |
ls -l | |
cd * | |
ls -l | |
./buildconf --force | |
./configure --with-pear --enable-debug --with-openssl ${{ env.zts_flag }} ${{ matrix.php-options }} | |
make -j$(nproc) | |
sudo make install | |
cd $GITHUB_WORKSPACE | |
- name: "Update PEAR/PECL channels" | |
run: | | |
sudo pear update-channels | |
sudo pecl update-channels | |
- name: "Install Redis extension (PHP 7.1)" | |
if: ${{ startsWith(matrix.php-version, '7.1.') }} | |
run: | | |
echo '' | sudo pecl install redis-5.3.7 | |
- name: "Install Redis extension (PHP 7.2+)" | |
if: ${{ startsWith(matrix.php-version, '7.1.') != true }} | |
run: | | |
echo '' | sudo pecl install redis | |
- name: "Install Memcached extension" | |
run: | | |
sudo apt-get install libmemcached-dev | |
echo '' | sudo pecl install memcached | |
- name: "Base PHP configuration dump (information)" | |
run: php -i | |
- name: "Build scoutapm extension" | |
run: | | |
phpize | |
./configure --enable-scoutapm --enable-scoutapm-dev | |
make | |
- name: "Run the tests" | |
run: | | |
php run-tests.php -p `which php` -d zend_extension=`pwd`/modules/scoutapm.so -d extension=memcached.so -d extension=redis.so -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --offline --show-diff --set-timeout 120 -q | |
- name: "Run the benchmark" | |
run: | | |
sudo apt update && sudo apt install time | |
./benchmark.sh | |
./benchmark.sh -w | |
check-pecl-valid: | |
name: "Check PECL Package validity" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-version: | |
- "8.2" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup PHP with PECL extension | |
uses: shivammathur/setup-php@v2 | |
with: | |
coverage: "none" | |
php-version: "${{ matrix.php-version }}" | |
tools: pecl | |
- name: "Validate PECL Package" | |
run: pecl package-validate | |
- name: "Verify PECL Package Build" | |
run: pecl package |