diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f9da7b75..fab0b02a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: | @@ -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\//}" diff --git a/Gemfile b/Gemfile index 90416a68..1192d149 100644 --- a/Gemfile +++ b/Gemfile @@ -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' diff --git a/Gemfile.lock b/Gemfile.lock index fac35c53..91a4667f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -372,6 +374,7 @@ DEPENDENCIES rspec-rails selenium-webdriver simplecov (= 0.17.1) + simplecov-cobertura sprockets-rails sqlite3 (= 1.3.13) sslrequirement diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 6efdf5c7..30da678d 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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' diff --git a/features/support/env.rb b/features/support/env.rb index a7558f24..a802da8a 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -35,9 +35,11 @@ # npx @puppeteer/browsers install chromedriver@124.0.6367.91 # (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|