paolobrasolin/mnogootex

View on GitHub
.github/workflows/main.yml

Summary

Maintainability
Test Coverage
name: CI

on:
  push:
  pull_request:

jobs:

  test:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ 'ubuntu-latest', 'macos-latest' ]
        ruby: [ '2.6', '2.7', '3.0' ]
        include:
          - os: ubuntu-latest
            ruby: '2.7'
            coverage: true

    steps:

      - name: Checkout repo
        uses: actions/checkout@v2

      - name: Setup Ruby
        uses: ./.github/actions/setup-ruby
        with:
          ruby-version: ${{ matrix.ruby }}
          cache-key: gems-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('Gemfile', 'mnogootex.gemspec') }}
          cache-restore-keys: gems-${{ matrix.os }}-${{ matrix.ruby }}-

      - name: Run tests
        run: bundle exec rake spec:rspec

      - name: Test and publish coverage to Code Climate
        uses: paambaati/codeclimate-action@v3.0.0
        if: ${{ matrix.coverage && github.ref == 'refs/heads/main' }}
        env:
          CC_TEST_REPORTER_ID: 890ed5ee01002c7149920883256f8e4790000127faa9ddf14d86dd3ceb3b8179
          COVERAGE: true
        with:
          coverageCommand: bundle exec rspec
          coverageLocations: ${{ github.workspace }}/coverage/coverage.json:simplecov