diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af4080bcc..cdd1d56d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,19 @@ on: branches: - '*' jobs: + rubocop: + name: Rubocop + runs-on: 'ubuntu-20.04' + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.0' + - run: script/update_rubygems_and_install_bundler + - run: bundle install --standalone + - run: bundle binstubs --all + - run: script/run_rubocop + test: name: 'Ruby: ${{ matrix.ruby }}, Rails: ${{ matrix.env.RAILS_VERSION }}' runs-on: ubuntu-20.04 diff --git a/.rubocop.yml b/.rubocop.yml index af0e19fb1..95832a486 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -5,7 +5,9 @@ AllCops: Exclude: # Templates are really ERB which Rubocop does not parse - bin/**/* + - bundle/**/* - lib/generators/rspec/*/templates/**/* + - tmp/**/* Bundler/DuplicatedGem: Enabled: false diff --git a/script/predicate_functions.sh b/script/predicate_functions.sh index 746a4985f..1a3198801 100644 --- a/script/predicate_functions.sh +++ b/script/predicate_functions.sh @@ -97,11 +97,3 @@ function documentation_enforced { return 1 fi } - -function style_and_lint_enforced { - if [ -x ./bin/rubocop ]; then - return 0 - else - return 1 - fi -} diff --git a/script/run_build b/script/run_build index b7e542bfb..2938f81c8 100755 --- a/script/run_build +++ b/script/run_build @@ -26,10 +26,6 @@ if documentation_enforced; then fold "doc check" check_documentation_coverage fi -if style_and_lint_enforced; then - fold "rubocop" check_style_and_lint -fi - if is_mri; then fold "one-by-one specs" run_specs_one_by_one run_all_spec_suites diff --git a/script/run_rubocop b/script/run_rubocop new file mode 100755 index 000000000..c2d94dcca --- /dev/null +++ b/script/run_rubocop @@ -0,0 +1,14 @@ +#!/bin/bash +# This file was generated on 2022-01-10T22:24:10+00:00 from the rspec-dev repo. +# DO NOT modify it by hand as your changes will get lost the next time it is generated. + +set -e +source script/functions.sh + +# Allow repos to override the default functions and add their own +if [ -f script/custom_build_functions.sh ]; then + source script/custom_build_functions.sh +fi + + +fold "rubocop" check_style_and_lint