name: CI

on: pull_request

jobs:
  base:
    name: Base steps
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Check Whitespace
      run: git diff --check -- HEAD~1
  ruby-spec:
    name: Unit Specs
    runs-on: ${{ matrix.os }}
    timeout-minutes: 10
    strategy:
      fail-fast: false
      matrix:
        ruby: [ruby-2.6, ruby-2.7, ruby-3.0]
        os: [macos-latest, ubuntu-latest]
    steps:
    - uses: actions/checkout@v2
    - uses: ruby/setup-ruby@v1
      with:
        ruby-version: ${{ matrix.ruby }}
        bundler-cache: true
    - run: bundle exec rspec spec/unit
  ruby-mutant:
    name: Mutation coverage
    runs-on: ${{ matrix.os }}
    timeout-minutes: 30
    strategy:
      fail-fast: false
      matrix:
        ruby: [ruby-2.6, ruby-2.7, ruby-3.0]
        os: [macos-latest, ubuntu-latest]
    steps:
    - uses: actions/checkout@v2
      with:
        fetch-depth: 0
    - uses: ruby/setup-ruby@v1
      with:
        ruby-version: ${{ matrix.ruby }}
        bundler-cache: true
    - run: bundle exec mutant run
  ruby-rubocop:
    name: Rubocop
    runs-on: ${{ matrix.os }}
    timeout-minutes: 5
    strategy:
      fail-fast: false
      matrix:
        ruby: [ruby-2.6, ruby-2.7, ruby-3.0]
        os: [macos-latest, ubuntu-latest]
    steps:
    - uses: actions/checkout@v2
      with:
        fetch-depth: 0
    - uses: ruby/setup-ruby@v1
      with:
        ruby-version: ${{ matrix.ruby }}
        bundler-cache: true
    - run: bundle exec rubocop
