Skip to content

Commit

Permalink
test: fix workflow (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
yajra authored May 27, 2024
1 parent 65c72f8 commit 6d9c694
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 32 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
image: deepdiver/docker-oracle-xe-11g:2.0
ports:
- 49160:22
- 49161:1521
- 1521:1521
strategy:
fail-fast: true
matrix:
Expand Down Expand Up @@ -43,12 +43,16 @@ jobs:
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Setup OCI8
run: ./oci8-php8.sh
run: ./oci8-php80.sh
if: matrix.php == 8

- name: Setup OCI8
run: ./oci8.sh
if: matrix.php > 8
run: ./oci8-php81.sh
if: matrix.php == 8.1

- name: Setup OCI8
run: ./oci8-php82.sh
if: matrix.php == 8.2

- name: Install dependencies
uses: nick-invision/retry@v1
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
}
},
"scripts": {
"docker": "docker run -d -p 49160:22 -p 49161:1521 deepdiver/docker-oracle-xe-11g"
"docker": "docker run -d -p 49160:22 -p 1521:1521 deepdiver/docker-oracle-xe-11g"
},
"minimum-stability": "stable"
}
23 changes: 0 additions & 23 deletions oci8-php8.sh

This file was deleted.

28 changes: 28 additions & 0 deletions oci8-php80.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

# install deps
sudo apt-get update -qq
sudo apt-get -y install -qq build-essential unzip wget libaio1

# install oci8 libs & extension
sudo mkdir -p /opt/oracle

wget https://github.com/bumpx/oracle-instantclient/raw/master/instantclient-basic-linux.x64-12.1.0.2.0.zip
wget https://github.com/bumpx/oracle-instantclient/raw/master/instantclient-sdk-linux.x64-12.1.0.2.0.zip

sudo unzip -o ./instantclient-basic-linux.x64-12.1.0.2.0.zip -d /opt/oracle
sudo unzip -o ./instantclient-sdk-linux.x64-12.1.0.2.0.zip -d /opt/oracle

sudo ln -s /opt/oracle/instantclient/sqlplus /usr/bin/sqlplus
sudo ln -s /opt/oracle/instantclient_12_1 /opt/oracle/instantclient
sudo ln -s /opt/oracle/instantclient/libclntsh.so.12.1 /opt/oracle/instantclient/libclntsh.so
sudo ln -s /opt/oracle/instantclient/libocci.so.12.1 /opt/oracle/instantclient/libocci.so

sudo sh -c "echo 'instantclient,/opt/oracle/instantclient' | pecl install oci8-3.0.1"

# setup ld library path
sudo sh -c "echo '/opt/oracle/instantclient' >> /etc/ld.so.conf"
sudo ldconfig

# enable oci8 extension
sudo sh -c "echo 'extension=oci8.so' >> /etc/php/8.0/cli/php.ini"
28 changes: 28 additions & 0 deletions oci8-php81.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

# install deps
sudo apt-get update -qq
sudo apt-get -y install -qq build-essential unzip wget libaio1

# install oci8 libs & extension
sudo mkdir -p /opt/oracle

wget https://github.com/bumpx/oracle-instantclient/raw/master/instantclient-basic-linux.x64-12.1.0.2.0.zip
wget https://github.com/bumpx/oracle-instantclient/raw/master/instantclient-sdk-linux.x64-12.1.0.2.0.zip

sudo unzip -o ./instantclient-basic-linux.x64-12.1.0.2.0.zip -d /opt/oracle
sudo unzip -o ./instantclient-sdk-linux.x64-12.1.0.2.0.zip -d /opt/oracle

sudo ln -s /opt/oracle/instantclient/sqlplus /usr/bin/sqlplus
sudo ln -s /opt/oracle/instantclient_12_1 /opt/oracle/instantclient
sudo ln -s /opt/oracle/instantclient/libclntsh.so.12.1 /opt/oracle/instantclient/libclntsh.so
sudo ln -s /opt/oracle/instantclient/libocci.so.12.1 /opt/oracle/instantclient/libocci.so

sudo sh -c "echo 'instantclient,/opt/oracle/instantclient' | pecl install oci8-3.2.1"

# setup ld library path
sudo sh -c "echo '/opt/oracle/instantclient' >> /etc/ld.so.conf"
sudo ldconfig

# enable oci8 extension
sudo sh -c "echo 'extension=oci8.so' >> /etc/php/8.1/cli/php.ini"
28 changes: 28 additions & 0 deletions oci8-php82.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

# install deps
sudo apt-get update -qq
sudo apt-get -y install -qq build-essential unzip wget libaio1

# install oci8 libs & extension
sudo mkdir -p /opt/oracle

wget https://github.com/bumpx/oracle-instantclient/raw/master/instantclient-basic-linux.x64-12.1.0.2.0.zip
wget https://github.com/bumpx/oracle-instantclient/raw/master/instantclient-sdk-linux.x64-12.1.0.2.0.zip

sudo unzip -o ./instantclient-basic-linux.x64-12.1.0.2.0.zip -d /opt/oracle
sudo unzip -o ./instantclient-sdk-linux.x64-12.1.0.2.0.zip -d /opt/oracle

sudo ln -s /opt/oracle/instantclient/sqlplus /usr/bin/sqlplus
sudo ln -s /opt/oracle/instantclient_12_1 /opt/oracle/instantclient
sudo ln -s /opt/oracle/instantclient/libclntsh.so.12.1 /opt/oracle/instantclient/libclntsh.so
sudo ln -s /opt/oracle/instantclient/libocci.so.12.1 /opt/oracle/instantclient/libocci.so

sudo sh -c "echo 'instantclient,/opt/oracle/instantclient' | pecl install oci8"

# setup ld library path
sudo sh -c "echo '/opt/oracle/instantclient' >> /etc/ld.so.conf"
sudo ldconfig

# enable oci8 extension
sudo sh -c "echo 'extension=oci8.so' >> /etc/php/8.2/cli/php.ini"
15 changes: 11 additions & 4 deletions tests/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class ConnectionTest extends TestCase
{
const DEFAULT_USER = 'system';
const DEFAULT_PWD = 'oracle';
const DEFAULT_DSN = 'oci:dbname=127.0.0.1:49161/xe';
const DEFAULT_DSN = 'oci:dbname=127.0.0.1:1521/xe';

/**
* @var Oci8
Expand Down Expand Up @@ -72,9 +72,12 @@ public function testInvalidConnection()
{
$user = 'pdooci';
$pwd = 'pdooci';
$str = 'oci:dbname=127.0.0.1:49161/hoi';
$this->expectException(Oci8\Exceptions\Oci8Exception::class);
new Oci8($str, $user, $pwd, [PDO::ATTR_PERSISTENT => true]);
$str = 'oci:dbname=127.0.0.1:1521/hoi';
try {
new Oci8($str, $user, $pwd, [PDO::ATTR_PERSISTENT => true]);
} catch (Exception $e) {
$this->assertStringContainsString('ORA-12514', $e->getMessage());
}
}

/**
Expand Down Expand Up @@ -138,6 +141,8 @@ public function testQuote()
* Test if fails if requiring the last inserted id without a sequence.
*
* @return null
*
* @throws \ReflectionException
*/
public function testLastIdWithoutSequence()
{
Expand All @@ -148,6 +153,8 @@ public function testLastIdWithoutSequence()
* Test if returns the last inserted id with a sequence.
*
* @return null
*
* @throws \ReflectionException
*/
public function testLastIdWithSequence()
{
Expand Down

0 comments on commit 6d9c694

Please sign in to comment.