diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 9876c082e..d977fad70 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -5,6 +5,17 @@ concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: + internal_investigation: + runs-on: ubuntu-latest + name: Internal Investigation + steps: + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ruby # Latest stable CRuby version + bundler-cache: true + - run: bundle exec rake internal_investigation + yamllint: name: Yamllint runs-on: ubuntu-latest @@ -18,6 +29,7 @@ jobs: yamllint_comment: true env: GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} + mdformat: name: Mdformat runs-on: ubuntu-latest diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 88f234e1c..7265c67ec 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,28 +35,45 @@ jobs: - "3.4" - ruby-head - jruby-9.4 - task: - - internal_investigation - - spec - name: "Ruby ${{ matrix.ruby }}: ${{ matrix.task }}" + parser_engine: + - parser_whitequark + include: + - ruby: "2.7" # Minimum version required for Prism to run. + parser_engine: parser_prism + name: "Ruby ${{ matrix.ruby }} - Spec (${{ matrix.parser_engine }})" steps: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: ruby-version: "${{ matrix.ruby }}" bundler-cache: true - - run: NO_COVERAGE=true bundle exec rake ${{ matrix.task }} + - run: bundle exec rake spec + env: + PARSER_ENGINE: ${{ matrix.parser_engine }} + - name: Upload Coverage Artifact + uses: actions/upload-artifact@v4 + with: + name: coverage-ubuntu-${{ matrix.ruby }}-${{ matrix.parser_engine }} + path: coverage/.resultset.json + include-hidden-files: true coverage: + name: Check Coverage + needs: main runs-on: ubuntu-latest - name: "Test coverage" + steps: - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + name: Download Coverage Artifacts + with: + pattern: coverage-* - uses: ruby/setup-ruby@v1 with: - ruby-version: "3.4" + ruby-version: ruby # Latest stable CRuby version bundler-cache: true - - run: bundle exec rake spec + + - run: bundle exec rake coverage:ci edge-rubocop: runs-on: ubuntu-latest @@ -122,24 +139,3 @@ jobs: ruby-version: "3.4" bundler-cache: true - run: NO_COVERAGE=true bundle exec rake spec - - prism: - runs-on: ubuntu-latest - name: Prism - steps: - - uses: actions/checkout@v4 - - name: Use prism parser - run: | - cat << EOF > Gemfile.local - gem 'prism' - EOF - - name: set up Ruby - uses: ruby/setup-ruby@v1 - with: - # Specify the minimum Ruby version 2.7 required for Prism to run. - ruby-version: "2.7" - bundler-cache: true - - env: - NO_COVERAGE: true - PARSER_ENGINE: parser_prism - run: bundle exec rake spec diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b39d1e6fe..d3d11d700 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -3,7 +3,7 @@ require 'rubocop' require 'rubocop/rspec/support' -require 'simplecov' unless ENV['NO_COVERAGE'] +require 'simplecov' unless ENV['NO_COVERAGE'] || RUBY_ENGINE == 'jruby' module SpecHelper ROOT = Pathname.new(__dir__).parent.freeze diff --git a/tasks/coverage.rake b/tasks/coverage.rake new file mode 100644 index 000000000..36b43e5f9 --- /dev/null +++ b/tasks/coverage.rake @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +namespace :coverage do + desc 'Report Coverage from merged CI runs' + task :ci do + require 'simplecov' + + SimpleCov.collate Dir['coverage-*/.resultset.json'] + end +end