Skip to content

Set up development environment: RuboCop rake task, RSpec, and SimpleCov #11

Set up development environment: RuboCop rake task, RSpec, and SimpleCov

Set up development environment: RuboCop rake task, RSpec, and SimpleCov #11

Workflow file for this run

name: CI
on:
pull_request:
push:
branches: [ main ]
jobs:
lint:
runs-on: ubuntu-latest
env:
RUBY_VERSION: 4.0.4
RUBOCOP_CACHE_ROOT: tmp/rubocop
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true
- name: Prepare RuboCop cache
uses: actions/cache@v4
env:
DEPENDENCIES_HASH: ${{ hashFiles('**/.rubocop.yml', '**/.rubocop_todo.yml', 'Gemfile.lock') }}
with:
path: ${{ env.RUBOCOP_CACHE_ROOT }}
key: rubocop-${{ runner.os }}-${{ env.RUBY_VERSION }}-${{ env.DEPENDENCIES_HASH }}-${{ github.ref_name == github.event.repository.default_branch && github.run_id || 'default' }}
restore-keys: |
rubocop-${{ runner.os }}-${{ env.RUBY_VERSION }}-${{ env.DEPENDENCIES_HASH }}-
- name: Lint code for consistent style
run: bin/rubocop -f github
test:
runs-on: ubuntu-latest
env:
RUBY_VERSION: 4.0.4
RAILS_ENV: test
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true
- name: Run tests
run: bundle exec rspec