Skip to content

Commit ffd7598

Browse files
shivammathurmvorisekcmb69
authored
Add CI workflow (#16)
Co-authored-by: Michael Voříšek <[email protected]> Co-authored-by: Christoph M. Becker <[email protected]>
1 parent 232c428 commit ffd7598

File tree

4 files changed

+181
-3
lines changed

4 files changed

+181
-3
lines changed

.github/workflows/ci.yml

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
linux:
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
include:
16+
- version: 8.3
17+
branch: PHP-8.3
18+
- version: 8.4
19+
branch: PHP-8.4
20+
- version: 8.5
21+
branch: master
22+
services:
23+
oracle-11:
24+
image: wnameless/oracle-xe-11g-r2
25+
ports:
26+
- 1511:1521
27+
env:
28+
ORACLE_ALLOW_REMOTE: true
29+
oracle-18:
30+
image: gvenzl/oracle-xe:18-slim-faststart
31+
ports:
32+
- 1518:1521
33+
env:
34+
ORACLE_PASSWORD: my_pass_18
35+
options: >-
36+
--health-cmd healthcheck.sh
37+
--health-interval 10s
38+
--health-timeout 5s
39+
--health-retries 10
40+
oracle-21:
41+
image: gvenzl/oracle-xe:21-slim-faststart
42+
ports:
43+
- 1521:1521
44+
env:
45+
ORACLE_PASSWORD: my_pass_21
46+
options: >-
47+
--health-cmd healthcheck.sh
48+
--health-interval 10s
49+
--health-timeout 5s
50+
--health-retries 10
51+
oracle-23:
52+
image: gvenzl/oracle-free:23-slim
53+
ports:
54+
- 1523:1521
55+
env:
56+
ORACLE_PASSWORD: my_pass_23
57+
options: >-
58+
--health-cmd healthcheck.sh
59+
--health-interval 10s
60+
--health-timeout 5s
61+
--health-retries 10
62+
runs-on: ubuntu-latest
63+
steps:
64+
- name: Setup dependencies
65+
run: |
66+
mkdir -p /opt/oracle
67+
for pkg in sdk basiclite; do
68+
curl --no-progress-meter -O https://download.oracle.com/otn_software/linux/instantclient/instantclient-$pkg-linuxx64.zip
69+
unzip -q -o instantclient-$pkg-linuxx64.zip -d /opt/oracle
70+
done
71+
mv /opt/oracle/instantclient_* /opt/oracle/instantclient
72+
sudo ln -sf /opt/oracle/instantclient/*.so* /usr/lib
73+
sudo apt-get -q update && sudo apt-get install libaio-dev -y
74+
sudo ln -sf /usr/lib/x86_64-linux-gnu/libaio.so.1t64 /usr/lib/x86_64-linux-gnu/libaio.so.1 >/dev/null 2>&1 || true
75+
# fix debug build warning: zend_signal: handler was replaced for signal (2) after startup
76+
echo DISABLE_INTERRUPT=on > /opt/oracle/instantclient/network/admin/sqlnet.ora
77+
- name: Checkout
78+
uses: actions/checkout@v4
79+
- name: Checkout php-src
80+
uses: actions/checkout@v4
81+
with:
82+
repository: php/php-src
83+
ref: ${{ matrix.branch }}
84+
path: php-src
85+
- name: Setup PHP
86+
uses: shivammathur/setup-php@v2
87+
with:
88+
php-version: ${{matrix.version}}
89+
- name: Build
90+
run: |
91+
phpize
92+
./configure --with-php-config=$(command -v php-config) --with-pdo-oci=instantclient,/opt/oracle/instantclient
93+
make -j$(nproc)
94+
sudo make install
95+
echo 'extension=pdo_oci.so' | sudo tee /etc/php/${{ matrix.version }}/mods-available/pdo_oci.ini
96+
sudo phpenmod -v ${{ matrix.version }} pdo_oci
97+
php --ri pdo_oci
98+
- name: Run tests /w Oracle 11 (for PHP 8.3 only)
99+
# https://github.com/php/php-src/pull/18734
100+
# https://github.com/php/pecl-database-pdo_oci/pull/16#discussion_r2119810891
101+
if: matrix.version == '8.3'
102+
run: php php-src/run-tests.php --show-diff --show-slow 1000 --set-timeout 120 tests
103+
env:
104+
PDO_TEST_DIR: ${{ github.workspace }}/php-src/ext/pdo/tests
105+
PDO_OCI_TEST_DIR: ${{ github.workspace }}/tests
106+
PDO_OCI_TEST_USER: system
107+
PDO_OCI_TEST_PASS: oracle
108+
PDO_OCI_TEST_DSN: oci:dbname=0.0.0.0:1511/XE;charset=AL32UTF8
109+
- name: Run tests /w Oracle 18
110+
if: success() || failure()
111+
run: php php-src/run-tests.php --show-diff --show-slow 1000 --set-timeout 120 tests
112+
env:
113+
PDO_TEST_DIR: ${{ github.workspace }}/php-src/ext/pdo/tests
114+
PDO_OCI_TEST_DIR: ${{ github.workspace }}/tests
115+
PDO_OCI_TEST_USER: system
116+
PDO_OCI_TEST_PASS: my_pass_18
117+
PDO_OCI_TEST_DSN: oci:dbname=0.0.0.0:1518/XE;charset=AL32UTF8
118+
- name: Run tests /w Oracle 21
119+
if: success() || failure()
120+
run: php php-src/run-tests.php --show-diff --show-slow 1000 --set-timeout 120 tests
121+
env:
122+
PDO_TEST_DIR: ${{ github.workspace }}/php-src/ext/pdo/tests
123+
PDO_OCI_TEST_DIR: ${{ github.workspace }}/tests
124+
PDO_OCI_TEST_USER: system
125+
PDO_OCI_TEST_PASS: my_pass_21
126+
PDO_OCI_TEST_DSN: oci:dbname=0.0.0.0:1521/XE;charset=AL32UTF8
127+
- name: Run tests /w Oracle 23
128+
if: success() || failure()
129+
run: php php-src/run-tests.php --show-diff --show-slow 1000 --set-timeout 120 tests
130+
env:
131+
PDO_TEST_DIR: ${{ github.workspace }}/php-src/ext/pdo/tests
132+
PDO_OCI_TEST_DIR: ${{ github.workspace }}/tests
133+
PDO_OCI_TEST_USER: system
134+
PDO_OCI_TEST_PASS: my_pass_23
135+
PDO_OCI_TEST_DSN: oci:dbname=0.0.0.0:1523/FREEPDB1;charset=AL32UTF8
136+
137+
windows-matrix:
138+
runs-on: ubuntu-latest
139+
outputs:
140+
matrix: ${{ steps.extension-matrix.outputs.matrix }}
141+
steps:
142+
- name: Checkout
143+
uses: actions/checkout@v4
144+
- name: Create matrix
145+
id: extension-matrix
146+
uses: php/php-windows-builder/extension-matrix@v1
147+
with:
148+
php-version-list: '8.3, 8.4, master'
149+
150+
windows:
151+
needs: windows-matrix
152+
runs-on: ${{ matrix.os }}
153+
strategy:
154+
fail-fast: false
155+
matrix: ${{fromJson(needs.windows-matrix.outputs.matrix)}}
156+
steps:
157+
- name: Checkout
158+
uses: actions/checkout@v4
159+
- name: Build
160+
uses: php/php-windows-builder/extension@v1
161+
with:
162+
php-version: ${{ matrix.php-version }}
163+
arch: ${{ matrix.arch }}
164+
ts: ${{ matrix.ts }}
165+
libs: instantclient
166+
167+
windows-release:
168+
runs-on: ubuntu-latest
169+
needs: windows
170+
if: ${{ github.event_name == 'release' }}
171+
steps:
172+
- name: Upload release artifact
173+
uses: php/php-windows-builder/release@v1
174+
with:
175+
release: ${{ github.event.release.tag_name }}
176+
token: ${{ secrets.GITHUB_TOKEN }}

tests/bug44301.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ try {
2424
$db = null;
2525
?>
2626
--EXPECTF--
27-
SQLSTATE[HY000]: General error: 942 OCIStmtExecute: ORA-00942: table or view %sdoes not exist
28-
(%s%epdo_oci%eoci_statement.c:%d)
27+
SQLSTATE[HY000]: General error: 942 OCIStmtExecute: ORA-00942: table or view %Sdoes not exist
28+
(%soci_statement.c:%d)

tests/bug_33707.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ array(3) {
2626
[1]=>
2727
int(942)
2828
[2]=>
29-
string(%d) "OCIStmtExecute: ORA-00942: table or view %sdoes not exist
29+
string(%d) "OCIStmtExecute: ORA-00942: table or view %Sdoes not exist
3030
(%s:%d)"
3131
}

tests/pdo_oci_stmt_getcolumnmeta.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ pdo_oci
77
<?php
88
require(getenv('PDO_TEST_DIR').'/pdo_test.inc');
99
PDOTest::skip();
10+
$db = PDOTest::factory();
11+
if (version_compare($db->getAttribute(PDO::ATTR_SERVER_VERSION), 12) < 0) die('xfail CI is failing with Oracle XE 11g');
1012
?>
1113
--FILE--
1214
<?php

0 commit comments

Comments
 (0)