From 0fc8bb1524235251952e5dc6aed4eec8288f8e4b Mon Sep 17 00:00:00 2001 From: Joseph Southan Date: Tue, 19 Sep 2023 16:55:16 +0100 Subject: [PATCH 1/3] Remove support for Ruby =< 2.7 And move to github actions --- .github/dependabot.yml | 7 +++ .github/workflows/tests.yml | 60 +++++++++++++++++++ .rubocop.yml | 12 +++- .rubocop_todo.yml | 20 ------- .ruby-version | 2 +- CHANGELOG.md | 4 ++ Gemfile | 8 ++- activerecord-safer_migrations.gemspec | 9 +-- lib/active_record/safer_migrations/version.rb | 2 +- 9 files changed, 92 insertions(+), 32 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/tests.yml delete mode 100644 .rubocop_todo.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..452ebb3 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: +- package-ecosystem: bundler + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..706e5cb --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,60 @@ +name: tests + +on: + push: + branches: + - "master" + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + rubocop: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + - run: bundle exec rubocop --extra-details --display-style-guide --parallel --force-exclusion + + tests: + strategy: + fail-fast: false + matrix: + ruby-version: ["2.7", "3.0", "3.1", "3.2"] + activerecord-version: + - "6.1.5" + - "7.0.8" + - "7.1.0.beta1" + runs-on: ubuntu-latest + services: + postgres: + image: postgres:14 + env: + POSTGRES_USER: postgres + POSTGRES_DB: statesman_test + POSTGRES_PASSWORD: statesman + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 10 + env: + DATABASE_URL: postgres://postgres:statesman@localhost/statesman_test + DATABASE_DEPENDENCY_PORT: "5432" + ACTIVERECORD_VERSION: "${{ matrix.activerecord-version }}" + steps: + - uses: actions/checkout@v4 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + ruby-version: "${{ matrix.ruby-version }}" + - name: Run specs + run: | + bundle exec rspec --profile --format progress diff --git a/.rubocop.yml b/.rubocop.yml index 1004c33..ba711f9 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,10 +1,16 @@ -inherit_from: .rubocop_todo.yml - inherit_gem: gc_ruboconfig: rubocop.yml AllCops: - TargetRubyVersion: 2.7 + TargetRubyVersion: 3.2 Gemspec/RequiredRubyVersion: Enabled: false + +Naming/FileName: + Exclude: + - lib/activerecord-safer_migrations.rb + +Style/GlobalVars: + Exclude: + - "spec/active_record/safer_migrations/migration_spec.rb" diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml deleted file mode 100644 index 836e7bf..0000000 --- a/.rubocop_todo.yml +++ /dev/null @@ -1,20 +0,0 @@ -# This configuration was generated by -# `rubocop --auto-gen-config` -# on 2018-03-27 12:04:06 +0100 using RuboCop version 0.54.0. -# The point is for the user to remove these configuration records -# one by one as the offenses are removed from the code base. -# Note that changes in the inspected code, or installation of new -# versions of RuboCop, may require this file to be generated again. - -# Offense count: 1 -# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms. -# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS -Naming/FileName: - Exclude: - - 'lib/activerecord-safer_migrations.rb' - -# Offense count: 20 -# Configuration parameters: AllowedVariables. -Style/GlobalVars: - Exclude: - - 'spec/active_record/safer_migrations/migration_spec.rb' diff --git a/.ruby-version b/.ruby-version index 860487c..be94e6f 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.1 +3.2.2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 602833e..d5d1acb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 4.0.0 / 2023-09-19 + +- Remove support for Ruby =< 2.7 + # 3.0.0 / 2020-09-28 - [#55](https://github.com/gocardless/activerecord-safer_migrations/pull/55) Drop support for Ruby =< 2.4 and Rails =< 5.1 diff --git a/Gemfile b/Gemfile index 1734ecb..e203e08 100644 --- a/Gemfile +++ b/Gemfile @@ -5,4 +5,10 @@ source "https://rubygems.org" gemspec gem "activerecord", "~> #{ENV['ACTIVERECORD_VERSION']}" if ENV["ACTIVERECORD_VERSION"] -gem "gc_ruboconfig", "~> 2.19.0" + +group :test, :development do + gem "gc_ruboconfig", "~> 4.3" + gem "pg", "~> 1.4" + gem "rspec", "~> 3.9.0" + gem "rubocop", "~> 1.56.3" +end diff --git a/activerecord-safer_migrations.gemspec b/activerecord-safer_migrations.gemspec index 51888a7..c380da3 100644 --- a/activerecord-safer_migrations.gemspec +++ b/activerecord-safer_migrations.gemspec @@ -14,11 +14,8 @@ Gem::Specification.new do |gem| gem.homepage = "https://github.com/gocardless/activerecord-safer_migrations" gem.license = "MIT" - gem.required_ruby_version = ">= 2.5" + gem.required_ruby_version = ">= 2.7" - gem.add_runtime_dependency "activerecord", ">= 5.2" - - gem.add_development_dependency "pg", "~> 1.2.3" - gem.add_development_dependency "rspec", "~> 3.9.0" - gem.add_development_dependency "rubocop", "~> 0.92.0" + gem.add_runtime_dependency "activerecord", ">= 6.0" + gem.metadata["rubygems_mfa_required"] = "true" end diff --git a/lib/active_record/safer_migrations/version.rb b/lib/active_record/safer_migrations/version.rb index 945e8d9..460d317 100644 --- a/lib/active_record/safer_migrations/version.rb +++ b/lib/active_record/safer_migrations/version.rb @@ -2,6 +2,6 @@ module ActiveRecord module SaferMigrations - VERSION = "3.0.0" + VERSION = "4.0.0" end end From 5e50084d15e626457be81340307fa37e75cbd1a7 Mon Sep 17 00:00:00 2001 From: Martin Nefjodov Date: Wed, 21 Aug 2024 11:43:58 +0100 Subject: [PATCH 2/3] feat: update activerecord versions to test for --- .github/workflows/tests.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 706e5cb..d5d9189 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,11 +24,12 @@ jobs: strategy: fail-fast: false matrix: - ruby-version: ["2.7", "3.0", "3.1", "3.2"] + ruby-version: ["2.7", "3.0", "3.1", "3.3"] activerecord-version: - "6.1.5" - "7.0.8" - - "7.1.0.beta1" + - "7.1.3.4" + - "7.2.0" runs-on: ubuntu-latest services: postgres: From 6edf722f6254cd94f65f031e5809908d89f2001b Mon Sep 17 00:00:00 2001 From: Joseph Southan Date: Wed, 21 Aug 2024 11:52:27 +0100 Subject: [PATCH 3/3] Drop Ruby 3.0 support --- .circleci/config.yml | 55 --------------------------- .github/workflows/tests.yml | 9 ++--- .rubocop.yml | 1 + .ruby-version | 2 +- CHANGELOG.md | 4 +- Gemfile | 3 +- activerecord-safer_migrations.gemspec | 4 +- lib/activerecord-safer_migrations.rb | 2 +- 8 files changed, 12 insertions(+), 68 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 7ed1e93..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,55 +0,0 @@ -version: 2.1 - -jobs: - test: - docker: - - image: circleci/ruby:<< parameters.ruby-version >> - - image: postgres:11.3 - environment: - POSTGRES_USER: postgres - POSTGRES_DB: safer_migrations_test - POSTGRES_PASSWORD: "" - POSTGRES_HOST_AUTH_METHOD: trust - environment: - DATABASE_URL: postgres://postgres@localhost/safer_migrations_test - ACTIVERECORD_VERSION: << parameters.activerecord-version >> - parameters: - ruby-version: - type: string - activerecord-version: - type: string - steps: - - checkout - - restore_cache: - keys: - - bundle-v1-<< parameters.ruby-version >>-{{ checksum "activerecord-safer_migrations.gemspec" }} - - bundle-v1-<< parameters.ruby-version >>- - - run: - name: Install dependencies - command: bundle install --clean --no-cache --path vendor/bundle --jobs=4 --retry=3 - - save_cache: - key: bundle-v1-<< parameters.ruby-version >>-{{ checksum "activerecord-safer_migrations.gemspec" }} - paths: - - vendor/bundle - - run: - name: Run tests - command: bundle exec rspec - - run: - name: Run rubocop - command: bundle exec rubocop --parallel --extra-details --display-style-guide - -workflows: - default: - jobs: - - test: - name: "Ruby << matrix.ruby-version >> : ActiveRecord << matrix.activerecord-version >>" - matrix: - parameters: - activerecord-version: - - 5.2.4.4 - - 6.0.3.3 - ruby-version: - - 2.5.8 - - 2.6.6 - - 2.7.1 - # - 3.0.0-preview1 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d5d9189..8b3f8eb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,9 +24,8 @@ jobs: strategy: fail-fast: false matrix: - ruby-version: ["2.7", "3.0", "3.1", "3.3"] + ruby-version: ["3.1", "3.2", "3.3"] activerecord-version: - - "6.1.5" - "7.0.8" - "7.1.3.4" - "7.2.0" @@ -36,8 +35,8 @@ jobs: image: postgres:14 env: POSTGRES_USER: postgres - POSTGRES_DB: statesman_test - POSTGRES_PASSWORD: statesman + POSTGRES_DB: safer_migrations_test + POSTGRES_PASSWORD: safer_migrations ports: - 5432:5432 options: >- @@ -46,7 +45,7 @@ jobs: --health-timeout 5s --health-retries 10 env: - DATABASE_URL: postgres://postgres:statesman@localhost/statesman_test + DATABASE_URL: postgres://postgres:safer_migrations@localhost/safer_migrations_test DATABASE_DEPENDENCY_PORT: "5432" ACTIVERECORD_VERSION: "${{ matrix.activerecord-version }}" steps: diff --git a/.rubocop.yml b/.rubocop.yml index ba711f9..f178713 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -3,6 +3,7 @@ inherit_gem: AllCops: TargetRubyVersion: 3.2 + NewCops: enable Gemspec/RequiredRubyVersion: Enabled: false diff --git a/.ruby-version b/.ruby-version index be94e6f..a0891f5 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.2.2 +3.3.4 diff --git a/CHANGELOG.md b/CHANGELOG.md index d5d1acb..17397ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ -# 4.0.0 / 2023-09-19 +# 4.0.0 / 2024-08-21 -- Remove support for Ruby =< 2.7 +- Remove support for Ruby =< 3.0 and Rails =< 6.0 # 3.0.0 / 2020-09-28 diff --git a/Gemfile b/Gemfile index e203e08..e230e70 100644 --- a/Gemfile +++ b/Gemfile @@ -7,8 +7,7 @@ gemspec gem "activerecord", "~> #{ENV['ACTIVERECORD_VERSION']}" if ENV["ACTIVERECORD_VERSION"] group :test, :development do - gem "gc_ruboconfig", "~> 4.3" + gem "gc_ruboconfig", "~> 5.0" gem "pg", "~> 1.4" gem "rspec", "~> 3.9.0" - gem "rubocop", "~> 1.56.3" end diff --git a/activerecord-safer_migrations.gemspec b/activerecord-safer_migrations.gemspec index c380da3..626054d 100644 --- a/activerecord-safer_migrations.gemspec +++ b/activerecord-safer_migrations.gemspec @@ -14,8 +14,8 @@ Gem::Specification.new do |gem| gem.homepage = "https://github.com/gocardless/activerecord-safer_migrations" gem.license = "MIT" - gem.required_ruby_version = ">= 2.7" + gem.required_ruby_version = ">= 3.1" - gem.add_runtime_dependency "activerecord", ">= 6.0" + gem.add_dependency "activerecord", ">= 7.0" gem.metadata["rubygems_mfa_required"] = "true" end diff --git a/lib/activerecord-safer_migrations.rb b/lib/activerecord-safer_migrations.rb index 34f80d4..68c6798 100644 --- a/lib/activerecord-safer_migrations.rb +++ b/lib/activerecord-safer_migrations.rb @@ -37,4 +37,4 @@ def self.load end end -require "active_record/safer_migrations/railtie" if defined?(::Rails) +require "active_record/safer_migrations/railtie" if defined?(Rails)