Skip to content

Commit ed46b32

Browse files
Add CI workflow (#27)
Co-authored-by: Michael Voříšek <[email protected]>
1 parent 35a0e90 commit ed46b32

File tree

5 files changed

+167
-1
lines changed

5 files changed

+167
-1
lines changed

.github/workflows/ci.yml

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

tests/bug41069.phpt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,18 @@ oci8.default_prefetch=5
1919

2020
// Initialization
2121

22+
$dbaseFromInside = getenv('GITHUB_ACTION')
23+
? preg_replace('~:15\d\d~', ':1521', $dbase)
24+
: $dbase;
25+
2226
$stmtarray = array(
2327
"alter session set nls_date_format = 'MM/DD/YYYY'",
2428

2529
"drop database link bug41069_dblink",
2630

2731
"drop table bug41069_tab",
2832

29-
"create shared database link bug41069_dblink authenticated by $user identified by $password using '$dbase'",
33+
"create shared database link bug41069_dblink authenticated by $user identified by $password using '$dbaseFromInside'",
3034

3135
"create table bug41069_tab
3236
(

tests/bug43497.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ oci8
77
require_once 'skipifconnectfailure.inc';
88
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
99
require __DIR__.'/skipif.inc';
10+
preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
11+
if (isset($matches[0]) && $matches[1] < 12) {
12+
die("skip Too slow with Oracle Database 11g for CI");
13+
}
1014
if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request');
1115
?>
1216
--FILE--

tests/lob_prefetch.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ oci8
77
require_once 'skipifconnectfailure.inc';
88
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
99
require __DIR__.'/skipif.inc';
10+
preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
11+
if (isset($matches[0]) && $matches[1] < 12) {
12+
die("skip Too slow with Oracle Database 11g for CI");
13+
}
1014
?>
1115
--FILE--
1216
<?php

tests/lob_prefetch_ini.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ oci8
77
require_once 'skipifconnectfailure.inc';
88
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
99
require __DIR__.'/skipif.inc';
10+
preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
11+
if (isset($matches[0]) && $matches[1] < 12) {
12+
die("skip Too slow with Oracle Database 11g for CI");
13+
}
1014
?>
1115
--INI--
1216
oci8.prefetch_lob_size=100000

0 commit comments

Comments
 (0)