-
Notifications
You must be signed in to change notification settings - Fork 27
146 lines (146 loc) · 5.02 KB
/
ci.yml
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
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