From 8debd3f5d34726479423634659e04e355f33d79c Mon Sep 17 00:00:00 2001 From: Phil Phillips Date: Tue, 24 Jan 2023 09:53:16 -0600 Subject: [PATCH] ci: conditionally run coverage Truffleruby tests seem to have an issue with calculating coverage. Only run coverage when we need it. --- .github/workflows/ruby-tests.yml | 3 +++ test/minitest_helper.rb | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ruby-tests.yml b/.github/workflows/ruby-tests.yml index 7a28d40..f98b9e5 100644 --- a/.github/workflows/ruby-tests.yml +++ b/.github/workflows/ruby-tests.yml @@ -34,6 +34,9 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby-version }} + - name: Set environment + run: echo "COVERAGE=true" >> "$GITHUB_ENV" + if: matrix.ruby-version == '3.1' && matrix.gemfile == 'faraday-2' - name: Install dependencies run: bundle install - name: Run tests diff --git a/test/minitest_helper.rb b/test/minitest_helper.rb index a20dc06..d7685bf 100644 --- a/test/minitest_helper.rb +++ b/test/minitest_helper.rb @@ -1,8 +1,10 @@ #Bundler.require(:test) $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) -require 'simplecov' -SimpleCov.start +if ENV['COVERAGE'] == 'true' + require 'simplecov' + SimpleCov.start +end require 'minitest/byebug' if ENV['DEBUG'] require 'minitest/autorun'