Skip to content

Commit

Permalink
Move main tests to GitHub actions
Browse files Browse the repository at this point in the history
A job collects coverage, uploads the report as an artifact, and once all
matrix entries are done a separate job will download these and use
`paambaati/codeclimate-action` to pass it along to CodeClimate.
This action takes care of formatting and summing the reports.

In addition to that, I'm also fixing the spec filters which I forgot about in the other PRs
  • Loading branch information
Earlopain authored and bbatsov committed May 29, 2024
1 parent 54421d6 commit 6463bf2
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 173 deletions.
147 changes: 0 additions & 147 deletions .circleci/config.yml

This file was deleted.

60 changes: 40 additions & 20 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ concurrency:
cancel-in-progress: true

jobs:
main:
name: >-
${{ matrix.os }} ${{ matrix.ruby }}
spec:
name: Spec - ${{ matrix.os }} ${{ matrix.ruby }}
runs-on: ${{ matrix.os }}-latest
env:
# See https://github.com/tmm1/test-queue#environment-variables
TEST_QUEUE_WORKERS: 2
strategy:
fail-fast: false
matrix:
# [ubuntu, macos, windows]
os: [windows]
os: [ubuntu, windows]
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3', 'head']
include:
- os: ubuntu
ruby: jruby-9.4
- os: windows
ruby: mingw
exclude:
Expand All @@ -38,13 +38,45 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@v4
- name: set up Ruby
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Set up Coverage
# Only collect coverage data on ubuntu runners with CRuby
if: matrix.os == 'ubuntu' && !startsWith(matrix.ruby, 'jruby-')
run: echo "COVERAGE=true" >> $GITHUB_ENV
- name: spec
env:
CI_RUBY_VERSION: ${{ matrix.ruby }}
run: bundle exec rake spec
- name: Upload Coverage Artifact
if: matrix.os == 'ubuntu' && !startsWith(matrix.ruby, 'jruby-')
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.os }}-${{ matrix.ruby }}
path: coverage/.resultset.json
if-no-files-found: error

upload_coverage:
name: Upload Coverage
needs: spec
runs-on: ubuntu-latest

steps:
- name: checkout
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
name: Download Coverage Artifacts
with:
pattern: coverage-*
- uses: paambaati/codeclimate-action@v6
env:
CC_TEST_REPORTER_ID: a11b66bfbb1acdf220d5cb317b2e945a986fd85adebe29a76d411ad6d74ec31f
with:
coverageLocations: |
${{github.workspace}}/coverage-*/.resultset.json:simplecov
ascii_spec:
name: Ascii Spec - ${{ matrix.os }} ${{ matrix.ruby }}
Expand Down Expand Up @@ -73,6 +105,8 @@ jobs:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: ascii_spec
env:
CI_RUBY_VERSION: ${{ matrix.ruby }}
run: bundle exec rake ascii_spec

internal_investigation:
Expand Down Expand Up @@ -126,20 +160,6 @@ jobs:
- name: Check documentation syntax
run: bundle exec rake documentation_syntax_check

jruby:
name: JRuby 9.4
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: jruby-9.4
bundler-cache: true
- name: spec
run: bundle exec rake spec

prism:
runs-on: ubuntu-latest
name: Prism
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
----------
[![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop)
[![Gem Version](https://badge.fury.io/rb/rubocop.svg)](https://badge.fury.io/rb/rubocop)
[![CircleCI Status](https://circleci.com/gh/rubocop/rubocop/tree/master.svg?style=svg)](https://circleci.com/gh/rubocop/rubocop/tree/master)
[![Actions Status](https://github.com/rubocop/rubocop/workflows/CI/badge.svg?branch=master)](https://github.com/rubocop/rubocop/actions?query=workflow%3ACI)
[![Test Coverage](https://api.codeclimate.com/v1/badges/d2d67f728e88ea84ac69/test_coverage)](https://codeclimate.com/github/rubocop/rubocop/test_coverage)
[![Maintainability](https://api.codeclimate.com/v1/badges/d2d67f728e88ea84ac69/maintainability)](https://codeclimate.com/github/rubocop/rubocop/maintainability)
Expand Down
7 changes: 2 additions & 5 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,8 @@

config.after(:suite) { RuboCop::Cop::Registry.reset! }

if %w[ruby-head-ascii_spec ruby-head-spec].include? ENV.fetch('CIRCLE_JOB', nil)
config.filter_run_excluding broken_on: :ruby_head
end

config.filter_run_excluding broken_on: :jruby if ENV.fetch('GITHUB_JOB', nil) == 'jruby'
config.filter_run_excluding broken_on: :ruby_head if ENV['CI_RUBY_VERSION'] == 'head'
config.filter_run_excluding broken_on: :jruby if RUBY_ENGINE == 'jruby'
config.filter_run_excluding broken_on: :prism if ENV['PARSER_ENGINE'] == 'parser_prism'

# Prism supports Ruby 3.3+ parsing.
Expand Down

0 comments on commit 6463bf2

Please sign in to comment.