|
| 1 | +# Contributing to ruby-plsql |
| 2 | + |
| 3 | +Thanks for your interest in contributing! This document covers how to |
| 4 | +report issues, open pull requests, and run the test suite locally. |
| 5 | + |
| 6 | +## Reporting issues |
| 7 | + |
| 8 | +File issues at https://github.com/rsim/ruby-plsql/issues. Please |
| 9 | +include: |
| 10 | + |
| 11 | +- ruby-plsql version (or commit SHA if you're on a branch) |
| 12 | +- Oracle Database version |
| 13 | +- Ruby engine and version (MRI / JRuby) |
| 14 | +- A minimal reproduction — runnable code, expected vs. actual behavior |
| 15 | + |
| 16 | +## Submitting pull requests |
| 17 | + |
| 18 | +1. Fork the repository and create a topic branch off `master`. |
| 19 | +2. Make your change. Include a regression test whenever practical. |
| 20 | +3. Run the full spec suite (see below) and RuboCop. |
| 21 | +4. Open a pull request against `rsim/ruby-plsql:master` describing |
| 22 | + what changed and why. |
| 23 | + |
| 24 | +## Development with devcontainer |
| 25 | + |
| 26 | +The repository ships with a devcontainer configuration that provides a |
| 27 | +complete development environment with Oracle Database and all required |
| 28 | +dependencies pre-configured. It supports both x64 and ARM64 hosts, and |
| 29 | +is the recommended way to work on ruby-plsql. |
| 30 | + |
| 31 | +### Prerequisites |
| 32 | + |
| 33 | +- [Docker](https://www.docker.com/get-started) installed and running |
| 34 | +- [VS Code](https://code.visualstudio.com/) with the |
| 35 | + [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) |
| 36 | + |
| 37 | +### Getting started |
| 38 | + |
| 39 | +1. Clone the repository: |
| 40 | + ```sh |
| 41 | + git clone https://github.com/rsim/ruby-plsql.git |
| 42 | + cd ruby-plsql |
| 43 | + ``` |
| 44 | +2. Open the project in VS Code: |
| 45 | + ```sh |
| 46 | + code . |
| 47 | + ``` |
| 48 | +3. When prompted, click "Reopen in Container" — or from the Command |
| 49 | + Palette (`Ctrl+Shift+P` / `Cmd+Shift+P`) run |
| 50 | + "Dev Containers: Reopen in Container". |
| 51 | +4. VS Code builds and starts the environment automatically. This |
| 52 | + includes Ruby 4.0, Oracle Database Free (latest), Oracle Instant |
| 53 | + Client (latest 23.x), and all gems from `bundle install`. |
| 54 | + |
| 55 | +### What's included |
| 56 | + |
| 57 | +- **Ruby**: 4.0 |
| 58 | +- **Oracle Database**: Free (latest) |
| 59 | +- **Oracle Instant Client**: latest 23.x |
| 60 | +- **Database configuration**: |
| 61 | + - Port `1521` is forwarded from the container |
| 62 | + - Service name: `FREEPDB1` |
| 63 | + - System password: `Oracle18` |
| 64 | + - TNS configuration in `ci/network/admin` |
| 65 | + - Test users (`hr`, `arunit`) are provisioned automatically via |
| 66 | + `ci/setup_accounts.sh` |
| 67 | + |
| 68 | +## Running the test suite |
| 69 | + |
| 70 | +Inside the devcontainer: |
| 71 | + |
| 72 | +```sh |
| 73 | +bundle exec rake spec # full suite |
| 74 | +bundle exec rspec spec/path/to/file_spec.rb # single file |
| 75 | +bundle exec rspec spec/path/to/file_spec.rb:42 # single example |
| 76 | +``` |
| 77 | + |
| 78 | +### Reproducing a specific run |
| 79 | + |
| 80 | +Specs run in randomized order. The seed is printed at the start of the |
| 81 | +run, e.g.: |
| 82 | + |
| 83 | +``` |
| 84 | +==> Randomized with seed 12345 (reproduce: bundle exec rspec --seed 12345) |
| 85 | +``` |
| 86 | + |
| 87 | +To reproduce that exact run: |
| 88 | + |
| 89 | +```sh |
| 90 | +bundle exec rspec --seed 12345 |
| 91 | +``` |
| 92 | + |
| 93 | +If a failure looks order-dependent, narrow it down to the minimal |
| 94 | +failing pair with `--bisect`: |
| 95 | + |
| 96 | +```sh |
| 97 | +bundle exec rspec --seed 12345 --bisect |
| 98 | +``` |
| 99 | + |
| 100 | +The seed line is also visible in CI job logs, including partial logs |
| 101 | +when a run hangs and is cancelled. |
| 102 | + |
| 103 | +## Running RuboCop |
| 104 | + |
| 105 | +```sh |
| 106 | +BUNDLE_ONLY=rubocop bundle install |
| 107 | +BUNDLE_ONLY=rubocop bundle exec rubocop --parallel |
| 108 | +``` |
| 109 | + |
| 110 | +These are the same commands CI runs (`.github/workflows/rubocop.yml`). |
0 commit comments