diff --git a/.github/workflows/brakeman.yml b/.github/workflows/brakeman.yml index a9e037de4a..0a64ca04c0 100644 --- a/.github/workflows/brakeman.yml +++ b/.github/workflows/brakeman.yml @@ -8,7 +8,7 @@ on: jobs: brakeman: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index d4a5fb329a..8fbb6af429 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -4,19 +4,19 @@ on: [push, pull_request] jobs: danger: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 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 + echo "RUBY_VERSION=`cat ./Gemfile.lock | grep -A 1 'RUBY VERSION' | grep 'ruby' | grep -oE '[0-9]+\.[0-9]+\.[0-9]+'`" >> $GITHUB_ENV + echo "BUNDLER_VERSION=`cat ./Gemfile.lock | grep -A 1 'BUNDLED WITH' | grep -oE '[0-9]+\.[0-9]+\.[0-9]+'`" >> $GITHUB_ENV # Install Ruby - using the version found in the Gemfile.lock - name: 'Install Ruby' - uses: actions/setup-ruby@v1 + uses: ruby/setup-ruby@v1 with: ruby-version: ${{ env.RUBY_VERSION }} diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index 6a34d2c34b..eaab3a98ec 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -5,7 +5,7 @@ on: [push, pull_request] jobs: eslint: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: # Checkout the repo diff --git a/.github/workflows/mysql.yml b/.github/workflows/mysql.yml index 9ab6e6549f..08a335329b 100644 --- a/.github/workflows/mysql.yml +++ b/.github/workflows/mysql.yml @@ -4,7 +4,7 @@ on: [pull_request] jobs: mysql: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 # Define environment variables for MySQL and Rails env: diff --git a/.github/workflows/postgres.yml b/.github/workflows/postgres.yml index 5af0f25fd4..84f8a99661 100644 --- a/.github/workflows/postgres.yml +++ b/.github/workflows/postgres.yml @@ -4,7 +4,7 @@ on: [pull_request] jobs: postgresql: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 services: # Postgres installation @@ -52,6 +52,11 @@ jobs: run: | sudo apt-get update sudo apt-get install libpq-dev + + # Install ImageMagick (for `identify` command) + - name: 'Install ImageMagick' + run: | + sudo apt-get install -y imagemagick # Copy all of the example configs over - name: 'Setup Default Configuration' diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index c9c0cf8812..dc92a01f4b 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -4,7 +4,7 @@ on: [push, pull_request] jobs: rubocop: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: # Checkout the repo diff --git a/CHANGELOG.md b/CHANGELOG.md index 06c47a6a16..0904c76f8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Fixed bar chart click function in the Usage dashboard (GitHub issue #3443) - Fixed broken link for the V1 API documentation. - Fix `hidden_field_tag` Nested Attributes Format For Rails 7 Upgrade and Add Test Coverage [#3479](https://github.com/DMPRoadmap/roadmap/pull/3479) +- Update all workflows to `runs-on: ubuntu-24.04` and Consolidate Capybara Config [#3487](https://github.com/DMPRoadmap/roadmap/pull/3487) - Add pdf handling in `render_respond_to_format_with_error_message` [#3482](https://github.com/DMPRoadmap/roadmap/pull/3482) - Lower PostgreSQL GitHub Action Chrome Version to Address Breaking Changes Between Latest Chrome Version (134) and `/features` Tests [#3491](https://github.com/DMPRoadmap/roadmap/pull/3491) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 4be8e3b936..98c265b5cf 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -80,21 +80,3 @@ config.include Devise::Test::ControllerHelpers, type: :view config.include Pundit::Matchers, type: :policy end - -Capybara.register_driver :headless_chrome do |app| - options = Selenium::WebDriver::Chrome::Options.new - options.add_argument('--headless') - options.add_argument('--no-sandbox') - options.add_argument('--disable-dev-shm-usage') - - Capybara::Selenium::Driver.new( - app, - browser: :chrome, - options: options - ) -end - -Capybara.javascript_driver = :headless_chrome -Capybara.default_driver = :headless_chrome -# Configure Capybara to wait longer for elements to appear -Capybara.default_max_wait_time = 20 diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb index 50f5e42547..c6e8ee618c 100644 --- a/spec/support/capybara.rb +++ b/spec/support/capybara.rb @@ -3,19 +3,23 @@ # Use Puma as the webserver for feature tests Capybara.server = :puma, { Silent: true } -# Use the fast rack_test driver for non-feature tests by default -Capybara.default_driver = :rack_test - # Create a custom driver based on Capybara's :selenium_chrome_headless driver -# This resolves a ElementClickInterceptedError when executing `click_button 'Sign in'` with DMP Assistant -Capybara.register_driver :selenium_chrome_headless_add_window_size do |app| +Capybara.register_driver :selenium_chrome_headless_custom do |app| # Get a copy of the default options for Capybara's :selenium_chrome_headless driver options = Capybara.drivers[:selenium_chrome_headless].call.options[:options].dup - options.add_argument('--window-size=1920,1080') # default window-size is only (800x600) + # Resolves ElementClickInterceptedError (default window-size is only (800x600)) + options.add_argument('--window-size=1920,1080') + options.add_argument('--no-sandbox') + options.add_argument('--disable-dev-shm-usage') # Create a new Selenium driver with the customised options Capybara::Selenium::Driver.new(app, browser: :chrome, options: options) end +# Use the fast rack_test driver for non-feature tests by default +Capybara.default_driver = :rack_test +Capybara.javascript_driver = :selenium_chrome_headless_custom +Capybara.default_max_wait_time = 20 + RSpec.configure do |config| config.before(:each, type: :feature, js: false) do Capybara.use_default_driver @@ -23,6 +27,6 @@ # Use the Selenium headless Chrome driver for feature tests config.before(:each, type: :feature, js: true) do - Capybara.current_driver = :selenium_chrome_headless_add_window_size + Capybara.current_driver = :selenium_chrome_headless_custom end end