From ad20247f5a5ba8fc5ea7db8245baae6d34c62ae3 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Mon, 24 Jun 2024 15:22:02 +0200 Subject: [PATCH 1/5] Loosen ruby version constraint to ~> 3.3 --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index bb7ba51d..0db8e5fa 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,7 @@ end source 'https://rubygems.org' -ruby '3.3.2' +ruby '~> 3.3' # as web framework if next? From 83cc294f8db479a817e90e155f6a302169d04ec0 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Mon, 24 Jun 2024 15:22:57 +0200 Subject: [PATCH 2/5] Update ruby to version 3.3.3 --- .ruby-version | 2 +- Gemfile.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ruby-version b/.ruby-version index 47725433..619b5376 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.3.2 +3.3.3 diff --git a/Gemfile.lock b/Gemfile.lock index 369771ce..7c047cbf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -704,7 +704,7 @@ DEPENDENCIES whenever RUBY VERSION - ruby 3.3.2 + ruby 3.3.3 BUNDLED WITH 2.5.9 From 50130ba0900ee998ce3eaf7035af6dc01d5a0f6e Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Mon, 24 Jun 2024 15:23:37 +0200 Subject: [PATCH 3/5] Use .ruby-version to set the ruby version in workflows No need to change the versions in multiple files... --- .github/workflows/next-rails.yml | 1 - .github/workflows/spec.yml | 2 -- 2 files changed, 3 deletions(-) diff --git a/.github/workflows/next-rails.yml b/.github/workflows/next-rails.yml index 76bbb97c..386abdc3 100644 --- a/.github/workflows/next-rails.yml +++ b/.github/workflows/next-rails.yml @@ -26,7 +26,6 @@ jobs: echo "BUNDLE_CACHE_PATH=vendor/cache.next" >> $GITHUB_ENV - uses: ruby/setup-ruby@v1 with: - ruby-version: 3.3.2 bundler-cache: true - name: Prepare spec run: | diff --git a/.github/workflows/spec.yml b/.github/workflows/spec.yml index a7036ebd..c4ec147b 100644 --- a/.github/workflows/spec.yml +++ b/.github/workflows/spec.yml @@ -16,7 +16,6 @@ jobs: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: - ruby-version: 3.3.2 bundler-cache: true - run: bundle exec rubocop - run: bundle exec haml-lint app/views @@ -34,7 +33,6 @@ jobs: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: - ruby-version: 3.3.2 bundler-cache: true - name: Prepare spec run: | From 559c2b9ab0fb2618e159a8d0ab189a6c2dbc211a Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Mon, 24 Jun 2024 15:24:42 +0200 Subject: [PATCH 4/5] Allow more Webdrivers update URLs in spec Follow advise from the webdrivers wiki --- spec/support/external_request.rb | 4 ---- spec/support/webmock.rb | 13 +++++++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 spec/support/webmock.rb diff --git a/spec/support/external_request.rb b/spec/support/external_request.rb index a3ebf939..74d70d4f 100644 --- a/spec/support/external_request.rb +++ b/spec/support/external_request.rb @@ -2,10 +2,6 @@ # Mock external requests to youtube require 'webmock/rspec' -driver_urls = Webdrivers::Common.subclasses.map do |driver| - Addressable::URI.parse(driver.base_url).host -end -WebMock.disable_net_connect!(allow_localhost: true, allow: [*driver_urls, /stripe.com/]) RSpec.configure do |config| config.before(:each) do diff --git a/spec/support/webmock.rb b/spec/support/webmock.rb new file mode 100644 index 00000000..29af2a1b --- /dev/null +++ b/spec/support/webmock.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# Allow webdriver update urls +# from https://github.com/titusfortner/webdrivers/wiki/Using-with-VCR-or-WebMock +allowed_urls = Webdrivers::Common.subclasses.map(&:base_url) +allowed_urls << /geckodriver/ +# We've seen [a redirect](https://github.com/titusfortner/webdrivers/issues/204) to this domain +allowed_urls += ['github-releases.githubusercontent.com'] + +# Allow stripe.com for stripe integration tests +allowed_urls += ['stripe.com'] + +WebMock.disable_net_connect!(allow_localhost: true, allow: allowed_urls) From f12a24bce8947b7a0b658d33a131b7debaae15fe Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Mon, 24 Jun 2024 15:26:13 +0200 Subject: [PATCH 5/5] Stop updating webdrivers in build --- Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 59e6b032..9e18612e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,8 +20,7 @@ WORKDIR /osem/ RUN bundle config set --local path 'vendor/bundle'; \ bundle install --jobs=4 --retry=3 -# Install our process manager / update chromedriver -RUN sudo gem install foreman; \ - bundle exec bin/rails webdrivers:chromedriver:update +# Install our process manager +RUN sudo gem install foreman CMD ["foreman", "start"]