Skip to content

Commit

Permalink
WIP - modify spec_helper to try to not interfere with coveralls
Browse files Browse the repository at this point in the history
  • Loading branch information
Janell-Huyck committed Jan 27, 2025
1 parent 6e17db0 commit 5d3bd7e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 14 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/run-rspec-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ jobs:

- name: Set Environment Variables
run: |
echo "COVERAGE=false" >> $GITHUB_ENV
echo "PARALLEL_TEST_GROUPS=true" >> $GITHUB_ENV
echo "DATABASE_USERNAME=apache" >> $GITHUB_ENV
echo "DATABASE_PASSWORD=" >> $GITHUB_ENV
echo "COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }}" >> $GITHUB_ENV
Expand Down Expand Up @@ -148,6 +150,19 @@ jobs:
path: coverage/lcov/coverage-${{ matrix.job_index }}.info
if-no-files-found: warn

check-runtime-log-file:
needs: rspec
run: |
echo "Checking after rspec runs to see if runtime log was created:"
if [ -f tmp/parallel_runtime_rspec.log ]; then
echo "Runtime log exists."
echo "Contents of runtime log:"
cat tmp/parallel_runtime_rspec.log
else
echo "Runtime log does not exist."
fi
combine-results-and-coverage:
needs: rspec
runs-on: ubuntu-latest
Expand Down Expand Up @@ -188,11 +203,15 @@ jobs:
- name: Combine Coverage Files
run: |
gem install coveralls-lcov --user-install
export PATH="$HOME/.gem/ruby/$(ruby -e 'puts RUBY_VERSION')/bin:$PATH"
lcov --add-tracefile=coverage/lcov/coverage-0.info \
--add-tracefile=coverage/lcov/coverage-1.info \
--add-tracefile=coverage/lcov/coverage-2.info \
--add-tracefile=coverage/lcov/coverage-3.info \
--output-file=coverage/lcov/combined.info
coveralls-lcov -v -n coverage/lcov/combined.info
- name: Upload Combined Coverage to Coveralls
run: coveralls-lcov -v -n coverage/lcov/combined.info
Expand Down
31 changes: 17 additions & 14 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,25 @@
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
require 'simplecov'
require 'capybara/rspec'
SimpleCov.start 'rails'

SimpleCov.at_exit do
SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
)
SimpleCov.result.format!
end
if ENV['COVERAGE'] != 'false' && ENV['PARALLEL_TEST_GROUPS'] != 'true'
SimpleCov.start 'rails'

SimpleCov.at_exit do
SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
)
SimpleCov.result.format!
end

# Include coveralls for code-coverage
require 'coveralls'
Coveralls.wear!
# Include coveralls for code-coverage
require 'coveralls'
Coveralls.wear!
end

RSpec.configure do |config|
# rspec-expectations config goes here. You can use an alternate
Expand Down

0 comments on commit 5d3bd7e

Please sign in to comment.