From 693dda1d5f9f0ee29adc250015c7a6b200bcde35 Mon Sep 17 00:00:00 2001 From: aaronskiba Date: Thu, 20 Jun 2024 14:54:28 -0600 Subject: [PATCH 1/9] Set `ruby '3.1.4'` in Gemfile && `bundle install` Here we can see changes to `ffi` within Gemfile.lock. These same changes were initially made by the `Bump listen from 3.8.0 to 3.9.0` Dependabot PR (commit e2960038050cd3d65485c7e03e5bf25bfb7438e0). However, running `bundle install` with the prior Ruby version (3.0.5) made it simply switch to `ffi (1.17.0)`. --- Gemfile | 2 +- Gemfile.lock | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index b2d11326d..9feaee325 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' -ruby '>= 3.0' +ruby '3.1.4' # ===========# # CORE RAILS # diff --git a/Gemfile.lock b/Gemfile.lock index e401014a9..23477a0e0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -195,7 +195,8 @@ GEM faraday (>= 0.8) faraday-net_http (3.1.0) net-http - ffi (1.17.0) + ffi (1.17.0-arm64-darwin) + ffi (1.17.0-x86_64-linux-gnu) flag_shih_tzu (0.3.23) fog-aws (3.21.0) fog-core (~> 2.1) @@ -648,7 +649,7 @@ DEPENDENCIES yard-tomdoc RUBY VERSION - ruby 3.0.4p208 + ruby 3.1.4p223 BUNDLED WITH 2.4.15 From 582e53f3b25863a6d9d9676bb0662de5c4dd6a2c Mon Sep 17 00:00:00 2001 From: aaronskiba Date: Fri, 21 Jun 2024 09:21:12 -0600 Subject: [PATCH 2/9] Set `ruby-version: '3.1.4'` in workflows --- .github/workflows/mysql.yml | 2 +- .github/workflows/postgres.yml | 2 +- .github/workflows/rubocop.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/mysql.yml b/.github/workflows/mysql.yml index c9e87fd75..5e232a043 100644 --- a/.github/workflows/mysql.yml +++ b/.github/workflows/mysql.yml @@ -19,7 +19,7 @@ jobs: # Install Ruby and run bundler - uses: ruby/setup-ruby@v1 with: - ruby-version: '3.0' + ruby-version: '3.1.4' bundler-cache: true # Install Node diff --git a/.github/workflows/postgres.yml b/.github/workflows/postgres.yml index 1be2a3e36..9496cac2d 100644 --- a/.github/workflows/postgres.yml +++ b/.github/workflows/postgres.yml @@ -34,7 +34,7 @@ jobs: # Install Ruby and run bundler - uses: ruby/setup-ruby@v1 with: - ruby-version: '3.0' + ruby-version: '3.1.4' bundler-cache: true ## - run: echo 'NODE_OPTIONS="--openssl-legacy-provider"' >> $GITHUB_ENV diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index 971c67a8b..87040b60e 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -18,7 +18,7 @@ jobs: - name: 'Install Ruby' uses: ruby/setup-ruby@v1 with: - ruby-version: '3.0' + ruby-version: '3.1.4' bundler-cache: true - name: 'Run Rubocop' From eecf23618973facb28d0d6028d264380ccd2b0f9 Mon Sep 17 00:00:00 2001 From: aaronskiba Date: Fri, 21 Jun 2024 10:09:47 -0600 Subject: [PATCH 3/9] Fix Postgres Workflow (1/2) Copy/pasted `https://github.com/DMPRoadmap/roadmap/blob/fc047ac0ae1b10f9fd451909e11a2d31e50b3ada/.github/workflows/postgres.yml` (DMPRoadmap Release v4.2.0). --- .github/workflows/postgres.yml | 57 ++++++++-------------------------- 1 file changed, 13 insertions(+), 44 deletions(-) diff --git a/.github/workflows/postgres.yml b/.github/workflows/postgres.yml index 9496cac2d..bda025a33 100644 --- a/.github/workflows/postgres.yml +++ b/.github/workflows/postgres.yml @@ -1,6 +1,6 @@ name: Tests - PostgreSQL -on: [push, pull_request] +on: [pull_request] jobs: postgresql: @@ -23,6 +23,7 @@ jobs: --health-timeout 5s --health-retries 5 + # Define environment variables for Postgres and Rails env: RAILS_ENV: test DATABASE_URL: postgres://postgres:@localhost:5432/roadmap_test @@ -34,7 +35,7 @@ jobs: # Install Ruby and run bundler - uses: ruby/setup-ruby@v1 with: - ruby-version: '3.1.4' + ruby-version: '3.0' bundler-cache: true ## - run: echo 'NODE_OPTIONS="--openssl-legacy-provider"' >> $GITHUB_ENV @@ -43,87 +44,55 @@ jobs: # Install Node - uses: actions/setup-node@v3 with: - node-version: '16.6.0' + node-version: 18 cache: 'yarn' + # Install the Postgres developer packages - name: 'Install Postgresql Packages' run: | sudo apt-get update sudo apt-get install libpq-dev - - name: 'Determine Ruby and Bundler Versions from Gemfile.lock' - run: | - echo "RUBY_VERSION=`cat ./Gemfile.lock | grep -A 1 'RUBY VERSION' | grep 'ruby' | grep -oE '[0-9]\.[0-9]'`" >> $GITHUB_ENV - echo "BUNDLER_VERSION=`cat ./Gemfile.lock | grep -A 1 'BUNDLED WITH' | grep -oE '[0-9]\.[0-9]'`" >> $GITHUB_ENV - - # Install Ruby - using the version found in the Gemfile.lock - - name: 'Install Ruby' - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ env.RUBY_VERSION }} - # Copy all of the example configs over - name: 'Setup Default Configuration' run: | - # Make copies of all the example config files cp config/database.yml.sample config/database.yml cp config/initializers/contact_us.rb.example config/initializers/contact_us.rb cp config/initializers/wicked_pdf.rb.example config/initializers/wicked_pdf.rb cp .env.postgresql .env - # Try to retrieve the gems from the cache - - name: 'Cache Gems' - uses: actions/cache@v2.1.5 - with: - path: vendor/bundle - key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-gem- - - - name: 'Bundle Install' - run: | - gem install bundler -v ${{ env.BUNDLER_VERSION }} - bundle config path vendor/bundle - bundle install --jobs 4 --retry 3 --without mysql rollbar aws - + # Stub out the Rails credentials file so that we can start the Rails app - name: 'Setup Credentials' run: | # generate a default credential file and key EDITOR='echo "$(cat config/credentials.yml.postgresql)" >' bundle exec rails credentials:edit - # Try to retrieve the yarn JS dependencies from the cache - - name: 'Cache Yarn Packages' - uses: actions/cache@v2.1.5 - with: - path: node_modules/ - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}-yarn- - ${{ runner.os }}- - + # Set the path to the wkhtmltopdf executable - name: 'Determine wkhtmltopdf location' run: echo "WICKED_PDF_PATH=`bundle exec which wkhtmltopdf`" >> $GITHUB_ENV + # Run yarn install for JS dependencies - name: 'Yarn Install' run: | yarn install + # Initialize the DB - name: 'Setup Test DB' run: | bundle exec rails db:setup RAILS_ENV=test bundle exec rails db:migrate RAILS_ENV=test + # Prebuild the CSS, JS and image assets - name: 'Compile Assets' run: bundle exec rails assets:precompile + # Run the unit and functional tests - name: 'Run Rspec Unit and Functional Tests' run: | bundle exec rspec spec/models/ spec/policies/ spec/services/ spec/helpers/ bundle exec rspec spec/controllers/ spec/presenters/ spec/requests/ spec/views bundle exec rspec spec/mixins/ - # Integration Tests are only run if PR or Push is to master or development branches + # Run the time consuming integration tests (using Chrome headless browser) - name: 'Run Integration Tests' - run: bundle exec rspec spec/features/ + run: bundle exec rspec spec/features/ \ No newline at end of file From 37b538802d1224ce387b12aaec8af211b73804b6 Mon Sep 17 00:00:00 2001 From: aaronskiba Date: Fri, 21 Jun 2024 10:12:29 -0600 Subject: [PATCH 4/9] Fix Postgres Workflow (2/2) This commit updates the copy/paste commit (aa0508a17ac4b3b9b59f0a145c316ba3a9a51ef8) to make this file compatible with DMP Assistant. --- .github/workflows/postgres.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/postgres.yml b/.github/workflows/postgres.yml index bda025a33..e91029c6d 100644 --- a/.github/workflows/postgres.yml +++ b/.github/workflows/postgres.yml @@ -1,6 +1,6 @@ name: Tests - PostgreSQL -on: [pull_request] +on: [push, pull_request] jobs: postgresql: @@ -35,7 +35,7 @@ jobs: # Install Ruby and run bundler - uses: ruby/setup-ruby@v1 with: - ruby-version: '3.0' + ruby-version: '3.1.4' bundler-cache: true ## - run: echo 'NODE_OPTIONS="--openssl-legacy-provider"' >> $GITHUB_ENV @@ -44,7 +44,7 @@ jobs: # Install Node - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: '16.6.0' cache: 'yarn' # Install the Postgres developer packages From b3fa1fe31de1c19f60e2ff7f7bbefbbcdffdc441 Mon Sep 17 00:00:00 2001 From: aaronskiba Date: Fri, 21 Jun 2024 11:43:58 -0600 Subject: [PATCH 5/9] Fix danger workflow The changes implemented via this commit address the following GitHub workflow error: ``` Run gem install bundler -v 2.4 Successfully installed bundler-2.4.0 1 gem installed [DEPRECATED] The `--without` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set --local without 'pgsql rollbar aws'`, and stop using this flag Your Ruby version is 3.1.6, but your Gemfile specified 3.1.4 Error: Process completed with exit code 18. ``` --- .github/workflows/danger.yml | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index 6f9cffda4..df073ff59 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -9,22 +9,11 @@ jobs: steps: - uses: actions/checkout@v3 - - name: 'Determine Ruby and Bundler Versions from Gemfile.lock' - run: | - echo "RUBY_VERSION=`cat ./Gemfile.lock | grep -A 1 'RUBY VERSION' | grep 'ruby' | grep -oE '[0-9]\.[0-9]'`" >> $GITHUB_ENV - echo "BUNDLER_VERSION=`cat ./Gemfile.lock | grep -A 1 'BUNDLED WITH' | grep -oE '[0-9]\.[0-9]'`" >> $GITHUB_ENV - - # Install Ruby - using the version found in the Gemfile.lock - - name: 'Install Ruby' - uses: ruby/setup-ruby@v1 + # Install Ruby and run bundler + - uses: ruby/setup-ruby@v1 with: - ruby-version: ${{ env.RUBY_VERSION }} - - - name: 'Bundle Install' - run: | - gem install bundler -v ${{ env.BUNDLER_VERSION }} - bundle config path vendor/bundle - bundle install --jobs 4 --retry 3 --without pgsql rollbar aws + ruby-version: '3.1.4' + bundler-cache: true - name: 'Run Danger' env: From 5ba0f3dd35349169e2461748fe4334bbd3918076 Mon Sep 17 00:00:00 2001 From: aaronskiba Date: Fri, 21 Jun 2024 12:17:22 -0600 Subject: [PATCH 6/9] Disable offence-related Cops from Ruby 3.1.4 bump Prior to this commit, the Rubocop-related GitHub action was failing with the following (https://github.com/portagenetwork/roadmap/actions/runs/9618541179/job/26532655790): ``` 577 files inspected, 805 offenses detected, 805 offenses autocorrectable Error: Process completed with exit code 1. ``` These offences are due to the bump from Ruby 3.0 to Ruby 3.1. This commit disables the Cops corresponding to these offences. (Note: They are all "Style"-type offences) --- .rubocop.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index 135f86e28..f4ce5afee 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -198,3 +198,9 @@ Style/StringLiterals: - 'config/**/*' Style/SwapValues: # new in 1.1 Enabled: true + +Style/HashSyntax: + Enabled: false + +Style/ArrayIntersect: + Enabled: false From c17e8aa744402993caa0f9e84f3ff571e0e3080d Mon Sep 17 00:00:00 2001 From: aaronskiba Date: Fri, 21 Jun 2024 13:43:44 -0600 Subject: [PATCH 7/9] Bump to Ruby v3.1.4 in Dockerfile.production --- Dockerfile.production | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.production b/Dockerfile.production index 0c00a5b6c..36df92ec7 100644 --- a/Dockerfile.production +++ b/Dockerfile.production @@ -1,4 +1,4 @@ -FROM ruby:3.0.5 +FROM ruby:3.1.4 # Setup bundle to install gems to volume ENV BUNDLE_PATH=/bundle/ \ From 1425aa93a25fef30b8c252acb6bebda6a6349101 Mon Sep 17 00:00:00 2001 From: aaronskiba Date: Mon, 24 Jun 2024 13:37:09 -0600 Subject: [PATCH 8/9] Fix `.github/workflows/ruby.yml` These changes were mostly implemented by copy/pasting `.github/workflows/postgres.yml` over to `.github/workflows/ruby.yml`. Prior to this commit the following error was encountered during the "Bundle Install" step: ``` Run gem install bundler -v 2.4 Successfully installed bundler-2.4.0 1 gem installed [DEPRECATED] The `--without` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set --local without 'mysql rollbar aws'`, and stop using this flag Your Ruby version is 3.1.6, but your Gemfile specified 3.1.4 ``` --- .github/workflows/ruby.yml | 49 ++++++++------------------------------ 1 file changed, 10 insertions(+), 39 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index ac49a16d3..927d7cc45 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -41,27 +41,25 @@ jobs: steps: # Checkout the repo - uses: actions/checkout@v3 + + # Install Ruby and run bundler + - uses: ruby/setup-ruby@v1 with: - fetch-depth: 1 + ruby-version: '3.1.4' + bundler-cache: true + + # Install Node - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: '16.6.0' + cache: 'yarn' + # Install the Postgres developer packages - name: 'Install Postgresql Packages' run: | sudo apt-get update sudo apt-get install libpq-dev - - name: 'Determine Ruby and Bundler Versions from Gemfile.lock' - run: | - echo "RUBY_VERSION=`cat ./Gemfile.lock | grep -A 1 'RUBY VERSION' | grep 'ruby' | grep -oE '[0-9]\.[0-9]'`" >> $GITHUB_ENV - echo "BUNDLER_VERSION=`cat ./Gemfile.lock | grep -A 1 'BUNDLED WITH' | grep -oE '[0-9]\.[0-9]'`" >> $GITHUB_ENV - - - name: 'Install Ruby' - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ env.RUBY_VERSION }} - # Copy all of the example configs over - name: 'Setup Default Configuration' run: | @@ -70,38 +68,11 @@ jobs: cp config/initializers/contact_us.rb.example config/initializers/contact_us.rb cp config/initializers/wicked_pdf.rb.example config/initializers/wicked_pdf.rb - # Try to retrieve the gems from the cache - - name: 'Cache Gems' - uses: actions/cache@v2.1.5 - with: - path: vendor/bundle - key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-gem- - - - name: 'Bundle Install' - run: | - gem install bundler -v ${{ env.BUNDLER_VERSION }} - bundle config path vendor/bundle - bundle install --jobs 4 --retry 3 --without mysql rollbar aws - - name: 'Setup Credentials' run: | # generate a default credential file and key EDITOR='echo "$(cat config/credentials.yml.mysql2)" >' bundle exec rails credentials:edit - # Try to retrieve the yarn JS dependencies from the cache - - name: 'Cache Yarn Packages' - uses: actions/cache@v2.1.5 - with: - path: node_modules/ - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}-yarn- - ${{ runner.os }}- - - name: 'Determine wkhtmltopdf location' run: echo "WICKED_PDF_PATH=`bundle exec which wkhtmltopdf`" >> $GITHUB_ENV From 1cb91abdba682ff31d47a9fc1438f594e9fe928f Mon Sep 17 00:00:00 2001 From: aaronskiba Date: Mon, 24 Jun 2024 13:53:12 -0600 Subject: [PATCH 9/9] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 377233197..86ea9fc00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -72,6 +72,8 @@ - Bump braces from 3.0.2 to 3.0.3 [#795](https://github.com/portagenetwork/roadmap/pull/795) + - Bump Ruby from 3.0.4 to 3.1.4 [#808](https://github.com/portagenetwork/roadmap/pull/808) + ## V4.1.1 ### Added