From 84c5dd422bf458b53b484342a70e524eb455944b Mon Sep 17 00:00:00 2001 From: Matt Cruz Date: Thu, 28 Nov 2024 14:56:00 -0500 Subject: [PATCH 01/14] Add jobs to build postgres images --- .github/.keep | 0 .github/workflows/test.yml | 72 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 .github/.keep create mode 100644 .github/workflows/test.yml diff --git a/.github/.keep b/.github/.keep new file mode 100644 index 0000000..e69de29 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..a6beb77 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,72 @@ +name: Run Test Suite + +on: + pull_request: + branches: + - main + +jobs: + export_variables: + runs-on: ubuntu-latest + + outputs: + primary_image: ${{ steps.compute_container_registry_name.outputs.CR_NAME }}/postgres_primary:${{ steps.calculate_primary_sha.outputs.PRIMARY_SHA }} + replica_image: ${{ steps.compute_container_registry_name.outputs.CR_NAME }}/postgres_replica:${{ steps.calculate_replica_sha.outputs.REPLICA_SHA }} + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Compute container registry name + id: compute_container_registry_name + run: echo "CR_NAME=$(echo ghcr.io/${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT + + - name: Calculate SHA256 for postgres_primary.dockerfile + id: calculate_primary_sha + run: echo "PRIMARY_SHA=$(sha256sum postgres_primary.dockerfile | awk '{ print substr($1, 1, 12) }')" >> $GITHUB_OUTPUT + + - name: Calculate SHA256 for postgres_replica.dockerfile + id: calculate_replica_sha + run: echo "REPLICA_SHA=$(sha256sum postgres_replica.dockerfile | awk '{ print substr($1, 1, 12) }')" >> $GITHUB_OUTPUT + + prebuild_primary: + needs: export_variables + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and tag primary Docker image + run: docker build -f postgres_primary.dockerfile -t ${{ needs.export_variables.outputs.primary_image }} . + + - name: Push primary Docker image + run: docker push ${{ needs.export_variables.outputs.primary_image }} + + prebuild_replica: + needs: export_variables + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and tag replica Docker image + run: docker build -f postgres_replica.dockerfile -t ${{ needs.export_variables.outputs.replica_image }} . + + - name: Push replica Docker image + run: docker push ${{ needs.export_variables.outputs.replica_image }} \ No newline at end of file From ff8d780f1d6b51e9fda2620097b2359e11ce0606 Mon Sep 17 00:00:00 2001 From: Matt Cruz Date: Fri, 29 Nov 2024 17:36:27 -0500 Subject: [PATCH 02/14] Add RSpec tests --- .github/workflows/test.yml | 80 +++++++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a6beb77..80816c9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -69,4 +69,82 @@ jobs: run: docker build -f postgres_replica.dockerfile -t ${{ needs.export_variables.outputs.replica_image }} . - name: Push replica Docker image - run: docker push ${{ needs.export_variables.outputs.replica_image }} \ No newline at end of file + run: docker push ${{ needs.export_variables.outputs.replica_image }} + + rspec: + needs: [export_variables, prebuild_primary, prebuild_replica] + runs-on: ubuntu-latest + + strategy: + matrix: + ruby: [3.2.5, 3.3.5] + rails: ['~> 7.0.0', '~> 7.1.0', '~> 8.0.0'] + name: Ruby ${{ matrix.ruby }} / ActiveRecord ${{ matrix.rails }} + services: + postgres_primary: + image: ${{ needs.export_variables.outputs.primary_image }} + ports: + - 5432:5432 + env: + POSTGRES_DB: postgres_primary_test + POSTGRES_USER: postgres_primary_test + POSTGRES_PASSWORD: postgres_primary_test + POSTGRES_HOST_AUTH_METHOD: "scram-sha-256\nhost replication all 0.0.0.0/0 md5" + POSTGRES_INITDB_ARGS: "--auth-host=scram-sha-256" + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + postgres_replica: + image: ${{ needs.export_variables.outputs.replica_image }} + ports: + - 5433:5432 + env: + PGUSER: replicator + PGPASSWORD: replicator + PGPORT: 5432 + PRIMARY_DATABASE_HOST: postgres_primary + PRIMARY_DATABASE_PORT: 5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + + - name: Check if primary is available + run: pg_isready -h localhost -U postgres_primary_test --dbname=postgres -p 5432 + + - name: Check if replica is available + # run: pg_isready -h localhost -U replicator --dbname=postgres -p 5433 + run: pg_isready -h localhost -U postgres_primary_test --dbname=postgres -p 5433 + + - name: Install dependencies + env: + RAILS_VERSION: ${{ matrix.rails }} + run: | + gem install bundler -v 2.5.13 + bundle install + + - name: Run RSpec tests + env: + PG_PRIMARY_USER: postgres_primary_test + PG_PRIMARY_PASSWORD: postgres_primary_test + PG_PRIMARY_HOST: localhost + PG_PRIMARY_PORT: 5432 + PG_REPLICA_USER: postgres_primary_test + PG_REPLICA_PASSWORD: postgres_primary_test + PG_REPLICA_HOST: localhost + PG_REPLICA_PORT: 5433 + + run: bundle exec rspec --format progress From dec46ad257ae036be47c6414290dc8e1970cc1db Mon Sep 17 00:00:00 2001 From: Matt Cruz Date: Fri, 29 Nov 2024 17:54:22 -0500 Subject: [PATCH 03/14] Bump to actions/checkout@v4 --- .github/workflows/test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 80816c9..b0721bc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Compute container registry name id: compute_container_registry_name @@ -35,7 +35,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Log in to GitHub Container Registry uses: docker/login-action@v2 @@ -56,7 +56,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Log in to GitHub Container Registry uses: docker/login-action@v2 @@ -115,7 +115,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Ruby uses: ruby/setup-ruby@v1 From 3ff99c50c6a3d400748472f7da45f119062725cb Mon Sep 17 00:00:00 2001 From: Matt Cruz Date: Fri, 29 Nov 2024 18:08:51 -0500 Subject: [PATCH 04/14] Run rubocop --- .github/workflows/test.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b0721bc..80e31ae 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -71,6 +71,25 @@ jobs: - name: Push replica Docker image run: docker push ${{ needs.export_variables.outputs.replica_image }} + rubocop: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.1.6 + + - name: Install dependencies + run: | + gem install bundler + bundle install + - name: Run RuboCop + run: bundle exec rubocop + rspec: needs: [export_variables, prebuild_primary, prebuild_replica] runs-on: ubuntu-latest @@ -133,7 +152,7 @@ jobs: env: RAILS_VERSION: ${{ matrix.rails }} run: | - gem install bundler -v 2.5.13 + gem install bundler bundle install - name: Run RSpec tests From 7c563d2a87c22e14dcc076c88b4622ce5ad5dd81 Mon Sep 17 00:00:00 2001 From: Matt Cruz Date: Fri, 29 Nov 2024 18:21:46 -0500 Subject: [PATCH 05/14] Add ruby 3.1.6 to test matrix for AR versions 7.0.x and 7.1.x --- .github/workflows/test.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 80e31ae..3fd08ef 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -96,8 +96,19 @@ jobs: strategy: matrix: - ruby: [3.2.5, 3.3.5] - rails: ['~> 7.0.0', '~> 7.1.0', '~> 8.0.0'] + ruby: + - 3.2.5 + - 3.3.5 + rails: + - '~> 7.0.0' + - '~> 7.1.0' + - '~> 8.0.0' + include: + - ruby: 3.1.6 + rails: '~> 7.0.0' + - ruby: 3.1.6 + rails: '~> 7.1.0' + name: Ruby ${{ matrix.ruby }} / ActiveRecord ${{ matrix.rails }} services: postgres_primary: From ad1c7c0d239ccbf4de27e7100ec52bfb33b70499 Mon Sep 17 00:00:00 2001 From: Matt Cruz Date: Fri, 29 Nov 2024 21:28:36 -0500 Subject: [PATCH 06/14] Add coverage report --- Gemfile | 12 +++++++----- Rakefile | 13 +++++++++++++ spec/spec_helper.rb | 26 ++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index f517f1b..e35704c 100644 --- a/Gemfile +++ b/Gemfile @@ -6,11 +6,13 @@ gem "pg", "~> 1.5" gem "rake", "~> 13.0" -gem "rspec", "~> 3.0" - -gem "rubocop", "~> 1.21" - -gem "rubocop-rspec", "~> 3.1.0" +group :test do + gem "rspec", "~> 3.0" + gem "rubocop", "~> 1.21" + gem "rubocop-rspec", "~> 3.1.0" + gem "simplecov" + gem "simplecov-cobertura" +end if ENV["RAILS_VERSION"] gem "activerecord", ENV["RAILS_VERSION"] diff --git a/Rakefile b/Rakefile index cca7175..0157e85 100644 --- a/Rakefile +++ b/Rakefile @@ -10,3 +10,16 @@ require "rubocop/rake_task" RuboCop::RakeTask.new task default: %i[spec rubocop] + +namespace :coverage do + desc "Collates all result sets generated by the different test runners" + task :report do + require "simplecov" + + SimpleCov.collate Dir["coverage/**/.resultset.json"] do + add_group "PostgreSQL" do |src_file| + [/postgresql/, /postgre_sql/].any? { |pattern| pattern.match?(src_file.filename) } + end + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index fa42b08..1008bf8 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,31 @@ # frozen_string_literal: true +require "simplecov" +require "simplecov_json_formatter" +require "active_support/core_ext/object/blank" + +simple_cov_formatters = [SimpleCov::Formatter::JSONFormatter] +simple_cov_formatters << SimpleCov::Formatter::HTMLFormatter unless ENV["CI"] + +SimpleCov.start do + self.formatters = simple_cov_formatters + add_filter "/spec/" + add_group "PostgreSQL" do |src_file| + [/postgresql/, /postgre_sql/].any? { |pattern| pattern.match?(src_file.filename) } + end + + sanitize = ->(filename) { filename.tr(".", "-").tr("~>", "").strip } + ruby_version = sanitize.call(ENV.fetch("RUBY_VERSION", "")) + ar_version = sanitize.call(ENV.fetch("RAILS_VERSION", "")) + coverage_path = [ + "ruby", + ruby_version, + "ar", + ar_version + ].reject(&:blank?).join("-") + + coverage_dir "coverage/#{coverage_path}" +end require "active_record_proxy_adapters" require "active_record_proxy_adapters/connection_handling" From dce406452d7fd08cc8e0ae6a0b5458ec5ecc347e Mon Sep 17 00:00:00 2001 From: Matt Cruz Date: Fri, 29 Nov 2024 21:32:42 -0500 Subject: [PATCH 07/14] Add coverage report --- .github/workflows/test.yml | 50 +++++++++++++++++++++++++++++++++----- Gemfile | 4 +-- 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3fd08ef..68863de 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -100,15 +100,15 @@ jobs: - 3.2.5 - 3.3.5 rails: - - '~> 7.0.0' - - '~> 7.1.0' - - '~> 8.0.0' + - 7.0.0 + - 7.1.0 + - 8.0.0 include: - ruby: 3.1.6 - rails: '~> 7.0.0' + rails: 7.0.0 - ruby: 3.1.6 - rails: '~> 7.1.0' - + rails: 7.1.0 + name: Ruby ${{ matrix.ruby }} / ActiveRecord ${{ matrix.rails }} services: postgres_primary: @@ -178,3 +178,41 @@ jobs: PG_REPLICA_PORT: 5433 run: bundle exec rspec --format progress + + - name: Upload Coverage Report + uses: actions/upload-artifact@v4 + with: + name: ${{ env.RUN_UNIQUE_ID }}_artifact_${{ matrix.ruby }}_${{ matrix.rails }} + path: coverage/ + include-hidden-files: true + if-no-files-found: error + + coverage_report: + needs: [rspec] + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.3.5 + + - name: Install Dependencies + run: | + gem install bundler + bundle install + + - name: Download Partial Coverage Resultsets + uses: actions/download-artifact@v4 + with: + path: coverage/ + + - name: Collate Partial Coverage Resultsets + run: bundle exec rake coverage:report + + - uses: joshmfrankel/simplecov-check-action@main + with: + github_token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/Gemfile b/Gemfile index e35704c..a4420e7 100644 --- a/Gemfile +++ b/Gemfile @@ -15,8 +15,8 @@ group :test do end if ENV["RAILS_VERSION"] - gem "activerecord", ENV["RAILS_VERSION"] - gem "activesupport", ENV["RAILS_VERSION"] + gem "activerecord", "~> #{ENV["RAILS_VERSION"]}" + gem "activesupport", "~> #{ENV["RAILS_VERSION"]}" end # Specify your gem's dependencies in active_record_proxy_adapters.gemspec From 1d61edcb82378ee9bad3e69d89ec3a24cc637db7 Mon Sep 17 00:00:00 2001 From: Matt Cruz Date: Fri, 29 Nov 2024 22:15:21 -0500 Subject: [PATCH 08/14] Use latest ruby patches --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 68863de..8c0d8f1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -97,8 +97,8 @@ jobs: strategy: matrix: ruby: - - 3.2.5 - - 3.3.5 + - 3.2.6 + - 3.3.6 rails: - 7.0.0 - 7.1.0 From 9e53574ea0f8b9f18193bead738f950d21024a95 Mon Sep 17 00:00:00 2001 From: Matt Cruz Date: Fri, 29 Nov 2024 22:21:17 -0500 Subject: [PATCH 09/14] Move prebuild of Postgres primary to separate workflow --- .../workflows/prebuild_postgres_primary.yml | 46 +++++++++++++++++++ .github/workflows/test.yml | 23 +--------- 2 files changed, 47 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/prebuild_postgres_primary.yml diff --git a/.github/workflows/prebuild_postgres_primary.yml b/.github/workflows/prebuild_postgres_primary.yml new file mode 100644 index 0000000..9685808 --- /dev/null +++ b/.github/workflows/prebuild_postgres_primary.yml @@ -0,0 +1,46 @@ +name: Build Postgres Primary Image + +on: + pull_request: + paths: + - 'postgres_primary.dockerfile' + +jobs: + export_variables: + runs-on: ubuntu-latest + + outputs: + primary_image: ${{ steps.compute_container_registry_name.outputs.CR_NAME }}/postgres_primary:${{ steps.calculate_primary_sha.outputs.PRIMARY_SHA }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Compute container registry name + id: compute_container_registry_name + run: echo "CR_NAME=$(echo ghcr.io/${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT + + - name: Calculate SHA256 for postgres_primary.dockerfile + id: calculate_primary_sha + run: echo "PRIMARY_SHA=$(sha256sum postgres_primary.dockerfile | awk '{ print substr($1, 1, 12) }')" >> $GITHUB_OUTPUT + + prebuild_primary: + needs: export_variables + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and tag primary Docker image + run: docker build -f postgres_primary.dockerfile -t ${{ needs.export_variables.outputs.primary_image }} . + + - name: Push primary Docker image + run: docker push ${{ needs.export_variables.outputs.primary_image }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8c0d8f1..f6ccc80 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,27 +29,6 @@ jobs: id: calculate_replica_sha run: echo "REPLICA_SHA=$(sha256sum postgres_replica.dockerfile | awk '{ print substr($1, 1, 12) }')" >> $GITHUB_OUTPUT - prebuild_primary: - needs: export_variables - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Log in to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and tag primary Docker image - run: docker build -f postgres_primary.dockerfile -t ${{ needs.export_variables.outputs.primary_image }} . - - - name: Push primary Docker image - run: docker push ${{ needs.export_variables.outputs.primary_image }} - prebuild_replica: needs: export_variables runs-on: ubuntu-latest @@ -91,7 +70,7 @@ jobs: run: bundle exec rubocop rspec: - needs: [export_variables, prebuild_primary, prebuild_replica] + needs: [export_variables, prebuild_replica] runs-on: ubuntu-latest strategy: From de335f930f0598622b5b788c9e7c05b94cb7b69e Mon Sep 17 00:00:00 2001 From: Matt Cruz Date: Fri, 29 Nov 2024 22:31:16 -0500 Subject: [PATCH 10/14] Move prebuild of Postgres replica to separate workflow --- .../workflows/prebuild_postgres_replica.yml | 46 +++++++++++++++++++ .github/workflows/test.yml | 23 +--------- 2 files changed, 47 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/prebuild_postgres_replica.yml diff --git a/.github/workflows/prebuild_postgres_replica.yml b/.github/workflows/prebuild_postgres_replica.yml new file mode 100644 index 0000000..f907cf1 --- /dev/null +++ b/.github/workflows/prebuild_postgres_replica.yml @@ -0,0 +1,46 @@ +name: Build Postgres Replica Image + +on: + pull_request: + paths: + - 'postgres_replica.dockerfile' + +jobs: + export_variables: + runs-on: ubuntu-latest + + outputs: + replica_image: ${{ steps.compute_container_registry_name.outputs.CR_NAME }}/postgres_replica:${{ steps.calculate_replica_sha.outputs.REPLICA_SHA }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Compute container registry name + id: compute_container_registry_name + run: echo "CR_NAME=$(echo ghcr.io/${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT + + - name: Calculate SHA256 for postgres_replica.dockerfile + id: calculate_replica_sha + run: echo "REPLICA_SHA=$(sha256sum postgres_replica.dockerfile | awk '{ print substr($1, 1, 12) }')" >> $GITHUB_OUTPUT + + prebuild_replica: + needs: export_variables + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and tag replica Docker image + run: docker build -f postgres_replica.dockerfile -t ${{ needs.export_variables.outputs.replica_image }} . + + - name: Push replica Docker image + run: docker push ${{ needs.export_variables.outputs.replica_image }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f6ccc80..9569020 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,27 +29,6 @@ jobs: id: calculate_replica_sha run: echo "REPLICA_SHA=$(sha256sum postgres_replica.dockerfile | awk '{ print substr($1, 1, 12) }')" >> $GITHUB_OUTPUT - prebuild_replica: - needs: export_variables - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Log in to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and tag replica Docker image - run: docker build -f postgres_replica.dockerfile -t ${{ needs.export_variables.outputs.replica_image }} . - - - name: Push replica Docker image - run: docker push ${{ needs.export_variables.outputs.replica_image }} - rubocop: runs-on: ubuntu-latest @@ -70,7 +49,7 @@ jobs: run: bundle exec rubocop rspec: - needs: [export_variables, prebuild_replica] + needs: [export_variables] runs-on: ubuntu-latest strategy: From 638b118fef671c511f1f35bf28a810d42c40f9b9 Mon Sep 17 00:00:00 2001 From: Matt Cruz Date: Fri, 29 Nov 2024 23:13:31 -0500 Subject: [PATCH 11/14] Default to latest versions of Ruby and Rails in docker compose --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 205454b..255f5a1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,8 +15,8 @@ services: app: build: args: - - RUBY_VERSION=${RUBY_VERSION:-3.2.3} - - RAILS_VERSION=${RAILS_VERSION:-~> 6.1.0} + - RUBY_VERSION=${RUBY_VERSION:-3.3.6} + - RAILS_VERSION=${RAILS_VERSION:-8.0.0} container_name: app image: active_record_proxy_adapters-app:${ENV_TAG:-latest} tty: true From 206b308267649811738585a28a84619b4bda7a93 Mon Sep 17 00:00:00 2001 From: Matt Cruz Date: Fri, 29 Nov 2024 23:18:55 -0500 Subject: [PATCH 12/14] Use command_name per matrix run --- spec/spec_helper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 1008bf8..480d454 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -14,7 +14,7 @@ [/postgresql/, /postgre_sql/].any? { |pattern| pattern.match?(src_file.filename) } end - sanitize = ->(filename) { filename.tr(".", "-").tr("~>", "").strip } + sanitize = ->(filename) { filename.tr(".", "_").tr("~>", "").strip } ruby_version = sanitize.call(ENV.fetch("RUBY_VERSION", "")) ar_version = sanitize.call(ENV.fetch("RAILS_VERSION", "")) coverage_path = [ @@ -25,6 +25,7 @@ ].reject(&:blank?).join("-") coverage_dir "coverage/#{coverage_path}" + command_name "Ruby-#{ruby_version}-AR-#{ar_version}" end require "active_record_proxy_adapters" require "active_record_proxy_adapters/connection_handling" From d20db19cd9f17864eb6be0227f09ffb708aeafcf Mon Sep 17 00:00:00 2001 From: Matt Cruz Date: Fri, 29 Nov 2024 23:20:38 -0500 Subject: [PATCH 13/14] Add missing trailing newline --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9569020..28eb3a1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -173,4 +173,4 @@ jobs: - uses: joshmfrankel/simplecov-check-action@main with: - github_token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + github_token: ${{ secrets.GITHUB_TOKEN }} From d016b7369efa37a1eb43a7b9a16526eb7bdd2739 Mon Sep 17 00:00:00 2001 From: Matt Cruz Date: Fri, 29 Nov 2024 23:22:43 -0500 Subject: [PATCH 14/14] Add missing inline env vars --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 28eb3a1..9a40615 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -135,7 +135,7 @@ jobs: PG_REPLICA_HOST: localhost PG_REPLICA_PORT: 5433 - run: bundle exec rspec --format progress + run: RUBY_VERSION="${{ matrix.ruby }}" RAILS_VERSION="${{ matrix.rails }}" bundle exec rspec --format progress - name: Upload Coverage Report uses: actions/upload-artifact@v4