Skip to content

feat: rewrite with clean api #451

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

Merged
merged 10 commits into from
Jul 20, 2025
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
10 changes: 10 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copy this file to .env and update with your database connection strings

# PostgreSQL primary database
DATABASE_URL_PG=postgresql://closure_tree:[email protected]:5434/closure_tree_test

# MySQL secondary database
DATABASE_URL_MYSQL=mysql2://closure_tree:[email protected]:3367/closure_tree_test

# SQLite database (optional, in-memory by default)
# DATABASE_URL_SQLITE3=sqlite3:closure_tree_test.db
66 changes: 38 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
name: CI

on:
Expand All @@ -9,49 +8,49 @@ on:
branches:
- master


jobs:
test:
runs-on: ubuntu-latest

services:
mysql:
image: mysql/mysql-server
ports:
- "3306:3306"
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: closure_tree_test
MYSQL_ROOT_HOST: '%'
postgres:
image: 'postgres'
ports: ['5432:5432']
image: postgres:17-alpine
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: closure_tree_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

mysql:
image: mysql:8
ports:
- 3306:3306
env:
MYSQL_DATABASE: closure_tree_test
MYSQL_ROOT_PASSWORD: root
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3

strategy:
fail-fast: false
matrix:
ruby:
- '3.3'
- '3.4'
rails:
- activerecord_8.0
- activerecord_7.2
- activerecord_7.1
- activerecord_edge
adapter:
- 'sqlite3:///:memory:'
- mysql2://root:root@0/closure_tree_test
- postgres://closure_tree:closure_tree@0/closure_tree_test
- '8.0'

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Ruby
uses: ruby/setup-ruby@v1
Expand All @@ -60,14 +59,25 @@ jobs:
bundler-cache: true
rubygems: latest
env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile
RAILS_VERSION: ${{ matrix.rails }}
BUNDLE_GEMFILE: ${{ github.workspace }}/Gemfile

- name: Setup databases
env:
RAILS_ENV: test
DATABASE_URL_PG: postgres://postgres:[email protected]:5432/closure_tree_test
DATABASE_URL_MYSQL: mysql2://root:[email protected]:3306/closure_tree_test
DATABASE_URL_SQLITE3: 'sqlite3::memory:'
run: |
cd test/dummy
bundle exec rails db:setup_all

- name: Test
- name: Run tests
env:
RAILS_ENV: test
RAILS_VERSION: ${{ matrix.rails }}
DB_ADAPTER: ${{ matrix.adapter }}
BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile
DATABASE_URL_PG: postgres://postgres:[email protected]:5432/closure_tree_test
DATABASE_URL_MYSQL: mysql2://root:[email protected]:3306/closure_tree_test
DATABASE_URL_SQLITE3: 'sqlite3::memory:'
WITH_ADVISORY_LOCK_PREFIX: ${{ github.run_id }}
run: bin/rake
run: |
bundle exec rake test
69 changes: 0 additions & 69 deletions .github/workflows/ci_jruby.yml

This file was deleted.

72 changes: 0 additions & 72 deletions .github/workflows/ci_truffleruby.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pkg/
rdoc/
doc/
*.sqlite3.db
*.sqlite3
*.log
tmp/
.DS_Store
Expand Down
1 change: 1 addition & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@

{".":"8.0.0"}
51 changes: 0 additions & 51 deletions Appraisals

This file was deleted.

24 changes: 23 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,26 @@ source 'https://rubygems.org'

gemspec

gem 'with_advisory_lock', github: 'closuretree/with_advisory_lock'
gem 'dotenv'
gem 'railties'
Copy link
Preview

Copilot AI May 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider grouping test-only dependencies like railties and the database adapters under group :development, :test to avoid loading them in production environments.

Suggested change
gem 'railties'

Copilot uses AI. Check for mistakes.

gem 'with_advisory_lock', '>= 7'

gem 'activerecord', "~> #{ENV['RAILS_VERSION'] || '8.0'}"

platforms :mri, :truffleruby do
# Database adapters
gem 'mysql2'
gem 'pg'
gem 'sqlite3'
end

# Testing gems
group :test do
gem 'maxitest'
gem 'mocha'
end

# Development gems
group :development do
gem 'rubocop', require: false
end
Loading