Skip to content

Commit

Permalink
ci: Fix failures caused by ChromeDriver (PT-185924955/GH-1209)
Browse files Browse the repository at this point in the history
* Update 'docker/build-push-action' from v3 to v4
* Use URI.open to fix Kernel#open deprecation warning:
  "/home/runner/work/rigse/rigse/rails/spec/support/solr_spec_helper.rb:23:
  warning: calling URI.open via Kernel#open is deprecated, call URI.open
  directly or use URI#open"
* Add Webdrivers::Chromedriver.required_version
* Install pinned versions of of Chrome & ChromeDriver
  • Loading branch information
433eros committed Aug 29, 2023
1 parent 6990320 commit e1c80db
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
TEST_SOLR_PORT: 8981
env:
RAILS_ENV: ${{ matrix.env }}
CHROMEDRIVER_VERSION: '114.0.5735.90'
defaults:
run:
working-directory: ./rails/
Expand All @@ -76,6 +77,16 @@ jobs:
with:
bundler-cache: true # use Actions cache to significantly speed up subsequent runs
working-directory: ./rails/
# Install ChromeDriver (wiping out whatever version was previously installed on Actions Runner)
- name: Install ChromeDriver
uses: nanasess/setup-chromedriver@v2
with:
chromedriver-version: ${{ env.CHROMEDRIVER_VERSION }}
# Install Google Chrome browser (that matches ChromeDriver version from previous Actions step)
- name: Install Google Chrome
run: |
wget -O /tmp/google_chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROMEDRIVER_VERSION}-1_amd64.deb
sudo dpkg -i /tmp/google_chrome.deb
- run: cp -v ./config/database.github_actions.yml ./config/database.yml
- run: cp -v ./config/app_environment_variables.sample.rb ./config/app_environment_variables.rb
Expand Down Expand Up @@ -146,7 +157,7 @@ jobs:
type=ref,event=pr
type=sha,prefix=git-
- name: Build & push Docker image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v4
with:
#context: '{{defaultContext}}:rails'
context: ./rails/
Expand Down
5 changes: 5 additions & 0 deletions rails/spec/support/capybara_initializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ def call
Capybara.server_port = '43447'
end

# ChromeDriver version shipped with GitHub Actions: https://github.com/actions/runner-images/blob/d5d4c565dffff750a33f0f7d020bc12a4a896d90/images/linux/Ubuntu2204-Readme.md?plain=1#L158
# Latest ChromeDriver version available for download: https://chromedriver.storage.googleapis.com/LATEST_RELEASE
# See: https://github.com/hitobito/hitobito/blob/c5a459a95feefc32f7caa4c3bd5b36c7cb149916/spec/spec_helper.rb#L190-L196
Webdrivers::Chromedriver.required_version = '114.0.5735.90' # Pin ChromeDriver version

# Register the driver
Capybara.register_driver(:selenium) { |app| driver(app) }
Capybara.javascript_driver = :selenium
Expand Down
4 changes: 3 additions & 1 deletion rails/spec/support/solr_spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'open-uri'

$original_sunspot_session = Sunspot.session
Sunspot.session = Sunspot::Rails::StubSessionProxy.new($original_sunspot_session)

Expand All @@ -20,7 +22,7 @@ def reindex_all
end

def test_solr_server
open("http://#{SOLR_HOST}:#{SOLR_PORT}/")
URI.open("http://#{SOLR_HOST}:#{SOLR_PORT}/")
end

def solr_setup
Expand Down

0 comments on commit e1c80db

Please sign in to comment.