Skip to content

Commit 826309c

Browse files
committed
Update Oracle CI
1 parent 2e6315a commit 826309c

File tree

10 files changed

+152
-52
lines changed

10 files changed

+152
-52
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ jobs:
3737

3838
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
3939
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.rails }}_with_${{ matrix.adapter }}.gemfile
40-
ORACLE_COOKIE: sqldev
41-
ORACLE_FILE: oracle11g/xe/oracle-xe-11.2.0-1.0.x86_64.rpm.zip
42-
ORACLE_HOME: /u01/app/oracle/product/11.2.0/xe
43-
ORACLE_SID: XE
4440

4541
services:
4642
postgres:
@@ -86,7 +82,6 @@ jobs:
8682
- sqlite3
8783
- postgresql
8884
- mysql2
89-
# - oracle_enhanced
9085
- postgis
9186
# Disabled for now:
9287
# Rails 7.0: trilogy_auth_recv: caching_sha2_password requires either TCP with TLS or a unix socket: TRILOGY_UNSUPPORTED
@@ -98,28 +93,13 @@ jobs:
9893
- rails: 'rails_8.0'
9994
ruby: '3.1'
10095

101-
# Disabled for now because of build error:
102-
# /opt/hostedtoolcache/Ruby/3.0.7/x64/lib/ruby/3.0.0/psych.rb:457:in
103-
# `parse_stream': undefined method `parse' for #<Psych::Parser:0x000055b6cc7b6898
104-
# @handler=#<Psych::Handlers::DocumentStream:0x000055b6cc7b69b0 @stack=[],
105-
# @last=nil, @root=nil, @start_line=nil, @start_column=nil, @end_line=nil,
106-
# @end_column=nil, @block=#<Proc:0x000055b6cc7b68e8
107-
# /opt/hostedtoolcache/Ruby/3.0.7/x64/lib/ruby/3.0.0/psych.rb:391>>,
108-
# @external_encoding=0> (NoMethodError)
109-
# from
110-
# /home/runner/work/ajax-datatables-rails/ajax-datatables-rails/vendor/bundle/ruby/3.0.0/gems/ruby-oci8-2.2.14/ext/oci8/apiwrap.rb:64:in
111-
# `create_apiwrap'
112-
- rails: 'rails_7.2'
113-
adapter: 'oracle_enhanced'
114-
11596
steps:
11697
- name: Checkout
11798
uses: actions/checkout@v4
11899

119100
- name: Set DB Adapter
120101
env:
121102
DB_ADAPTER: ${{ matrix.adapter }}
122-
CUSTOM_ORACLE_FILE: ${{ secrets.CUSTOM_ORACLE_FILE }}
123103

124104
# See: https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md#mysql
125105
run: |
@@ -128,12 +108,6 @@ jobs:
128108
mysql -u root -proot -e 'create database ajax_datatables_rails;'
129109
fi
130110
131-
if [[ "${DB_ADAPTER}" == "oracle_enhanced" ]]; then
132-
./spec/install_oracle.sh
133-
# Fix error : libnnz11.so: cannot open shared object file: No such file or directory
134-
sudo ln -s ${ORACLE_HOME}/lib/libnnz11.so /usr/lib/libnnz11.so
135-
fi
136-
137111
- name: Setup Ruby
138112
uses: ruby/setup-ruby@v1
139113
with:

