diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..cfe9b96c --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1 @@ +FROM ghcr.io/rails/devcontainer/images/ruby:3.3.5 diff --git a/.devcontainer/.devcontainer.json b/.devcontainer/devcontainer.json similarity index 77% rename from .devcontainer/.devcontainer.json rename to .devcontainer/devcontainer.json index 9ab714fc..96f8bcfe 100644 --- a/.devcontainer/.devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,12 +3,19 @@ { "name": "solid_queue", // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile - "image": "ghcr.io/rails/devcontainer/images/ruby:3.3.5", + "build": { + "dockerfile": "Dockerfile" + }, // Features to add to the dev container. More info: https://containers.dev/features. "features": { + "ghcr.io/devcontainers/features/docker-in-docker": {}, "ghcr.io/devcontainers/features/github-cli:1": { "version": "latest" - } + }, + "ghcr.io/rails/devcontainer/features/postgres-client": { + "version": "15" + }, + "ghcr.io/rails/devcontainer/features/mysql-client": {} } // Use 'forwardPorts' to make a list of ports inside the container available locally. // "forwardPorts": [], @@ -18,4 +25,4 @@ // "customizations": {}, // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. // "remoteUser": "root" -} \ No newline at end of file +} diff --git a/Gemfile.lock b/Gemfile.lock index c97dae35..bd3a369d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -87,13 +87,14 @@ GEM loofah (2.23.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) - mini_portile2 (2.8.8) minitest (5.25.4) mocha (2.1.0) ruby2_keywords (>= 0.0.5) mutex_m (0.3.0) mysql2 (0.5.6) nio4r (2.7.4) + nokogiri (1.18.0-aarch64-linux-gnu) + racc (~> 1.4) nokogiri (1.18.0-arm64-darwin) racc (~> 1.4) nokogiri (1.18.0-x86_64-darwin) @@ -172,8 +173,10 @@ GEM ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) securerandom (0.4.1) - sqlite3 (1.5.4) - mini_portile2 (~> 2.8.0) + sqlite3 (2.7.3-aarch64-linux-gnu) + sqlite3 (2.7.3-arm64-darwin) + sqlite3 (2.7.3-x86_64-darwin) + sqlite3 (2.7.3-x86_64-linux-gnu) stringio (3.1.2) thor (1.3.2) timeout (0.4.3) @@ -185,6 +188,7 @@ GEM zeitwerk (2.6.0) PLATFORMS + aarch64-linux arm64-darwin-22 arm64-darwin-23 arm64-darwin-24 diff --git a/Rakefile b/Rakefile index 951e3527..bdb0ea23 100644 --- a/Rakefile +++ b/Rakefile @@ -8,14 +8,36 @@ load "rails/tasks/engine.rake" load "rails/tasks/statistics.rake" require "bundler/gem_tasks" +require "rake/tasklib" -def databases - %w[ mysql postgres sqlite ] -end +class TestHelpers < Rake::TaskLib + def initialize(databases) + @databases = databases + define + end -task :test do - databases.each do |database| + def define + desc "Run tests for all databases (mysql, postgres, sqlite)" + task :test do + @databases.each { |database| run_test_for_database(database) } + end + + namespace :test do + @databases.each do |database| + desc "Run tests for #{database} database" + task database do + run_test_for_database(database) + end + end + end + end + + private + + def run_test_for_database(database) sh("TARGET_DB=#{database} bin/setup") sh("TARGET_DB=#{database} bin/rails test") end end + +TestHelpers.new(%w[ mysql postgres sqlite ]) diff --git a/bin/setup b/bin/setup index 5fbe3e57..3c1f24eb 100755 --- a/bin/setup +++ b/bin/setup @@ -15,6 +15,4 @@ bundle echo "Creating databases..." -rails db:reset TARGET_DB=sqlite -rails db:reset TARGET_DB=mysql -rails db:reset TARGET_DB=postgres +rails db:reset