diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 412fc2f8..d0f0bd94 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -6,13 +6,20 @@ jobs: build: runs-on: ubuntu-latest - + name: Ruby ${{ matrix.ruby }} + strategy: + matrix: + gemfile: [Gemfile, gemfiles/rails_6_0.gemfile, gemfiles/rails_edge.gemfile] + ruby: [2.7, 3.0] + env: + BUNDLE_GEMFILE: ${{ matrix.gemfile }} steps: - name: Check out code uses: actions/checkout@v2 - - name: Set up Ruby + - name: Set up Ruby ${{ matrix.ruby }} uses: ruby/setup-ruby@v1 with: + ruby-version: ${{ matrix.ruby }} bundler-cache: true - name: Set up database run: RAILS_ENV=test bundle exec rails db:setup diff --git a/Gemfile b/Gemfile index 4c3d7a4b..b325ba97 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,7 @@ gem "capybara" gem "mocha" gem "pry-byebug" gem "puma" -gem "rails" +gem "rails", defined?(@rails_gem_requirement) && @rails_gem_requirement gem "rubocop-shopify" gem "selenium-webdriver" gem "sqlite3" diff --git a/Gemfile.lock b/Gemfile.lock index 93b0b82a..7fed5745 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -109,6 +109,10 @@ GEM nokogiri (1.11.2) mini_portile2 (~> 2.5.0) racc (~> 1.4) + nokogiri (1.11.2-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.11.2-x86_64-linux) + racc (~> 1.4) parallel (1.20.1) parser (3.0.0.0) ast (~> 2.4.1) @@ -199,6 +203,8 @@ GEM PLATFORMS ruby + x86_64-darwin-19 + x86_64-linux DEPENDENCIES capybara diff --git a/README.md b/README.md index 8593cf72..9ca86700 100644 --- a/README.md +++ b/README.md @@ -424,6 +424,12 @@ pull requests. You can find the contribution guidelines on [contributing]: https://github.com/Shopify/maintenance_tasks/blob/main/.github/CONTRIBUTING.md +### Dependabot updates + +Whenever Dependabot creates a PR for a gem bump, check out the branch locally +and run `bin/update-gemfile ` to ensure all the gemfiles have the gem +updated consistently. + ## Releasing new versions Updates should be added to the latest draft release on GitHub as Pull Requests @@ -432,14 +438,14 @@ are merged. Once a release is ready, follow these steps: * Update `spec.version` in `maintenance_tasks.gemspec`. -* Run `bundle install` to bump the `Gemfile.lock` version of the gem. +* Run `bin/gemfile-update install` to bump the version in all the lockfiles. * Open a PR and merge on approval. * Deploy via [Shipit][shipit] and see the new version on . * Ensure the release has documented all changes and publish it. -* Create a new [draft release on GitHub][release] with the title - 'Upcoming Release'. The tag version can be left blank. This will be the - starting point for documenting changes related to the next release. +* Create a new [draft release on GitHub][release] with the title 'Upcoming + Release'. The tag version can be left blank. This will be the starting point + for documenting changes related to the next release. [release]: https://help.github.com/articles/creating-releases/ [shipit]: https://shipit.shopify.io/shopify/maintenance_tasks/rubygems diff --git a/bin/gemfile-update b/bin/gemfile-update new file mode 100755 index 00000000..b929975a --- /dev/null +++ b/bin/gemfile-update @@ -0,0 +1,11 @@ +#!/bin/bash + +set -ex + +for gemfile in Gemfile gemfiles/*.gemfile; do + if [ install = "$1" ]; then + BUNDLE_GEMFILE="$gemfile" bundle install + else + BUNDLE_GEMFILE="$gemfile" bundle update "${1:?provide a gem to update}" + fi +done diff --git a/gemfiles/rails_6_0.gemfile b/gemfiles/rails_6_0.gemfile new file mode 100644 index 00000000..d59c71e1 --- /dev/null +++ b/gemfiles/rails_6_0.gemfile @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +@rails_gem_requirement = "~> 6.0.0" + +eval_gemfile "../Gemfile" diff --git a/gemfiles/rails_6_0.gemfile.lock b/gemfiles/rails_6_0.gemfile.lock new file mode 100644 index 00000000..2fcd76b3 --- /dev/null +++ b/gemfiles/rails_6_0.gemfile.lock @@ -0,0 +1,220 @@ +PATH + remote: .. + specs: + maintenance_tasks (1.2.1) + actionpack (>= 6.0) + activejob (>= 6.0) + activerecord (>= 6.0) + job-iteration (~> 1.1) + railties (>= 6.0) + +GEM + remote: https://rubygems.org/ + specs: + actioncable (6.0.3.6) + actionpack (= 6.0.3.6) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (6.0.3.6) + actionpack (= 6.0.3.6) + activejob (= 6.0.3.6) + activerecord (= 6.0.3.6) + activestorage (= 6.0.3.6) + activesupport (= 6.0.3.6) + mail (>= 2.7.1) + actionmailer (6.0.3.6) + actionpack (= 6.0.3.6) + actionview (= 6.0.3.6) + activejob (= 6.0.3.6) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (6.0.3.6) + actionview (= 6.0.3.6) + activesupport (= 6.0.3.6) + rack (~> 2.0, >= 2.0.8) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.0.3.6) + actionpack (= 6.0.3.6) + activerecord (= 6.0.3.6) + activestorage (= 6.0.3.6) + activesupport (= 6.0.3.6) + nokogiri (>= 1.8.5) + actionview (6.0.3.6) + activesupport (= 6.0.3.6) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (6.0.3.6) + activesupport (= 6.0.3.6) + globalid (>= 0.3.6) + activemodel (6.0.3.6) + activesupport (= 6.0.3.6) + activerecord (6.0.3.6) + activemodel (= 6.0.3.6) + activesupport (= 6.0.3.6) + activestorage (6.0.3.6) + actionpack (= 6.0.3.6) + activejob (= 6.0.3.6) + activerecord (= 6.0.3.6) + marcel (~> 1.0.0) + activesupport (6.0.3.6) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + zeitwerk (~> 2.2, >= 2.2.2) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + ast (2.4.2) + builder (3.2.4) + byebug (11.1.3) + capybara (3.35.3) + addressable + mini_mime (>= 0.1.3) + nokogiri (~> 1.8) + rack (>= 1.6.0) + rack-test (>= 0.6.3) + regexp_parser (>= 1.5, < 3.0) + xpath (~> 3.2) + childprocess (3.0.0) + coderay (1.1.3) + concurrent-ruby (1.1.8) + crass (1.0.6) + erubi (1.10.0) + globalid (0.4.2) + activesupport (>= 4.2.0) + i18n (1.8.9) + concurrent-ruby (~> 1.0) + job-iteration (1.1.9) + activejob (>= 5.2) + loofah (2.9.0) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.7.1) + mini_mime (>= 0.1.1) + marcel (1.0.0) + method_source (1.0.0) + mini_mime (1.0.3) + mini_portile2 (2.5.0) + minitest (5.14.4) + mocha (1.12.0) + nio4r (2.5.7) + nokogiri (1.11.2) + mini_portile2 (~> 2.5.0) + racc (~> 1.4) + nokogiri (1.11.2-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.11.2-x86_64-linux) + racc (~> 1.4) + parallel (1.20.1) + parser (3.0.0.0) + ast (~> 2.4.1) + pry (0.13.1) + coderay (~> 1.1) + method_source (~> 1.0) + pry-byebug (3.9.0) + byebug (~> 11.0) + pry (~> 0.13.0) + public_suffix (4.0.6) + puma (5.2.2) + nio4r (~> 2.0) + racc (1.5.2) + rack (2.2.3) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (6.0.3.6) + actioncable (= 6.0.3.6) + actionmailbox (= 6.0.3.6) + actionmailer (= 6.0.3.6) + actionpack (= 6.0.3.6) + actiontext (= 6.0.3.6) + actionview (= 6.0.3.6) + activejob (= 6.0.3.6) + activemodel (= 6.0.3.6) + activerecord (= 6.0.3.6) + activestorage (= 6.0.3.6) + activesupport (= 6.0.3.6) + bundler (>= 1.3.0) + railties (= 6.0.3.6) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) + railties (6.0.3.6) + actionpack (= 6.0.3.6) + activesupport (= 6.0.3.6) + method_source + rake (>= 0.8.7) + thor (>= 0.20.3, < 2.0) + rainbow (3.0.0) + rake (13.0.3) + regexp_parser (2.1.1) + rexml (3.2.4) + rubocop (1.12.0) + parallel (~> 1.10) + parser (>= 3.0.0.0) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml + rubocop-ast (>= 1.2.0, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 1.4.0, < 3.0) + rubocop-ast (1.4.1) + parser (>= 2.7.1.5) + rubocop-shopify (2.0.1) + rubocop (~> 1.11) + ruby-progressbar (1.11.0) + rubyzip (2.3.0) + selenium-webdriver (3.142.7) + childprocess (>= 0.5, < 4.0) + rubyzip (>= 1.2.2) + sprockets (4.0.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.2) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sqlite3 (1.4.2) + thor (1.1.0) + thread_safe (0.3.6) + tzinfo (1.2.9) + thread_safe (~> 0.1) + unicode-display_width (2.0.0) + webdrivers (4.6.0) + nokogiri (~> 1.6) + rubyzip (>= 1.3.0) + selenium-webdriver (>= 3.0, < 4.0) + websocket-driver (0.7.3) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + xpath (3.2.0) + nokogiri (~> 1.8) + yard (0.9.26) + zeitwerk (2.4.2) + +PLATFORMS + ruby + x86_64-darwin-19 + x86_64-linux + +DEPENDENCIES + capybara + maintenance_tasks! + mocha + pry-byebug + puma + rails (~> 6.0.0) + rubocop-shopify + selenium-webdriver + sqlite3 + webdrivers + yard + +BUNDLED WITH + 2.2.5 diff --git a/gemfiles/rails_edge.gemfile b/gemfiles/rails_edge.gemfile new file mode 100644 index 00000000..cf31c938 --- /dev/null +++ b/gemfiles/rails_edge.gemfile @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +@rails_gem_requirement = { github: "rails/rails" } + +eval_gemfile "../Gemfile" diff --git a/gemfiles/rails_edge.gemfile.lock b/gemfiles/rails_edge.gemfile.lock new file mode 100644 index 00000000..defa8a13 --- /dev/null +++ b/gemfiles/rails_edge.gemfile.lock @@ -0,0 +1,228 @@ +GIT + remote: https://github.com/rails/rails.git + revision: 6675f6b785d9ea7f6650344fb98555fc5acb0a3d + specs: + actioncable (7.0.0.alpha) + actionpack (= 7.0.0.alpha) + activesupport (= 7.0.0.alpha) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (7.0.0.alpha) + actionpack (= 7.0.0.alpha) + activejob (= 7.0.0.alpha) + activerecord (= 7.0.0.alpha) + activestorage (= 7.0.0.alpha) + activesupport (= 7.0.0.alpha) + mail (>= 2.7.1) + actionmailer (7.0.0.alpha) + actionpack (= 7.0.0.alpha) + actionview (= 7.0.0.alpha) + activejob (= 7.0.0.alpha) + activesupport (= 7.0.0.alpha) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (7.0.0.alpha) + actionview (= 7.0.0.alpha) + activesupport (= 7.0.0.alpha) + rack (~> 2.0, >= 2.0.9) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (7.0.0.alpha) + actionpack (= 7.0.0.alpha) + activerecord (= 7.0.0.alpha) + activestorage (= 7.0.0.alpha) + activesupport (= 7.0.0.alpha) + nokogiri (>= 1.8.5) + actionview (7.0.0.alpha) + activesupport (= 7.0.0.alpha) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (7.0.0.alpha) + activesupport (= 7.0.0.alpha) + globalid (>= 0.3.6) + activemodel (7.0.0.alpha) + activesupport (= 7.0.0.alpha) + activerecord (7.0.0.alpha) + activemodel (= 7.0.0.alpha) + activesupport (= 7.0.0.alpha) + activestorage (7.0.0.alpha) + actionpack (= 7.0.0.alpha) + activejob (= 7.0.0.alpha) + activerecord (= 7.0.0.alpha) + activesupport (= 7.0.0.alpha) + marcel (~> 1.0.0) + mini_mime (~> 1.0.2) + activesupport (7.0.0.alpha) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) + rails (7.0.0.alpha) + actioncable (= 7.0.0.alpha) + actionmailbox (= 7.0.0.alpha) + actionmailer (= 7.0.0.alpha) + actionpack (= 7.0.0.alpha) + actiontext (= 7.0.0.alpha) + actionview (= 7.0.0.alpha) + activejob (= 7.0.0.alpha) + activemodel (= 7.0.0.alpha) + activerecord (= 7.0.0.alpha) + activestorage (= 7.0.0.alpha) + activesupport (= 7.0.0.alpha) + bundler (>= 1.15.0) + railties (= 7.0.0.alpha) + sprockets-rails (>= 2.0.0) + railties (7.0.0.alpha) + actionpack (= 7.0.0.alpha) + activesupport (= 7.0.0.alpha) + method_source + rake (>= 0.13) + thor (~> 1.0) + +PATH + remote: .. + specs: + maintenance_tasks (1.2.1) + actionpack (>= 6.0) + activejob (>= 6.0) + activerecord (>= 6.0) + job-iteration (~> 1.1) + railties (>= 6.0) + +GEM + remote: https://rubygems.org/ + specs: + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + ast (2.4.2) + builder (3.2.4) + byebug (11.1.3) + capybara (3.35.3) + addressable + mini_mime (>= 0.1.3) + nokogiri (~> 1.8) + rack (>= 1.6.0) + rack-test (>= 0.6.3) + regexp_parser (>= 1.5, < 3.0) + xpath (~> 3.2) + childprocess (3.0.0) + coderay (1.1.3) + concurrent-ruby (1.1.8) + crass (1.0.6) + erubi (1.10.0) + globalid (0.4.2) + activesupport (>= 4.2.0) + i18n (1.8.9) + concurrent-ruby (~> 1.0) + job-iteration (1.1.9) + activejob (>= 5.2) + loofah (2.9.0) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.7.1) + mini_mime (>= 0.1.1) + marcel (1.0.0) + method_source (1.0.0) + mini_mime (1.0.3) + mini_portile2 (2.5.0) + minitest (5.14.4) + mocha (1.12.0) + nio4r (2.5.7) + nokogiri (1.11.2) + mini_portile2 (~> 2.5.0) + racc (~> 1.4) + nokogiri (1.11.2-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.11.2-x86_64-linux) + racc (~> 1.4) + parallel (1.20.1) + parser (3.0.0.0) + ast (~> 2.4.1) + pry (0.13.1) + coderay (~> 1.1) + method_source (~> 1.0) + pry-byebug (3.9.0) + byebug (~> 11.0) + pry (~> 0.13.0) + public_suffix (4.0.6) + puma (5.2.2) + nio4r (~> 2.0) + racc (1.5.2) + rack (2.2.3) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) + rainbow (3.0.0) + rake (13.0.3) + regexp_parser (2.1.1) + rexml (3.2.4) + rubocop (1.12.0) + parallel (~> 1.10) + parser (>= 3.0.0.0) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml + rubocop-ast (>= 1.2.0, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 1.4.0, < 3.0) + rubocop-ast (1.4.1) + parser (>= 2.7.1.5) + rubocop-shopify (2.0.1) + rubocop (~> 1.11) + ruby-progressbar (1.11.0) + rubyzip (2.3.0) + selenium-webdriver (3.142.7) + childprocess (>= 0.5, < 4.0) + rubyzip (>= 1.2.2) + sprockets (4.0.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.2) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sqlite3 (1.4.2) + thor (1.1.0) + tzinfo (2.0.4) + concurrent-ruby (~> 1.0) + unicode-display_width (2.0.0) + webdrivers (4.6.0) + nokogiri (~> 1.6) + rubyzip (>= 1.3.0) + selenium-webdriver (>= 3.0, < 4.0) + websocket-driver (0.7.3) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + xpath (3.2.0) + nokogiri (~> 1.8) + yard (0.9.26) + zeitwerk (2.4.2) + +PLATFORMS + ruby + x86_64-darwin-19 + x86_64-linux + +DEPENDENCIES + capybara + maintenance_tasks! + mocha + pry-byebug + puma + rails! + rubocop-shopify + selenium-webdriver + sqlite3 + webdrivers + yard + +BUNDLED WITH + 2.2.5 diff --git a/test/dummy/config/application.rb b/test/dummy/config/application.rb index 3d3e97b3..c10d5bc9 100644 --- a/test/dummy/config/application.rb +++ b/test/dummy/config/application.rb @@ -14,7 +14,7 @@ module Dummy class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults(6.1) + config.load_defaults("#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}") if ENV["CLASSIC_AUTOLOADER"].present? puts "=> Using classic autoloader" diff --git a/test/dummy/db/migrate/20210112141723_create_active_storage_tables.active_storage.rb b/test/dummy/db/migrate/20210112141723_create_active_storage_tables.active_storage.rb index 48cced06..b50249d1 100644 --- a/test/dummy/db/migrate/20210112141723_create_active_storage_tables.active_storage.rb +++ b/test/dummy/db/migrate/20210112141723_create_active_storage_tables.active_storage.rb @@ -7,7 +7,7 @@ def change t.string(:filename, null: false) t.string(:content_type) t.text(:metadata) - t.string(:service_name, null: false) + t.string(:service_name, null: true) t.bigint(:byte_size, null: false) t.string(:checksum, null: false) t.datetime(:created_at, null: false) diff --git a/test/dummy/db/schema.rb b/test/dummy/db/schema.rb index 77f5a3c7..511e7cd9 100644 --- a/test/dummy/db/schema.rb +++ b/test/dummy/db/schema.rb @@ -27,7 +27,7 @@ t.string "filename", null: false t.string "content_type" t.text "metadata" - t.string "service_name", null: false + t.string "service_name" t.bigint "byte_size", null: false t.string "checksum", null: false t.datetime "created_at", null: false diff --git a/test/helpers/maintenance_tasks/tasks_helper_test.rb b/test/helpers/maintenance_tasks/tasks_helper_test.rb index bdf983b6..461c5daa 100644 --- a/test/helpers/maintenance_tasks/tasks_helper_test.rb +++ b/test/helpers/maintenance_tasks/tasks_helper_test.rb @@ -93,7 +93,7 @@ class TasksHelperTest < ActionView::TestCase csv = Rack::Test::UploadedFile.new(file_fixture("sample.csv"), "text/csv") run.csv_file.attach(csv) - assert_match %r{rails\/active_storage\/blobs\/redirect\/\S+\/sample.csv}, + assert_match %r{rails/active_storage/blobs/\S+/sample.csv}, csv_file_download_path(run) end end