.github/workflows/ci_oracle.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
---
2+
name: CI Oracle
3+
4+
on:
5+
push:
6+
branches:
7+
- '**'
8+
pull_request:
9+
branches:
10+
- '**'
11+
schedule:
12+
- cron: '0 4 1 * *'
13+
# Run workflow manually
14+
workflow_dispatch:
15+
16+
jobs:
17+
rspec:
18+
runs-on: ubuntu-latest
19+
20+
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
21+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.rails }}_with_${{ matrix.adapter }}.gemfile
22+
ORACLE_HOME: /opt/oracle/instantclient_23_8
23+
LD_LIBRARY_PATH: /opt/oracle/instantclient_23_8
24+
TNS_ADMIN: ./ci/network/admin
25+
DATABASE_SYS_PASSWORD: Oracle18
26+
DATABASE_NAME: FREEPDB1
27+
28+
services:
29+
oracle:
30+
image: gvenzl/oracle-free:latest
31+
ports:
32+
- 1521:1521
33+
env:
34+
TZ: Europe/Paris
35+
ORACLE_PASSWORD: Oracle18
36+
options: >-
37+
--health-cmd healthcheck.sh
38+
--health-interval 10s
39+
--health-timeout 5s
40+
--health-retries 10
41+
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
ruby:
46+
- '3.4'
47+
# - '3.3'
48+
# - '3.2'
49+
# - '3.1'
50+
# - 'head'
51+
rails:
52+
- rails_8.0
53+
# - rails_7.2
54+
# - rails_7.1
55+
adapter:
56+
- oracle_enhanced
57+
# exclude:
58+
# # Disabled for now because of build error:
59+
# # /opt/hostedtoolcache/Ruby/3.0.7/x64/lib/ruby/3.0.0/psych.rb:457:in
60+
# # `parse_stream': undefined method `parse' for #<Psych::Parser:0x000055b6cc7b6898
61+
# # @handler=#<Psych::Handlers::DocumentStream:0x000055b6cc7b69b0 @stack=[],
62+
# # @last=nil, @root=nil, @start_line=nil, @start_column=nil, @end_line=nil,
63+
# # @end_column=nil, @block=#<Proc:0x000055b6cc7b68e8
64+
# # /opt/hostedtoolcache/Ruby/3.0.7/x64/lib/ruby/3.0.0/psych.rb:391>>,
65+
# # @external_encoding=0> (NoMethodError)
66+
# # from
67+
# # /home/runner/work/ajax-datatables-rails/ajax-datatables-rails/vendor/bundle/ruby/3.0.0/gems/ruby-oci8-2.2.14/ext/oci8/apiwrap.rb:64:in
68+
# # `create_apiwrap'
69+
# - rails: 'rails_7.2'
70+
# adapter: 'oracle_enhanced'
71+
72+
steps:
73+
- name: Checkout
74+
uses: actions/checkout@v4
75+
76+
- name: Create symbolic link for libaio library compatibility
77+
run: |
78+
sudo ln -s /usr/lib/x86_64-linux-gnu/libaio.so.1t64 /usr/lib/x86_64-linux-gnu/libaio.so.1
79+
80+
- name: Download Oracle instant client
81+
run: |
82+
wget -q https://download.oracle.com/otn_software/linux/instantclient/2380000/instantclient-basic-linux.x64-23.8.0.25.04.zip
83+
wget -q https://download.oracle.com/otn_software/linux/instantclient/2380000/instantclient-sdk-linux.x64-23.8.0.25.04.zip
84+
wget -q https://download.oracle.com/otn_software/linux/instantclient/2380000/instantclient-sqlplus-linux.x64-23.8.0.25.04.zip
85+
86+
- name: Install Oracle instant client
87+
run: |
88+
sudo unzip instantclient-basic-linux.x64-23.8.0.25.04.zip -d /opt/oracle/
89+
sudo unzip -o instantclient-sdk-linux.x64-23.8.0.25.04.zip -d /opt/oracle/
90+
sudo unzip -o instantclient-sqlplus-linux.x64-23.8.0.25.04.zip -d /opt/oracle/
91+
echo "/opt/oracle/instantclient_23_8" >> $GITHUB_PATH
92+
93+
- name: Create database user
94+
run: |
95+
./ci/setup_accounts.sh
96+
97+
- name: Setup Ruby
98+
uses: ruby/setup-ruby@v1
99+
with:
100+
ruby-version: ${{ matrix.ruby }}
101+
bundler-cache: true
102+
env:
103+
DB_ADAPTER: ${{ matrix.adapter }}
104+
105+
- name: Run RSpec
106+
env:
107+
DB_ADAPTER: ${{ matrix.adapter }}
108+
run: bin/rspec
109+
110+
- name: Publish code coverage
111+
uses: qltysh/qlty-action/coverage@v1
112+
with:
113+
token: ${{ secrets.QLTY_COVERAGE_TOKEN }}
114+
files: coverage/coverage.json

