.github/workflows/tests.yml
name: Tests
on: [push, pull_request]
jobs:
test:
name: Test on ruby ${{ matrix.ruby }} and rails ${{ matrix.rails }}
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ['2.6', '2.7']
rails: ['5.2.3', '6.0.0', '6.1.0']
env:
CI: true
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Do some action caching
uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.rails }}-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.rails }}-
- name: Set up Ruby ${{ matrix.ruby }}
uses: actions/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Install bundler
run: gem install bundler
- name: Run Bundler
run: bundle install --jobs 4 --retry 3
- name: Run RSpec with RBS
if: matrix.ruby == '2.7' && matrix.rails == '6.0.0'
run: |
gem install rbs
rbs collection install
RBS_TEST_TARGET="Rubanok::*" RUBYOPT="-rrbs/test/setup" bundle exec rspec --force-color
- name: Run RSpec without RBS
if: matrix.ruby != '2.7' || matrix.rails != '6.0.0'
run: |
bundle exec rspec --force-color
coverage:
name: "Check coverage"
runs-on: ubuntu-latest
env:
CI: true
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Do some action caching
uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-2.7-6.1.0-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-2.7-6.1.0-
- name: Set up Ruby 2.7
uses: actions/setup-ruby@v1
with:
ruby-version: 2.7
- name: Install bundler
run: gem install bundler
- name: Run bundler
env:
RAILS_VERSION: 6.1.0
run: |
bundle install --jobs 4 --retry 3
- name: Test & publish code coverage
uses: paambaati/codeclimate-action@v2.7.5
env:
CC_TEST_REPORTER_ID: ${{secrets.CODE_CLIMATE_REPORTER_ID}}
with:
coverageCommand: bundle exec rspec
debug: true