Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix workflow #141

Merged
merged 6 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading