Skip to content

Commit

Permalink
try to fix chromedriver stuff for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
armandofox committed Sep 26, 2024
1 parent 307b8dd commit 7216990
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 14 deletions.
28 changes: 18 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@ jobs:
TZ: America/Los_Angeles

steps:
- uses: actions/checkout@v2

- uses: browser-actions/setup-chrome@v1
with:
install-chromedriver: true
- name: Checkout code
uses: actions/checkout@v2

- name: install libxslt
run: |
Expand All @@ -42,16 +39,27 @@ jobs:
run: |
bundle install --without production
- name: run RSpec tests and capture coverage
run: |
bundle exec rspec
$CCTR format-coverage --output coverage/codeclimate.$SUITE.json --input-type simplecov
- name: Install Chrome For Testing and Chromedriver
uses: browser-actions/setup-chrome@v1
id: install-chromedriver
with:
chrome-version: stable
install-chromedriver: true
install-dependencies: true

- name: run Cucumber tests and capture coverage
env:
GITHUB_ACTIONS_CHROMEDRIVER_PATH: ${{ steps.install-chromedriver.outputs.chromedriver-path }}
GITHUB_ACTIONS_CHROME_FOR_TESTING_PATH: ${{ steps.install-chromedriver.outputs.chrome-path }}
run: |
bundle exec cucumber --retry 2 2>/dev/null
$CCTR format-coverage --output coverage/codeclimate.$SUITE.json --input-type simplecov
- name: run RSpec tests and capture coverage
run: |
bundle exec rspec
$CCTR format-coverage --output coverage/codeclimate.$SUITE.json --input-type simplecov
- name: Publish code coverage
run: |
export GIT_BRANCH="${GITHUB_REF/refs\/heads\//}"
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ group :test do
gem 'rspec-json_expectations'
gem 'rails-controller-testing' # for assigns()
gem 'simplecov', '0.17.1'
gem 'simplecov-cobertura'
gem 'timecop'
gem 'webmock'
gem 'vcr'
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ GEM
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-cobertura (1.4.2)
simplecov (~> 0.8)
simplecov-html (0.10.2)
sinatra (3.2.0)
mustermann (~> 3.0)
Expand Down Expand Up @@ -372,6 +374,7 @@ DEPENDENCIES
rspec-rails
selenium-webdriver
simplecov (= 0.17.1)
simplecov-cobertura
sprockets-rails
sqlite3 (= 1.3.13)
sslrequirement
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def maintenance_mode?

def set_secure_headers
if request.ssl?
# :rails4: can be omitted for rails >=5
# :rails5: can be omitted for rails >=5
response.headers['Strict-Transport-Security'] = "max-age=31536000; includeSubDomains"
end
response.headers['X-Robots-Tag'] = 'none' # equivalent to 'noindex,nofollow'
Expand Down
8 changes: 5 additions & 3 deletions features/support/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@
# npx @puppeteer/browsers install [email protected]
# (Note: these 'installs' just put stuff in the $cwd. brew install may be better)

path_to_chromedriver = `find ~+/tmp -type f -name 'chromedriver'`.chomp
#path_to_chrome_for_testing = `find ~+/tmp -type f -name 'chrome'`.chomp
path_to_chrome_for_testing = `find ~+/tmp -type f -name 'Google Chrome for Testing'`.chomp
path_to_chromedriver = ENV['GITHUB_ACTIONS_CHROMEDRIVER_PATH'] ||
`find ~+/tmp -type f -name 'chromedriver'`.chomp

path_to_chrome_for_testing = ENV['GITHUB_ACTIONS_CHROME_FOR_TESTING_PATH'] ||
`find ~+/tmp -type f -name 'Google Chrome for Testing'`.chomp

Capybara.register_driver :selenium_chrome_headless do |app|
options = Selenium::WebDriver::Chrome::Options.new.tap do |opts|
Expand Down

0 comments on commit 7216990

Please sign in to comment.