From 3a91b71b222eb9187eb53a412d9069db34e7d74d Mon Sep 17 00:00:00 2001 From: SOO Date: Wed, 9 Sep 2026 21:05:16 +0800 Subject: [PATCH 1/3] switch to pg and update workflow --- .github/workflows/ci.yml | 35 +++++++++++++---- .ruby-version | 2 +- Gemfile | 6 +-- Gemfile.lock | 17 ++++----- config/database.yml | 82 ++++++++++++++++++++-------------------- 5 files changed, 81 insertions(+), 61 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a1a9939..a07cec7c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,28 +4,49 @@ on: pull_request: branches: [ main ] +jobs: + test: jobs: test: runs-on: ubuntu-latest + + services: + postgres: + image: postgres + env: + POSTGRES_USER: propro_test + POSTGRES_PASSWORD: propro_test + POSTGRES_DB: propro_test + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + steps: - uses: actions/checkout@v4 - - uses: ruby/setup-ruby@v1 - with: - ruby-version: .ruby-version - bundler-cache: true - - - name: Prepare database run: bin/rails db:schema:load env: RAILS_ENV: test + PGHOST: 127.0.0.1 + PGUSER: propro_test + PGPASSWORD: propro_test - name: Run tests run: bin/rails test env: RAILS_ENV: test + PGHOST: 127.0.0.1 + PGUSER: propro_test + PGPASSWORD: propro_test - name: Run system tests run: bin/rails test:system env: - RAILS_ENV: test \ No newline at end of file + RAILS_ENV: test + PGHOST: 127.0.0.1 + PGUSER: propro_test + PGPASSWORD: propro_test diff --git a/.ruby-version b/.ruby-version index d1a1a38c..a98d9a13 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-3.4.7 \ No newline at end of file +ruby-3.4.10 diff --git a/Gemfile b/Gemfile index 1ce482f1..2065a47a 100644 --- a/Gemfile +++ b/Gemfile @@ -1,13 +1,13 @@ source 'https://rubygems.org' -ruby '3.4.7' +ruby '3.4.10' gem 'csv', require: false # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" gem 'rails', '>= 8.0.2' # The modern asset pipeline for Rails [https://github.com/rails/propshaft] gem 'propshaft' -# Use sqlite3 as the database for Active Record -gem 'sqlite3', '>= 2.1' +# Use postgres as the database for Active Record +gem 'pg' # Use the Puma web server [https://github.com/puma/puma] gem 'puma', '>= 5.0' # Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails] diff --git a/Gemfile.lock b/Gemfile.lock index 9e725119..c21c2486 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -208,6 +208,12 @@ GEM parser (3.3.8.0) ast (~> 2.4.1) racc + pg (1.6.3) + pg (1.6.3-aarch64-linux) + pg (1.6.3-aarch64-linux-musl) + pg (1.6.3-arm64-darwin) + pg (1.6.3-x86_64-linux) + pg (1.6.3-x86_64-linux-musl) pp (0.6.2) prettyprint prettier_print (1.2.1) @@ -320,13 +326,6 @@ GEM railties (>= 7.1) thor (>= 1.3.1) sqids (0.2.2) - sqlite3 (2.7.2-aarch64-linux-gnu) - sqlite3 (2.7.2-aarch64-linux-musl) - sqlite3 (2.7.2-arm-linux-gnu) - sqlite3 (2.7.2-arm-linux-musl) - sqlite3 (2.7.2-arm64-darwin) - sqlite3 (2.7.2-x86_64-linux-gnu) - sqlite3 (2.7.2-x86_64-linux-musl) stimulus-rails (1.3.4) railties (>= 6.0.0) stringio (3.1.7) @@ -401,6 +400,7 @@ DEPENDENCIES htmldiff importmap-rails jbuilder + pg propshaft puma (>= 5.0) pundit (~> 2.5) @@ -410,7 +410,6 @@ DEPENDENCIES selenium-webdriver solid_queue sqids (~> 0.2.2) - sqlite3 (>= 2.1) stimulus-rails tailwindcss-rails (~> 4.3) thruster @@ -419,7 +418,7 @@ DEPENDENCIES web-console RUBY VERSION - ruby 3.4.7p58 + ruby 3.4.10p104 BUNDLED WITH 2.6.7 diff --git a/config/database.yml b/config/database.yml index 729cfaf7..a86e8ae0 100644 --- a/config/database.yml +++ b/config/database.yml @@ -1,41 +1,41 @@ -# SQLite. Versions 3.8.0 and up are supported. -# gem install sqlite3 -# -# Ensure the SQLite 3 gem is defined in your Gemfile -# gem "sqlite3" -# -default: &default - adapter: sqlite3 - pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> - timeout: 5000 - -development: - <<: *default - database: storage/development.sqlite3 - -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. -test: - <<: *default - database: storage/test.sqlite3 - - -# Store production database in the storage/ directory, which by default -# is mounted as a persistent Docker volume in config/deploy.yml. -production: - primary: - <<: *default - database: storage/production.sqlite3 - cache: - <<: *default - database: storage/production_cache.sqlite3 - migrations_paths: db/cache_migrate - queue: - <<: *default - database: storage/production_queue.sqlite3 - migrations_paths: db/queue_migrate - cable: - <<: *default - database: storage/production_cable.sqlite3 - migrations_paths: db/cable_migrate +# SQLite. Versions 3.8.0 and up are supported. +# gem install sqlite3 +# +# Ensure the SQLite 3 gem is defined in your Gemfile +# gem "sqlite3" +# +default: &default + adapter: postgresql + pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> + timeout: 5000 + +development: + <<: *default + database: propro_development + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + <<: *default + database: propro_test + + +# Store production database in the storage/ directory, which by default +# is mounted as a persistent Docker volume in config/deploy.yml. +production: + primary: + <<: *default + database: storage/production.sqlite3 + cache: + <<: *default + database: storage/production_cache.sqlite3 + migrations_paths: db/cache_migrate + queue: + <<: *default + database: storage/production_queue.sqlite3 + migrations_paths: db/queue_migrate + cable: + <<: *default + database: storage/production_cable.sqlite3 + migrations_paths: db/cable_migrate From 33b511ffdab7df079ff20d753654c4b7b3ec092f Mon Sep 17 00:00:00 2001 From: SOO Date: Wed, 9 Sep 2026 21:08:28 +0800 Subject: [PATCH 2/3] fix workflow transplant --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a07cec7c..f94da0ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,8 +4,6 @@ on: pull_request: branches: [ main ] -jobs: - test: jobs: test: runs-on: ubuntu-latest From 98682e2b7f8e308713ad953426f9d30fce1e74d6 Mon Sep 17 00:00:00 2001 From: SOO Date: Wed, 9 Sep 2026 21:10:50 +0800 Subject: [PATCH 3/3] workflow --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f94da0ac..92c5cc1f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,6 +26,12 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: .ruby-version + bundler-cache: true + + - name: Prepare database run: bin/rails db:schema:load env: RAILS_ENV: test