st0012/object_tracer

View on GitHub
.github/workflows/ruby.yml

Summary

Maintainability
Test Coverage
name: Ruby

on:
  workflow_dispatch:
  push:
    branches:
      - master
  pull_request:

jobs:
  test:
    name: Test on ruby ${{ matrix.ruby_version }} and rails ${{ matrix.rails_version }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        rails_version: ['5.2', '6.0.0', '6.1.0']
        ruby_version: ['2.7', '3.0']
        os: [ubuntu-latest]
        exclude:
          - ruby_version: '3.0'
            rails_version: '5.2'
    steps:
    - uses: actions/checkout@v1

    - name: Set up Ruby ${{ matrix.ruby_version }}
      uses: actions/setup-ruby@v1
      with:
        ruby-version: ${{ matrix.ruby_version }}

    - name: Install sqlite
      run: |
        # See https://github.community/t5/GitHub-Actions/ubuntu-latest-Apt-repository-list-issues/td-p/41122/page/2
        for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done
        sudo apt-get update
        sudo apt-get install libsqlite3-dev

    - name: Build with Rails ${{ matrix.rails_version }}
      env:
        RAILS_VERSION: ${{ matrix.rails_version }}
      run: |
        gem install bundler
        bundle install --jobs 4 --retry 3

    - name: Run test with Rails ${{ matrix.rails_version }}
      env:
        RAILS_VERSION: ${{ matrix.rails_version }}
      run: make test

    - name: Publish Test Coverage
      uses: paambaati/codeclimate-action@v2.6.0
      env:
        CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
      if: ${{ env.CC_TEST_REPORTER_ID != '' }}
      with:
        # the coverage result should already be generated by the previous step
        # so we don't need to provide and command in the step
        # this is just a placeholder to avoid it run the default `yarn coverage` command
        coverageCommand: ruby -v
        debug: true