Skip to content

Commit 6463bf2

Browse files
Earlopainbbatsov
authored andcommitted
Move main tests to GitHub actions
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
1 parent 54421d6 commit 6463bf2

File tree

4 files changed

+42
-173
lines changed

4 files changed

+42
-173
lines changed

.circleci/config.yml

Lines changed: 0 additions & 147 deletions
This file was deleted.

.github/workflows/rubocop.yml

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@ concurrency:
1515
cancel-in-progress: true
1616

1717
jobs:
18-
main:
19-
name: >-
20-
${{ matrix.os }} ${{ matrix.ruby }}
18+
spec:
19+
name: Spec - ${{ matrix.os }} ${{ matrix.ruby }}
2120
runs-on: ${{ matrix.os }}-latest
2221
env:
2322
# See https://github.com/tmm1/test-queue#environment-variables
2423
TEST_QUEUE_WORKERS: 2
2524
strategy:
2625
fail-fast: false
2726
matrix:
28-
# [ubuntu, macos, windows]
29-
os: [windows]
27+
os: [ubuntu, windows]
3028
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3', 'head']
3129
include:
30+
- os: ubuntu
31+
ruby: jruby-9.4
3232
- os: windows
3333
ruby: mingw
3434
exclude:
@@ -38,13 +38,45 @@ jobs:
3838
steps:
3939
- name: checkout
4040
uses: actions/checkout@v4
41-
- name: set up Ruby
41+
- name: Set up Ruby
4242
uses: ruby/setup-ruby@v1
4343
with:
4444
ruby-version: ${{ matrix.ruby }}
4545
bundler-cache: true
46+
- name: Set up Coverage
47+
# Only collect coverage data on ubuntu runners with CRuby
48+
if: matrix.os == 'ubuntu' && !startsWith(matrix.ruby, 'jruby-')
49+
run: echo "COVERAGE=true" >> $GITHUB_ENV
4650
- name: spec
51+
env:
52+
CI_RUBY_VERSION: ${{ matrix.ruby }}
4753
run: bundle exec rake spec
54+
- name: Upload Coverage Artifact
55+
if: matrix.os == 'ubuntu' && !startsWith(matrix.ruby, 'jruby-')
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: coverage-${{ matrix.os }}-${{ matrix.ruby }}
59+
path: coverage/.resultset.json
60+
if-no-files-found: error
61+
62+
upload_coverage:
63+
name: Upload Coverage
64+
needs: spec
65+
runs-on: ubuntu-latest
66+
67+
steps:
68+
- name: checkout
69+
uses: actions/checkout@v4
70+
- uses: actions/download-artifact@v4
71+
name: Download Coverage Artifacts
72+
with:
73+
pattern: coverage-*
74+
- uses: paambaati/codeclimate-action@v6
75+
env:
76+
CC_TEST_REPORTER_ID: a11b66bfbb1acdf220d5cb317b2e945a986fd85adebe29a76d411ad6d74ec31f
77+
with:
78+
coverageLocations: |
79+
${{github.workspace}}/coverage-*/.resultset.json:simplecov
4880
4981
ascii_spec:
5082
name: Ascii Spec - ${{ matrix.os }} ${{ matrix.ruby }}
@@ -73,6 +105,8 @@ jobs:
73105
ruby-version: ${{ matrix.ruby }}
74106
bundler-cache: true
75107
- name: ascii_spec
108+
env:
109+
CI_RUBY_VERSION: ${{ matrix.ruby }}
76110
run: bundle exec rake ascii_spec
77111

78112
internal_investigation:
@@ -126,20 +160,6 @@ jobs:
126160
- name: Check documentation syntax
127161
run: bundle exec rake documentation_syntax_check
128162

129-
jruby:
130-
name: JRuby 9.4
131-
runs-on: ubuntu-latest
132-
steps:
133-
- name: checkout
134-
uses: actions/checkout@v4
135-
- name: set up Ruby
136-
uses: ruby/setup-ruby@v1
137-
with:
138-
ruby-version: jruby-9.4
139-
bundler-cache: true
140-
- name: spec
141-
run: bundle exec rake spec
142-
143163
prism:
144164
runs-on: ubuntu-latest
145165
name: Prism

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
----------
66
[![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop)
77
[![Gem Version](https://badge.fury.io/rb/rubocop.svg)](https://badge.fury.io/rb/rubocop)
8-
[![CircleCI Status](https://circleci.com/gh/rubocop/rubocop/tree/master.svg?style=svg)](https://circleci.com/gh/rubocop/rubocop/tree/master)
98
[![Actions Status](https://github.com/rubocop/rubocop/workflows/CI/badge.svg?branch=master)](https://github.com/rubocop/rubocop/actions?query=workflow%3ACI)
109
[![Test Coverage](https://api.codeclimate.com/v1/badges/d2d67f728e88ea84ac69/test_coverage)](https://codeclimate.com/github/rubocop/rubocop/test_coverage)
1110
[![Maintainability](https://api.codeclimate.com/v1/badges/d2d67f728e88ea84ac69/maintainability)](https://codeclimate.com/github/rubocop/rubocop/maintainability)

spec/spec_helper.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,8 @@
5757

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

60-
if %w[ruby-head-ascii_spec ruby-head-spec].include? ENV.fetch('CIRCLE_JOB', nil)
61-
config.filter_run_excluding broken_on: :ruby_head
62-
end
63-
64-
config.filter_run_excluding broken_on: :jruby if ENV.fetch('GITHUB_JOB', nil) == 'jruby'
60+
config.filter_run_excluding broken_on: :ruby_head if ENV['CI_RUBY_VERSION'] == 'head'
61+
config.filter_run_excluding broken_on: :jruby if RUBY_ENGINE == 'jruby'
6562
config.filter_run_excluding broken_on: :prism if ENV['PARSER_ENGINE'] == 'parser_prism'
6663

6764
# Prism supports Ruby 3.3+ parsing.

0 commit comments

Comments
 (0)