Attempt for 2.2.2 (because header again) #139
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: Build and Test | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
# XXX: macOS | |
ubuntu: | |
strategy: | |
matrix: | |
version: ['7.3.', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] | |
runs-on: ubuntu-latest | |
services: | |
ibm_db2: | |
image: "icr.io/db2_community/db2:11.5.8.0" | |
env: | |
DB2INST1_PASSWORD: "password" | |
LICENSE: "accept" | |
DBNAME: "sample" | |
options: "--privileged=true" | |
ports: | |
- "60000:50000" | |
volumes: | |
- database:/database | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Cache DB2 library | |
id: cache-clidriver | |
uses: actions/cache@v2 | |
with: | |
path: clidriver | |
key: ${{ runner.os }}-clidriver | |
- name: Install DB2 library | |
if: steps.cache-clidriver.outputs.cache-hit != 'true' | |
run: | | |
wget https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/linuxx64_odbc_cli.tar.gz | |
tar xvzf linuxx64_odbc_cli.tar.gz | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{matrix.version}} | |
- name: Verify headers | |
if: "${{ matrix.version >= '8.0' }}" | |
run: | | |
wget https://github.com/nikic/PHP-Parser/archive/refs/tags/v4.15.1.tar.gz | |
tar xvzf v4.15.1.tar.gz | |
rm v4.15.1.tar.gz | |
wget https://raw.githubusercontent.com/php/php-src/php-8.2.3/build/gen_stub.php | |
HEADERS_IN_SYNC=$(php gen_stub.php .) | |
if [[ ! -z $HEADERS_IN_SYNC ]]; then | |
echo 'Headers are not in sync with "ibm_db2.stub.php".' && exit 1; | |
else | |
echo 'Headers are in sync with "ibm_db2.stub.php".' | |
fi; | |
- name: phpize | |
run: phpize | |
- name: configure | |
run: ./configure --with-IBM_DB2=$PWD/clidriver | |
- name: make | |
run: make V=1 | |
- name: Set up Db2 LUW in Docker | |
run: | | |
set -x | |
cat <<EOF > db2cli.ini | |
[SAMPLE] | |
Hostname=localhost | |
Protocol=TCPIP | |
Port=60000 | |
Database=sample | |
EOF | |
mkdir database | |
- name: "Perform healthcheck on db2 service" | |
run: "docker logs -f ${{ job.services.ibm_db2.id }} | sed '/(*) Setup has completed./ q'" | |
- name: Tests | |
# make test is insufficient to load PDO | |
# Most of these are either cribbed from the old Travis configuration, | |
# or required for the tests to use the DSN. | |
# Note that connection.inc defaults should be mostly sufficient. | |
run: | | |
export TEST_PHP_ARGS="-n -d extension=modules/ibm_db2.so" | |
export DISABLE_SKIP_CACHE=1 | |
export IBM_DB2_TEST_SKIP_CONNECT_FAILURE=0 | |
export DB2CLIINIPATH=$PWD | |
export REPORT_EXIT_STATUS=1 | |
php run-tests.php -P --show-diff tests | |
- name: Verify package | |
run: pecl package-validate | |
- name: Verify XML and header version are in sync | |
# pecl.php.org runs a similar test, but pecl package-validate doesn't, | |
# reinvent the wheel here | |
run: | | |
XML_VERSION=$(pecl info package.xml | perl -ne "m/^Release Version *([\\.0-9a-z]*) .*$/ && print \"\$1\\n\"" -) | |
echo "package.xml version is \"$XML_VERSION\"" | |
HEADER_VERSION=$(perl -ne "m/^#define.*PHP_IBM_DB2_VERSION.*\"(.*)\"$/ && print \"\$1\\n\"" php_ibm_db2.h) | |
echo "php_ibm_db2.h version is \"$HEADER_VERSION\"" | |
test "$HEADER_VERSION" = "$XML_VERSION" | |
windows: | |
defaults: | |
run: | |
shell: cmd | |
strategy: | |
matrix: | |
version: ["8.1", "8.2", "8.3", "8.4"] | |
arch: [x64] | |
ts: [ts] | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Cache DB2 library | |
id: cache-clidriver | |
uses: actions/cache@v2 | |
with: | |
path: clidriver | |
key: ${{ runner.os }}-clidriver | |
- name: Install DB2 library | |
if: steps.cache-clidriver.outputs.cache-hit != 'true' | |
shell: pwsh | |
run: | | |
Invoke-WebRequest -Uri 'https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/ntx64_odbc_cli.zip' -OutFile 'ntx64_odbc_cli.zip' | |
Expand-Archive 'ntx64_odbc_cli.zip' -DestinationPath '.\' | |
- name: Setup PHP | |
id: setup-php | |
uses: php/[email protected] | |
with: | |
version: ${{matrix.version}} | |
arch: ${{matrix.arch}} | |
ts: ${{matrix.ts}} | |
- name: Enable Developer Command Prompt | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: ${{matrix.arch}} | |
toolset: ${{steps.setup-php.outputs.toolset}} | |
- name: phpize | |
run: phpize | |
- name: configure | |
run: configure --with-ibm_db2=%cd%\clidriver --with-prefix=${{steps.setup-php.outputs.prefix}} | |
- name: make | |
run: nmake | |
# XXX: Can we run Docker containers in a Windows runner? That'll be required for tests | |
#- name: test | |
# run: nmake test TESTS=tests |