Skip to content

Commit

Permalink
Upgrade CI rubies, upgrade Rubocop and move it to separate CI job
Browse files Browse the repository at this point in the history
  • Loading branch information
Envek committed Dec 11, 2023
1 parent 9d84af2 commit 03ef470
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 26 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Lint Ruby

on:
push:
branches:
- master
paths:
- "gemfiles/*"
- "Gemfile"
- "**/*.rb"
- "**/*.gemspec"
- ".github/workflows/lint.yml"
pull_request:
paths:
- "gemfiles/*"
- "Gemfile"
- "**/*.rb"
- "**/*.gemspec"
- ".github/workflows/lint.yml"

jobs:
rubocop:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true
- name: Lint Ruby code with RuboCop
run: |
bundle exec rubocop
32 changes: 8 additions & 24 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,15 @@ jobs:
fail-fast: false
matrix:
include:
- ruby: 3.0
- ruby: 2.7
- ruby: 2.6
- ruby: 2.5
container:
image: ruby:${{ matrix.ruby }}
env:
CI: true
- ruby: "3.2"
- ruby: "3.1"
- ruby: "3.0"
- ruby: "2.7"
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
path: vendor/bundle
key: bundle-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}-${{ hashFiles('**/Gemfile') }}
restore-keys: |
bundle-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}-${{ hashFiles('**/Gemfile') }}
bundle-${{ matrix.ruby }}-
- name: Upgrade Bundler to 2.0 (for older Rubies)
run: gem install bundler -v '~> 2.0'
- name: Bundle install
run: |
bundle config path vendor/bundle
bundle install
bundle update
- name: Run Rubocop
run: bundle exec rubocop
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run RSpec
run: bundle exec rspec
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ gemspec

gem 'byebug'
gem 'rack'
gem 'rake', '~> 12.0'
gem 'rake', '~> 13.0'
gem 'rspec', '~> 3.0'
gem 'rubocop', '~> 0.81.0'
gem 'rubocop', '~> 1.0'

0 comments on commit 03ef470

Please sign in to comment.