Skip to content

tests for latest PHP #42

tests for latest PHP

tests for latest PHP #42

Workflow file for this run

name: tests for latest PHP
on:
# push:
# pull_request:
workflow_dispatch:
schedule:
# upstream shivammathur/php-builder* run at 23:30+0000 per day
- cron: '42 3 * * *'
env:
SWOW_HAVE_SSL: 1
SWOW_HAVE_CURL: 1
jobs:
linux-tests:
name: PHP latest Test on ubuntu-latest
runs-on: "ubuntu-latest"
services:
postgres:
image: postgres
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup extension dependencies
run: |
sudo apt-get update
sudo apt-get install -yqq libcurl4-openssl-dev
- name: Setup PHP
uses: shivammathur/setup-php@master
with:
php-version: '8.4'
tools: phpize
# ini-values: pcov.directory=lib
# coverage: pcov
coverage: none
extensions: curl,openssl,sockets,ffi,pdo,pdo_pgsql
- name: Setup composer dependencies
run: composer update -o --ignore-platform-reqs
- name: Build Swow extension
run: |
cd ext
printf "\033[1mRun phpize\033[0m\n"
phpize
printf "\033[1mStart configure\033[0m\n"
./configure --enable-swow\
--enable-swow-debug \
--enable-swow-ssl \
--enable-swow-curl \
--enable-swow-pdo-pgsql
printf "\033[1mStart build Swow\033[0m\n"
make -j`nproc`
printf "\033[1mDone build Swow\033[0m\n"
php -d extension=.libs/swow.so --ri swow
printf "\033[1mInstall Swow\033[0m\n"
sudo make install-modules
- name: Run extension tests
id: test-extension
continue-on-error: true
run: |
TEST_SWOW_POSTGRESQL=1 composer test-extension
- name: Run library tests
id: test-library
continue-on-error: true
run: composer test-library
- name: Fail if test-extension failed
if: steps.test-extension.outcome != 'success'
run: exit 1
- name: Fail if test-library failed
if: steps.test-library.outcome != 'success'
run: exit 1
macos-tests:
name: PHP latest Test on macos-latest
runs-on: "macos-latest"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup extension dependencies
run: |
brew install pkg-config
brew install openssl@3
brew install curl
brew install libpq postgresql
initdb --locale=C -E UTF-8 -U postgres "$HOME/pgsqldata"
pg_ctl -D "$HOME/pgsqldata" start
- name: Setup PHP
uses: shivammathur/setup-php@master
with:
php-version: '8.4'
tools: phpize
# ini-values: pcov.directory=lib
# coverage: pcov
coverage: none
extensions: curl,openssl,sockets,ffi,pdo,pdo_pgsql
- name: Setup composer dependencies
run: composer update -o --ignore-platform-reqs
- name: Detect dependencies path from php-config
run: |
echo "OPENSSL_ROOT_DIR=$(php .github/workflows/detect-deps.php openssl)" >> $GITHUB_ENV
echo "CURL_ROOT_DIR=$(php .github/workflows/detect-deps.php curl)" >> $GITHUB_ENV
echo "PGSQL_ROOT_DIR=$(php .github/workflows/detect-deps.php libpq)" >> $GITHUB_ENV
- name: Build Swow extension
env:
CFLAGS: -I${{ env.OPENSSL_ROOT_DIR }}/include ${{ env.CFLAGS }}
CPPFLAGS: -I${{ env.OPENSSL_ROOT_DIR }}/include ${{ env.CPPFLAGS }}
LDFLAGS: -L${{ env.OPENSSL_ROOT_DIR }}/lib ${{ env.LDFLAGS }}
PKG_CONFIG_PATH: ${{ env.OPENSSL_ROOT_DIR }}/lib/pkgconfig:${{ env.PKG_CONFIG_PATH }}
run: |
cd ext
printf "\033[1mRun phpize\033[0m\n"
phpize
printf "\033[1mStart configure\033[0m\n"
./configure --enable-swow\
--enable-swow-debug \
--enable-swow-ssl=${{ env.OPENSSL_ROOT_DIR }} \
--enable-swow-curl=${{ env.CURL_ROOT_DIR }} \
--enable-swow-pdo-pgsql=${{ env.PGSQL_ROOT_DIR }}
printf "\033[1mStart build Swow\033[0m\n"
make -j`sysctl -n hw.logicalcpu`
printf "\033[1mDone build Swow\033[0m\n"
php -d extension=.libs/swow.so --ri swow
printf "\033[1mInstall Swow\033[0m\n"
make install-modules
- name: Run extension tests
id: test-extension
continue-on-error: true
run: |
TEST_SWOW_POSTGRESQL=1 composer test-extension
- name: Run library tests
id: test-library
continue-on-error: true
run: composer test-library
- name: Fail if test-extension failed
if: steps.test-extension.outcome != 'success'
run: exit 1
- name: Fail if test-library failed
if: steps.test-library.outcome != 'success'
run: exit 1
windows-tests:
name: PHP latest ${{ matrix.ts }} Test on Windows
runs-on: "${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
os: ['windows-2019']
ts: [ 'nts', 'ts' ]
max-parallel: 2
steps:
- name: Checkout
uses: actions/checkout@v4
# TODO: windows varient of setup-php seems to be so slow
# shell we add caches?
- name: Setup PHP
uses: shivammathur/setup-php@master
with:
php-version: '8.4'
# ini-values: pcov.directory=lib
# coverage: pcov
coverage: none
extensions: curl,openssl,pdo,pdo_pgsql
env:
phpts: ${{ matrix.ts }}
- name: Build Swow extension
uses: ./.github/workflows/winext
with:
phpver: '8.4'
phpts: ${{ matrix.ts == 'ts' && '1' || '0' }}
ext-path: ./ext
tools-path: C:\tools\phpdev
conf-args: --enable-swow-debug --enable-swow-ssl --enable-swow-curl --enable-swow-pdo-pgsql
ext-name: swow
staging-deps: '1'
deps: openssl,libcurl,libssh2,zlib,nghttp2,libpq
- name: Setup composer dependencies
run: composer update -o --ignore-platform-reqs
- name: Run extension tests
shell: pwsh
id: test-extension
continue-on-error: true
run: |
& "${env:PGBIN}\initdb.exe" --locale=C -E UTF-8 -U postgres "C:\pgsqldata"
& "${env:PGBIN}\pg_ctl.exe" -D "C:\pgsqldata" start
${env:TEST_SWOW_POSTGRESQL} = "1"
composer test-extension
- name: Run library tests
shell: cmd
id: test-library
continue-on-error: true
run: composer test-library
- name: Fail if test-extension failed
if: steps.test-extension.outcome != 'success'
run: exit 1
- name: Fail if test-library failed
if: steps.test-library.outcome != 'success'
run: exit 1