Skip to content

Commit 0542702

Browse files
authored
Merge pull request #198 from yahonda/actions
Run CI with GitHub Actions to support Oracle database 18c
2 parents 4c33681 + c057935 commit 0542702

5 files changed

Lines changed: 104 additions & 5 deletions

File tree

.github/workflows/test.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: test
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
build:
9+
10+
runs-on: ubuntu-20.04
11+
continue-on-error: true
12+
strategy:
13+
matrix:
14+
ruby: [
15+
3.0,
16+
2.7,
17+
2.6,
18+
2.5,
19+
ruby-head,
20+
ruby-debug
21+
]
22+
env:
23+
ORACLE_HOME: /usr/lib/oracle/18.5/client64
24+
LD_LIBRARY_PATH: /usr/lib/oracle/18.5/client64/lib
25+
NLS_LANG: AMERICAN_AMERICA.AL32UTF8
26+
TNS_ADMIN: ./ci/network/admin
27+
DATABASE_NAME: XEPDB1
28+
TZ: Europe/Riga
29+
DATABASE_SYS_PASSWORD: Oracle18
30+
DATABASE_VERSION: 18.4.0.0
31+
32+
services:
33+
oracle:
34+
image: quillbuilduser/oracle-18-xe
35+
ports:
36+
- 1521:1521
37+
env:
38+
TZ: Europe/Riga
39+
steps:
40+
- uses: actions/checkout@v2
41+
- name: Set up Ruby
42+
uses: ruby/setup-ruby@v1
43+
with:
44+
ruby-version: ${{ matrix.ruby }}
45+
- name: Install required package
46+
run: |
47+
sudo apt-get install alien
48+
- name: Download Oracle client
49+
run: |
50+
wget -q https://download.oracle.com/otn_software/linux/instantclient/185000/oracle-instantclient18.5-basic-18.5.0.0.0-3.x86_64.rpm
51+
wget -q https://download.oracle.com/otn_software/linux/instantclient/185000/oracle-instantclient18.5-sqlplus-18.5.0.0.0-3.x86_64.rpm
52+
wget -q https://download.oracle.com/otn_software/linux/instantclient/185000/oracle-instantclient18.5-devel-18.5.0.0.0-3.x86_64.rpm
53+
- name: Install Oracle client
54+
run: |
55+
sudo alien -i oracle-instantclient18.5-basic-18.5.0.0.0-3.x86_64.rpm
56+
sudo alien -i oracle-instantclient18.5-sqlplus-18.5.0.0.0-3.x86_64.rpm
57+
sudo alien -i oracle-instantclient18.5-devel-18.5.0.0.0-3.x86_64.rpm
58+
- name: Install JDBC Driver
59+
run: |
60+
cp $ORACLE_HOME/lib/ojdbc8.jar lib/.
61+
- name: Create database user
62+
run: |
63+
./ci/setup_accounts.sh
64+
- name: Bundle install
65+
run: |
66+
bundle install --jobs 4 --retry 3
67+
- name: Run RSpec
68+
run: |
69+
bundle exec rspec

ci/network/admin/tnsnames.ora

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
XEPDB1 =
2+
(DESCRIPTION =
3+
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
4+
(CONNECT_DATA =
5+
(SERVICE_NAME = XEPDB1)
6+
)
7+
)

ci/setup_accounts.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
set -ev
4+
5+
${ORACLE_HOME}/bin/sqlplus system/${DATABASE_SYS_PASSWORD}@${DATABASE_NAME} <<SQL
6+
@@spec/support/unlock_and_setup_hr_user.sql
7+
@@spec/support/create_arunit_user.sql
8+
exit
9+
SQL

spec/plsql/procedure_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,6 +1508,12 @@ def new_candidate(status)
15081508
end
15091509

15101510
describe "using Oracle 9.2" do
1511+
before(:all) do
1512+
# get actual database_version
1513+
plsql.connect! CONNECTION_PARAMS
1514+
skip "Skip if the actual database version is 18c or higher" if (plsql.connection.database_version <=> [18, 0, 0, 0]) >= 0
1515+
end
1516+
15111517
before do
15121518
# simulate Oracle 9.2 connection
15131519
plsql(:oracle_9).connection = get_connection

spec/plsql/schema_spec.rb

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,19 @@ class TestModel < TestBaseModel
229229
end
230230

231231
it "should safely close cursors in threaded environment" do
232-
expect {
233-
t1 = Thread.new { plsql.dbms_lock.sleep(1) }.tap { |t| t.abort_on_exception = true }
234-
t2 = Thread.new { plsql.dbms_lock.sleep(2) }.tap { |t| t.abort_on_exception = true }
235-
[t2, t1].each { |t| t.join }
236-
}.not_to raise_error
232+
if (plsql.connection.database_version <=> [18, 0, 0, 0]) >= 0
233+
expect {
234+
t1 = Thread.new { plsql.dbms_session.sleep(1) }.tap { |t| t.abort_on_exception = true }
235+
t2 = Thread.new { plsql.dbms_session.sleep(2) }.tap { |t| t.abort_on_exception = true }
236+
[t2, t1].each { |t| t.join }
237+
}.not_to raise_error
238+
else
239+
expect {
240+
t1 = Thread.new { plsql.dbms_lock.sleep(1) }.tap { |t| t.abort_on_exception = true }
241+
t2 = Thread.new { plsql.dbms_lock.sleep(2) }.tap { |t| t.abort_on_exception = true }
242+
[t2, t1].each { |t| t.join }
243+
}.not_to raise_error
244+
end
237245
end
238246

239247
end if defined?(ActiveRecord)

0 commit comments

Comments
 (0)