diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18682eaf2..252309b7c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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/ @@ -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 @@ -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/ diff --git a/rails/spec/support/capybara_initializer.rb b/rails/spec/support/capybara_initializer.rb index 3358cc86f..7a74862a6 100644 --- a/rails/spec/support/capybara_initializer.rb +++ b/rails/spec/support/capybara_initializer.rb @@ -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 diff --git a/rails/spec/support/solr_spec_helper.rb b/rails/spec/support/solr_spec_helper.rb index aaf7d3af9..9ec9944a0 100644 --- a/rails/spec/support/solr_spec_helper.rb +++ b/rails/spec/support/solr_spec_helper.rb @@ -1,3 +1,5 @@ +require 'open-uri' + $original_sunspot_session = Sunspot.session Sunspot.session = Sunspot::Rails::StubSessionProxy.new($original_sunspot_session) @@ -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