From 3c2ef16036a47b5e3c70751157875a20475cfd51 Mon Sep 17 00:00:00 2001 From: "Patrick J. Cherry" Date: Wed, 1 Mar 2023 15:17:15 +0000 Subject: [PATCH 1/4] Upgrade to Ruby 3.2 --- Dockerfile | 2 +- Gemfile | 2 +- Gemfile.lock | 194 +++++++++++++------------- app/jobs/upload_job.rb | 2 +- config/environments/production.rb | 2 +- spec/requests/graphql_spec.rb | 2 +- spec/requests/projects/images_spec.rb | 6 +- spec/requests/projects/index_spec.rb | 10 +- spec/requests/projects/update_spec.rb | 16 +-- 9 files changed, 120 insertions(+), 116 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9d6f83f91..c8f2da89a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:3.1-slim-bullseye as base +FROM ruby:3.2-slim-bullseye as base RUN gem install bundler \ && apt-get update \ && apt-get upgrade --yes \ diff --git a/Gemfile b/Gemfile index 8577c1678..d426ae6ee 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '~> 3.1.0' +ruby '~> 3.2.0' gem 'aws-sdk-s3', require: false gem 'bootsnap', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 1263f3453..864e3ed21 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,67 +1,67 @@ GEM remote: https://rubygems.org/ specs: - actioncable (7.0.4) - actionpack (= 7.0.4) - activesupport (= 7.0.4) + actioncable (7.0.4.2) + actionpack (= 7.0.4.2) + activesupport (= 7.0.4.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.4) - actionpack (= 7.0.4) - activejob (= 7.0.4) - activerecord (= 7.0.4) - activestorage (= 7.0.4) - activesupport (= 7.0.4) + actionmailbox (7.0.4.2) + actionpack (= 7.0.4.2) + activejob (= 7.0.4.2) + activerecord (= 7.0.4.2) + activestorage (= 7.0.4.2) + activesupport (= 7.0.4.2) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.4) - actionpack (= 7.0.4) - actionview (= 7.0.4) - activejob (= 7.0.4) - activesupport (= 7.0.4) + actionmailer (7.0.4.2) + actionpack (= 7.0.4.2) + actionview (= 7.0.4.2) + activejob (= 7.0.4.2) + activesupport (= 7.0.4.2) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.4) - actionview (= 7.0.4) - activesupport (= 7.0.4) + actionpack (7.0.4.2) + actionview (= 7.0.4.2) + activesupport (= 7.0.4.2) rack (~> 2.0, >= 2.2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.4) - actionpack (= 7.0.4) - activerecord (= 7.0.4) - activestorage (= 7.0.4) - activesupport (= 7.0.4) + actiontext (7.0.4.2) + actionpack (= 7.0.4.2) + activerecord (= 7.0.4.2) + activestorage (= 7.0.4.2) + activesupport (= 7.0.4.2) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.4) - activesupport (= 7.0.4) + actionview (7.0.4.2) + activesupport (= 7.0.4.2) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.4) - activesupport (= 7.0.4) + activejob (7.0.4.2) + activesupport (= 7.0.4.2) globalid (>= 0.3.6) - activemodel (7.0.4) - activesupport (= 7.0.4) - activerecord (7.0.4) - activemodel (= 7.0.4) - activesupport (= 7.0.4) - activestorage (7.0.4) - actionpack (= 7.0.4) - activejob (= 7.0.4) - activerecord (= 7.0.4) - activesupport (= 7.0.4) + activemodel (7.0.4.2) + activesupport (= 7.0.4.2) + activerecord (7.0.4.2) + activemodel (= 7.0.4.2) + activesupport (= 7.0.4.2) + activestorage (7.0.4.2) + actionpack (= 7.0.4.2) + activejob (= 7.0.4.2) + activerecord (= 7.0.4.2) + activesupport (= 7.0.4.2) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.4) + activesupport (7.0.4.2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -70,29 +70,29 @@ GEM public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) aws-eventstream (1.2.0) - aws-partitions (1.674.0) - aws-sdk-core (3.168.4) + aws-partitions (1.718.0) + aws-sdk-core (3.170.0) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.5) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.61.0) + aws-sdk-kms (1.63.0) aws-sdk-core (~> 3, >= 3.165.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.117.2) + aws-sdk-s3 (1.119.1) aws-sdk-core (~> 3, >= 3.165.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.4) aws-sigv4 (1.5.2) aws-eventstream (~> 1, >= 1.0.2) - bootsnap (1.15.0) + bootsnap (1.16.0) msgpack (~> 1.2) builder (3.2.4) byebug (11.1.3) cancancan (3.4.0) climate_control (1.2.0) coderay (1.1.3) - concurrent-ruby (1.2.0) + concurrent-ruby (1.2.2) crack (0.4.5) rexml crass (1.0.6) @@ -103,7 +103,7 @@ GEM dotenv-rails (2.8.1) dotenv (= 2.8.1) railties (>= 3.2) - erubi (1.11.0) + erubi (1.12.0) et-orbi (1.2.7) tzinfo factory_bot (6.2.1) @@ -111,9 +111,9 @@ GEM factory_bot_rails (6.2.0) factory_bot (~> 6.2.0) railties (>= 5.0.0) - faker (3.0.0) + faker (3.1.1) i18n (>= 1.8.11, < 2) - faraday (2.7.1) + faraday (2.7.4) faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) faraday-net_http (3.0.2) @@ -126,7 +126,7 @@ GEM railties (>= 4) globalid (1.1.0) activesupport (>= 5.0) - good_job (3.12.1) + good_job (3.12.6) activejob (>= 6.0.0) activerecord (>= 6.0.0) concurrent-ruby (>= 1.0.2) @@ -148,7 +148,7 @@ GEM actionview (>= 5.0.0) activesupport (>= 5.0.0) jmespath (1.6.2) - json (2.6.2) + json (2.6.3) kaminari (1.2.2) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.2) @@ -164,90 +164,92 @@ GEM loofah (2.19.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.7.1) + mail (2.8.1) mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp marcel (1.0.2) method_source (1.0.0) mini_mime (1.1.2) minitest (5.17.0) msgpack (1.6.0) - net-imap (0.3.1) + net-imap (0.3.4) + date net-protocol net-pop (0.1.2) net-protocol - net-protocol (0.1.3) + net-protocol (0.2.1) timeout net-smtp (0.3.3) net-protocol nio4r (2.5.8) - nokogiri (1.14.1-aarch64-linux) - racc (~> 1.4) - nokogiri (1.14.1-x86_64-linux) + nokogiri (1.14.2-aarch64-linux) racc (~> 1.4) open-uri (0.3.0) stringio time uri parallel (1.22.1) - parser (3.1.3.0) + parser (3.2.1.0) ast (~> 2.4.1) - pg (1.4.5) - pry (0.14.1) + pg (1.4.6) + pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) pry-byebug (3.10.1) byebug (~> 11.0) pry (>= 0.13, < 0.15) - public_suffix (5.0.0) + public_suffix (5.0.1) puma (5.6.5) nio4r (~> 2.0) raabro (1.4.0) racc (1.6.2) rack (2.2.6.2) - rack-cors (1.1.1) + rack-cors (2.0.0) rack (>= 2.0.0) rack-test (2.0.2) rack (>= 1.3) - rails (7.0.4) - actioncable (= 7.0.4) - actionmailbox (= 7.0.4) - actionmailer (= 7.0.4) - actionpack (= 7.0.4) - actiontext (= 7.0.4) - actionview (= 7.0.4) - activejob (= 7.0.4) - activemodel (= 7.0.4) - activerecord (= 7.0.4) - activestorage (= 7.0.4) - activesupport (= 7.0.4) + rails (7.0.4.2) + actioncable (= 7.0.4.2) + actionmailbox (= 7.0.4.2) + actionmailer (= 7.0.4.2) + actionpack (= 7.0.4.2) + actiontext (= 7.0.4.2) + actionview (= 7.0.4.2) + activejob (= 7.0.4.2) + activemodel (= 7.0.4.2) + activerecord (= 7.0.4.2) + activestorage (= 7.0.4.2) + activesupport (= 7.0.4.2) bundler (>= 1.15.0) - railties (= 7.0.4) + railties (= 7.0.4.2) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.5.0) loofah (~> 2.19, >= 2.19.1) - railties (7.0.4) - actionpack (= 7.0.4) - activesupport (= 7.0.4) + railties (7.0.4.2) + actionpack (= 7.0.4.2) + activesupport (= 7.0.4.2) method_source rake (>= 12.2) thor (~> 1.0) zeitwerk (~> 2.5) rainbow (3.1.1) rake (13.0.6) - regexp_parser (2.6.1) + regexp_parser (2.7.0) rexml (3.2.5) rspec (3.12.0) rspec-core (~> 3.12.0) rspec-expectations (~> 3.12.0) rspec-mocks (~> 3.12.0) - rspec-core (3.12.0) + rspec-core (3.12.1) rspec-support (~> 3.12.0) - rspec-expectations (3.12.0) + rspec-expectations (3.12.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-mocks (3.12.0) + rspec-mocks (3.12.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-rails (6.0.1) @@ -261,26 +263,29 @@ GEM rspec-support (3.12.0) rspec_junit_formatter (0.6.0) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (1.39.0) + rubocop (1.47.0) json (~> 2.3) parallel (~> 1.10) - parser (>= 3.1.2.1) + parser (>= 3.2.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.23.0, < 2.0) + rubocop-ast (>= 1.26.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.23.0) - parser (>= 3.1.1.0) - rubocop-graphql (0.19.0) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.27.0) + parser (>= 3.2.1.0) + rubocop-capybara (2.17.1) + rubocop (~> 1.41) + rubocop-graphql (1.0.0) rubocop (>= 0.87, < 2) - rubocop-rails (2.17.3) + rubocop-rails (2.18.0) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) - rubocop-rspec (2.15.0) + rubocop-rspec (2.18.1) rubocop (~> 1.33) + rubocop-capybara (~> 2.17) ruby-progressbar (1.11.0) ruby2_keywords (0.0.5) sentry-rails (5.5.0) @@ -288,7 +293,7 @@ GEM sentry-ruby (~> 5.5.0) sentry-ruby (5.5.0) concurrent-ruby (~> 1.0, >= 1.0.2) - shoulda-matchers (5.2.0) + shoulda-matchers (5.3.0) activesupport (>= 5.2.0) simplecov (0.22.0) docile (~> 1.1) @@ -300,10 +305,10 @@ GEM thor (1.2.1) time (0.2.1) date - timeout (0.3.0) + timeout (0.3.2) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.3.0) + unicode-display_width (2.4.2) uri (0.12.0) webmock (3.18.1) addressable (>= 2.8.0) @@ -313,11 +318,10 @@ GEM websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.6.6) + zeitwerk (2.6.7) PLATFORMS aarch64-linux - x86_64-linux DEPENDENCIES aws-sdk-s3 @@ -355,7 +359,7 @@ DEPENDENCIES webmock RUBY VERSION - ruby 3.1.3p185 + ruby 3.2.1p31 BUNDLED WITH - 2.3.26 + 2.4.7 diff --git a/app/jobs/upload_job.rb b/app/jobs/upload_job.rb index 0a8a8e10b..f45c4dd69 100644 --- a/app/jobs/upload_job.rb +++ b/app/jobs/upload_job.rb @@ -5,7 +5,7 @@ require 'github_api' class UploadJob < ApplicationJob - ProjectContentQuery = GithubApi::Client.parse <<-'GRAPHQL' + ProjectContentQuery = GithubApi::Client.parse <<-GRAPHQL query($owner: String!, $repository: String!, $expression: String!) { repository(owner: $owner, name: $repository) { object(expression: $expression) { diff --git a/config/environments/production.rb b/config/environments/production.rb index 79d5c8646..45fbc4549 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -68,7 +68,7 @@ config.active_support.report_deprecations = false # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = ::Logger::Formatter.new + config.log_formatter = Logger::Formatter.new # Use a different logger for distributed setups. # require "syslog/logger" diff --git a/spec/requests/graphql_spec.rb b/spec/requests/graphql_spec.rb index 867c1ecfb..8726956e4 100644 --- a/spec/requests/graphql_spec.rb +++ b/spec/requests/graphql_spec.rb @@ -7,7 +7,7 @@ let(:params) { {} } let(:headers) { {} } - let(:json_response) { JSON.parse(response.body) } + let(:json_response) { response.parsed_body } before { post graphql_path, params:, headers: } diff --git a/spec/requests/projects/images_spec.rb b/spec/requests/projects/images_spec.rb index 0369f0e1f..1c5420b76 100644 --- a/spec/requests/projects/images_spec.rb +++ b/spec/requests/projects/images_spec.rb @@ -29,13 +29,13 @@ end it 'returns file list' do - post "/api/projects/#{project.identifier}/images", params: params + post("/api/projects/#{project.identifier}/images", params:) expect(response.body).to eq(expected_json) end it 'returns success response' do - post "/api/projects/#{project.identifier}/images", params: params + post("/api/projects/#{project.identifier}/images", params:) expect(response).to have_http_status(:ok) end @@ -53,7 +53,7 @@ end it 'returns forbidden response' do - post "/api/projects/#{project.identifier}/images", params: params + post("/api/projects/#{project.identifier}/images", params:) expect(response).to have_http_status(:forbidden) end end diff --git a/spec/requests/projects/index_spec.rb b/spec/requests/projects/index_spec.rb index 4d050fedf..158bd7de9 100644 --- a/spec/requests/projects/index_spec.rb +++ b/spec/requests/projects/index_spec.rb @@ -26,19 +26,19 @@ it 'returns correct number of projects' do get '/api/projects' - returned = JSON.parse(response.body) + returned = response.parsed_body expect(returned.length).to eq(2) end it 'returns users projects' do get '/api/projects' - returned = JSON.parse(response.body) + returned = response.parsed_body expect(returned.all? { |proj| proj['user_id'] == user_id }).to be(true) end it 'returns all keys in response' do get '/api/projects' - returned = JSON.parse(response.body) + returned = response.parsed_body returned.each { |project| expect(project.keys).to eq(project_keys) } end end @@ -51,13 +51,13 @@ it 'returns the default number of projects on the first page' do get '/api/projects' - returned = JSON.parse(response.body) + returned = response.parsed_body expect(returned.length).to eq(8) end it 'returns the next set of projects on the next page' do get '/api/projects?page=2' - returned = JSON.parse(response.body) + returned = response.parsed_body expect(returned.length).to eq(4) end diff --git a/spec/requests/projects/update_spec.rb b/spec/requests/projects/update_spec.rb index 835ab070e..f0f380c07 100644 --- a/spec/requests/projects/update_spec.rb +++ b/spec/requests/projects/update_spec.rb @@ -31,12 +31,12 @@ end it 'returns success response' do - put "/api/projects/#{project.identifier}", params: params + put("/api/projects/#{project.identifier}", params:) expect(response).to have_http_status(:ok) end it 'returns updated project json' do - put "/api/projects/#{project.identifier}", params: params + put("/api/projects/#{project.identifier}", params:) expect(response.body).to include('updated component content') end @@ -44,7 +44,7 @@ mock_response = instance_double(OperationResponse) allow(mock_response).to receive(:success?).and_return(true) allow(Project::Update).to receive(:call).and_return(mock_response) - put "/api/projects/#{project.identifier}", params: params + put("/api/projects/#{project.identifier}", params:) expect(Project::Update).to have_received(:call) end @@ -52,17 +52,17 @@ let(:params) { { project: { name: 'updated project name' } } } it 'returns success response' do - put "/api/projects/#{project.identifier}", params: params + put("/api/projects/#{project.identifier}", params:) expect(response).to have_http_status(:ok) end it 'returns json with updated project properties' do - put "/api/projects/#{project.identifier}", params: params + put("/api/projects/#{project.identifier}", params:) expect(response.body).to include('updated project name') end it 'returns json with previous project components' do - put "/api/projects/#{project.identifier}", params: params + put("/api/projects/#{project.identifier}", params:) expect(response.body).to include(project.components.first.attributes[:content].to_s) end end @@ -71,7 +71,7 @@ let(:params) { { project: { components: [] } } } it 'returns error response' do - put "/api/projects/#{project.identifier}", params: params + put("/api/projects/#{project.identifier}", params:) expect(response).to have_http_status(:bad_request) end end @@ -86,7 +86,7 @@ end it 'returns forbidden response' do - put "/api/projects/#{project.identifier}", params: params + put("/api/projects/#{project.identifier}", params:) expect(response).to have_http_status(:forbidden) end end From 7712cf7208c51b8bd6c7564e5db28dec35479b06 Mon Sep 17 00:00:00 2001 From: "Patrick J. Cherry" Date: Wed, 1 Mar 2023 15:21:44 +0000 Subject: [PATCH 2/4] Upgrade circle ci to ruby 3.2 --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 54e2b4625..1fde01d9c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ jobs: rubocop: docker: - - image: 'cimg/ruby:3.1' + - image: 'cimg/ruby:3.2' steps: - checkout - ruby/install-deps @@ -11,7 +11,7 @@ jobs: test: docker: - - image: 'cimg/ruby:3.1-browsers' + - image: 'cimg/ruby:3.2-browsers' - image: 'circleci/postgres:12.0-alpine-ram' environment: POSTGRES_DB: choco_cake_test From 0edd17c391e0054fc08fec732f6f96e6dfc2fb84 Mon Sep 17 00:00:00 2001 From: "Patrick J. Cherry" Date: Wed, 1 Mar 2023 15:25:36 +0000 Subject: [PATCH 3/4] Add x86_64 back --- Gemfile.lock | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Gemfile.lock b/Gemfile.lock index 864e3ed21..c7497da49 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -186,6 +186,8 @@ GEM nio4r (2.5.8) nokogiri (1.14.2-aarch64-linux) racc (~> 1.4) + nokogiri (1.14.2-x86_64-linux) + racc (~> 1.4) open-uri (0.3.0) stringio time @@ -322,6 +324,7 @@ GEM PLATFORMS aarch64-linux + x86_64-linux DEPENDENCIES aws-sdk-s3 From be7b7718adc4e4889b5a20efd09e961792a9c079 Mon Sep 17 00:00:00 2001 From: "Patrick J. Cherry" Date: Thu, 2 Mar 2023 14:15:11 +0000 Subject: [PATCH 4/4] Update tool versions/ruby version --- .ruby-version | 2 +- .tool-versions | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 .tool-versions diff --git a/.ruby-version b/.ruby-version index 7bde84d06..72b3400f1 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-3.1.2 +ruby-3.2.1 diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 000000000..40b87ee46 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +ruby 3.2.1