Skip to content

Commit b36a5d4

Browse files
committed
Merge branch 'pr-2471' into rails-8-1-support-akostadinov
# Conflicts: # Gemfile # VERSION
2 parents 21a4fdc + 98d401c commit b36a5d4

File tree

20 files changed

+284
-23
lines changed

20 files changed

+284
-23
lines changed

.devcontainer/Dockerfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM mcr.microsoft.com/devcontainers/ruby:1-3.4-bookworm
2+
3+
# Install libaio1 (required for Oracle Instant Client)
4+
RUN apt-get update && apt-get install -y libaio1 \
5+
&& rm -rf /var/lib/apt/lists/*
6+
7+
# Create directory structure for Oracle
8+
RUN mkdir -p /opt/oracle
9+
10+
# Download and install Oracle Instant Client based on architecture
11+
WORKDIR /tmp
12+
RUN ARCH=$(uname -m) && \
13+
if [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then \
14+
ARCH_SUFFIX="arm64"; \
15+
else \
16+
ARCH_SUFFIX="x64"; \
17+
fi && \
18+
wget -q https://download.oracle.com/otn_software/linux/instantclient/2380000/instantclient-basic-linux.${ARCH_SUFFIX}-23.8.0.25.04.zip \
19+
&& wget -q https://download.oracle.com/otn_software/linux/instantclient/2380000/instantclient-sdk-linux.${ARCH_SUFFIX}-23.8.0.25.04.zip \
20+
&& wget -q https://download.oracle.com/otn_software/linux/instantclient/2380000/instantclient-sqlplus-linux.${ARCH_SUFFIX}-23.8.0.25.04.zip \
21+
&& unzip -qo instantclient-basic-linux.${ARCH_SUFFIX}-23.8.0.25.04.zip \
22+
&& unzip -qo instantclient-sdk-linux.${ARCH_SUFFIX}-23.8.0.25.04.zip \
23+
&& unzip -qo instantclient-sqlplus-linux.${ARCH_SUFFIX}-23.8.0.25.04.zip \
24+
&& mv instantclient_23_8 /opt/oracle/instantclient \
25+
&& rm -f instantclient-*.zip
26+
27+
# Set Oracle environment variables
28+
ENV ORACLE_HOME=/opt/oracle/instantclient \
29+
LD_LIBRARY_PATH=/opt/oracle/instantclient:$LD_LIBRARY_PATH \
30+
PATH=/opt/oracle/instantclient:$PATH
31+
32+
# Switch to vscode user
33+
USER vscode
34+
35+
# Set working directory
36+
WORKDIR /workspaces/oracle-enhanced

.devcontainer/devcontainer.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "Oracle Enhanced ActiveRecord Adapter",
3+
"dockerComposeFile": "docker-compose.yml",
4+
"service": "app",
5+
"workspaceFolder": "/workspaces/oracle-enhanced",
6+
"customizations": {
7+
"vscode": {
8+
"extensions": [
9+
"shopify.ruby-lsp"
10+
]
11+
}
12+
},
13+
"postCreateCommand": "bundle install",
14+
"remoteEnv": {
15+
"DATABASE_NAME": "FREEPDB1",
16+
"DATABASE_SYS_PASSWORD": "Oracle18",
17+
"NLS_LANG": "American_America.AL32UTF8",
18+
"TNS_ADMIN": "/workspaces/oracle-enhanced/ci/network/admin",
19+
"TWO_TASK": "FREEPDB1"
20+
},
21+
"remoteUser": "vscode",
22+
"mounts": [
23+
"source=${localWorkspaceFolder}/.bundle,target=/home/vscode/.bundle,type=bind,consistency=delegated"
24+
]
25+
}

.devcontainer/docker-compose.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
services:
2+
app:
3+
build:
4+
context: .
5+
dockerfile: Dockerfile
6+
volumes:
7+
- ../..:/workspaces:cached
8+
command: sleep infinity
9+
network_mode: service:oracle
10+
11+
oracle:
12+
image: gvenzl/oracle-free:latest
13+
ports:
14+
- "1521:1521"
15+
environment:
16+
TZ: Europe/Riga
17+
ORACLE_PASSWORD: Oracle18
18+
healthcheck:
19+
test: ["CMD", "healthcheck.sh"]
20+
interval: 10s
21+
timeout: 5s
22+
retries: 10
23+
volumes:
24+
- oracle-data:/opt/oracle/oradata
25+
- ../spec/support/create_oracle_enhanced_users.sql:/container-entrypoint-initdb.d/01-create-users.sql
26+
27+
volumes:
28+
oracle-data:

.github/workflows/ruby_head.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ jobs:
7373
- name: Bundle install
7474
run: |
7575
bundle install --jobs 4 --retry 3
76+
- name: Show Gemfile.lock
77+
run: |
78+
cat Gemfile.lock
7679
- name: Run RSpec
7780
run: |
7881
bundle exec rspec

.github/workflows/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ jobs:
7979
- name: Bundle install
8080
run: |
8181
bundle install --jobs 4 --retry 3
82+
- name: Show Gemfile.lock
83+
run: |
84+
cat Gemfile.lock
8285
- name: Run RSpec
8386
run: |
8487
bundle exec rspec

.github/workflows/test_11g.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ jobs:
8383
- name: Bundle install
8484
run: |
8585
bundle install --jobs 4 --retry 3
86+
- name: Show Gemfile.lock
87+
run: |
88+
cat Gemfile.lock
8689
- name: Run RSpec
8790
run: |
8891
bundle exec rspec

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ install:
3131
- bundle install
3232

3333
script:
34-
- bundle exec rake spec
34+
- bundle exec rspec spec/active_record/oracle_enhanced/type/timestamp_spec.rb
3535

3636
language: ruby
3737
rvm:

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,70 @@ complete.
833833

834834
See the **Timeouts** section above.
835835

836+
Development with Devcontainer
837+
------------------------------
838+
839+
This project includes a devcontainer configuration that provides a complete development environment with Oracle Database and all necessary dependencies pre-configured. The devcontainer supports both x64 and ARM64 architectures.
840+
841+
### Prerequisites
842+
843+
- [Docker](https://www.docker.com/get-started) installed and running
844+
- [VS Code](https://code.visualstudio.com/) with the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
845+
846+
### Getting Started
847+
848+
1. Clone the repository:
849+
```bash
850+
git clone https://github.com/rsim/oracle-enhanced.git
851+
cd oracle-enhanced
852+
```
853+
854+
2. Open the project in VS Code:
855+
```bash
856+
code .
857+
```
858+
859+
3. When prompted, click "Reopen in Container" or use the Command Palette (`Ctrl+Shift+P` / `Cmd+Shift+P`) and select "Dev Containers: Reopen in Container"
860+
861+
4. VS Code will build and start the development environment automatically. This includes:
862+
- Ruby 3.4
863+
- Oracle Database Free
864+
- Oracle Instant Client 23.8
865+
- All required gems installed via `bundle install`
866+
867+
### What's Included
868+
869+
The devcontainer provides:
870+
871+
- **Ruby**: 3.4
872+
- **Oracle Database**: Oracle Database Free (23c)
873+
- **Oracle Instant Client**: Version 23.8
874+
- **Database Configuration**:
875+
- Database: `FREEPDB1`
876+
- System password: `Oracle18`
877+
- TNS configuration in `ci/network/admin`
878+
879+
### Database Access
880+
881+
The Oracle database is automatically started and configured with:
882+
- Port: `1521` (forwarded from container)
883+
- Service Name: `FREEPDB1`
884+
- System Password: `Oracle18`
885+
- Test users are created automatically from `spec/support/create_oracle_enhanced_users.sql`
886+
887+
888+
### Running Tests
889+
890+
Once the devcontainer is running, you can run tests directly:
891+
892+
```bash
893+
# Run all tests
894+
bundle exec rspec
895+
896+
# Run specific test files
897+
bundle exec rspec spec/test_file_spec.rb
898+
```
899+
836900
RUNNING TESTS
837901
-------------
838902

RUNNING_TESTS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,7 @@ If no Oracle database with SYS and SYSTEM user access is available, try the dock
110110
```sh
111111
bundle exec rake spec
112112
```
113+
114+
# Troubleshooting
115+
116+
If you observe strange errors when running tests, make sure the activerecord version loaded by the tests is the expected one for the oracle_enhanced version.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.0.0
1+
8.1.0.alpha

0 commit comments

Comments
 (0)