.github/workflows/ci.yml
name: Lint and test
on:
push:
branches:
- main
tags:
- '!*'
pull_request:
paths:
- '!*.MD'
- '!*.md'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Ruby 2.7
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Generate lockfile for cache key
run: bundle lock
- name: Cache gems
uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-rspec-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-rspec-
- name: Install gems
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Run RuboCop
uses: reviewdog/action-rubocop@v1
with:
rubocop_version: gemfile
rubocop_extensions: rubocop-rails:gemfile rubocop-rspec:gemfile
github_token: ${{ secrets.github_token }}
reporter: github-pr-check # Default is github-pr-check
- name: Run RSpec
run: bundle exec rake spec
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}