Appraisals

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ end
6868

6969
appraise 'rails_7.2_with_oracle_enhanced' do
7070
gem 'rails', '~> 7.2.0'
71-
gem 'activerecord-oracle_enhanced-adapter', git: 'https://github.com/rsim/oracle-enhanced.git'
71+
gem 'activerecord-oracle_enhanced-adapter', '~> 7.2.0'
7272
remove_gem 'pg'
7373
end
7474

@@ -107,7 +107,7 @@ end
107107

108108
appraise 'rails_8.0_with_oracle_enhanced' do
109109
gem 'rails', '~> 8.0.0'
110-
gem 'activerecord-oracle_enhanced-adapter', git: 'https://github.com/rsim/oracle-enhanced.git'
110+
gem 'activerecord-oracle_enhanced-adapter', '~> 8.0.0'
111111
remove_gem 'pg'
112112
end
113113

ci/network/admin/tnsnames.ora

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FREEPDB1 =
2+
(DESCRIPTION =
3+
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
4+
(CONNECT_DATA =
5+
(SERVICE_NAME = FREEPDB1)
6+
)
7+
)
8+
9+
XE =
10+
(DESCRIPTION =
11+
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
12+
(CONNECT_DATA =
13+
(SERVICE_NAME = XE)
14+
)
15+
)

ci/setup_accounts.sh

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

gemfiles/rails_7.2_with_oracle_enhanced.gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ gem "rubocop-performance", require: false
2020
gem "rubocop-rake", require: false
2121
gem "rubocop-rspec", require: false
2222
gem "rails", "~> 7.2.0"
23-
gem "activerecord-oracle_enhanced-adapter", git: "https://github.com/rsim/oracle-enhanced.git"
23+
gem "activerecord-oracle_enhanced-adapter", "~> 7.2.0"
2424

2525
gemspec path: "../"

gemfiles/rails_8.0_with_oracle_enhanced.gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ gem "rubocop-performance", require: false
2020
gem "rubocop-rake", require: false
2121
gem "rubocop-rspec", require: false
2222
gem "rails", "~> 8.0.0"
23-
gem "activerecord-oracle_enhanced-adapter", git: "https://github.com/rsim/oracle-enhanced.git"
23+
gem "activerecord-oracle_enhanced-adapter", "~> 8.0.0"
2424

2525
gemspec path: "../"

spec/dummy/config/database.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ test:
1515
username: 'root'
1616
password: 'root'
1717
<% elsif adapter == 'oracle_enhanced' %>
18-
host: '127.0.0.1/xe'
19-
username: <%= ENV.fetch('USER') %>
20-
password: <%= ENV.fetch('USER') %>
21-
database: 'xe'
18+
host: '127.0.0.1'
19+
username: 'oracle_enhanced'
20+
password: 'oracle_enhanced'
21+
database: 'FREEPDB1'
2222
<% elsif adapter == 'sqlite3' %>
2323
# database: ':memory:'
2424
database: db/ajax_datatables_rails.sqlite3

spec/install_oracle.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
alter database default tablespace USERS;
2+
3+
CREATE USER oracle_enhanced IDENTIFIED BY oracle_enhanced;
4+
5+
GRANT unlimited tablespace, create session, create table, create sequence,
6+
create procedure, create trigger, create view, create materialized view,
7+
create database link, create synonym, create type, ctxapp TO oracle_enhanced;

0 commit comments

Comments
 (0)