aglushkov/serega

View on GitHub
.github/workflows/main.yml

Summary

Maintainability
Test Coverage
name: Ruby

on:
  - push
  - pull_request

jobs:
  build:
    # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
    runs-on: ubuntu-22.04
    name: Ruby ${{ matrix.ruby }} (AR ${{ matrix.activerecord }})
    strategy:
      fail-fast: false
      matrix:
        include:
          # https://github.com/ruby/setup-ruby
          - ruby: "head"
            activerecord: "7.1"
          - ruby: "3.3"
            activerecord: "7.1"
          - ruby: "3.2"
            activerecord: "7.1"
          - ruby: "3.1"
            activerecord: "7.1"
          - ruby: "3.0"
            activerecord: "7.1"
          - ruby: "2.7"
            activerecord: "7.1"
          - ruby: "2.7"
            activerecord: "6.1"
          - ruby: "2.7"
            activerecord: "5.2"
          - ruby: "2.6"
            activerecord: "6.1"
          - ruby: "2.6"
            activerecord: "5.2"
          - ruby: "jruby-9.4.5"
            activerecord: "6.1"
          - ruby: "jruby-9.4.5"
            activerecord: "7.0" # latest activerecord-jdbcsqlite3-adapter (70.1) does not support latest rails 7.1 yet
          - ruby: "truffleruby-23.1.1"
            activerecord: "7.1"
          - ruby: "truffleruby-23.1.1"
            activerecord: "6.1"

    env:
      BUNDLE_GEMFILE: gemfiles/${{ matrix.activerecord }}.gemfile
      CC_TEST_REPORTER_ID: 2b0dd65d1c078b0d9f6edc768751ab9f210decdace1eae9651603a6bccff96ca

    steps:
      # https://github.com/actions/checkout
      - uses: actions/checkout@v3

      # https://github.com/ruby/setup-ruby
      - name: Set up Ruby ${{ matrix.ruby }} (AR ${{ matrix.activerecord }})
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby }}
          bundler-cache: true

      - name: Install codespell
        if: startsWith(matrix.ruby, '3.2') && matrix.activerecord == '7.1'
        run: |
          python -m pip install --upgrade pip
          pip install codespell==2.2.6
      - name: Check spelling with codespell
        if: startsWith(matrix.ruby, '3.2') && matrix.activerecord == '7.1'
        run: codespell --skip="./sig,./doc,./coverage,./vendor" || exit 1

      # Check code standards only for latest MRI. It takes a lot of time for jruby or truffleruby
      - name: Check Code Standards
        if: startsWith(matrix.ruby, '3.2') && matrix.activerecord == '7.1'
        run: bundle exec rubocop

      - name: Run Tests
        run: bundle exec rspec

      - name: Markdown linter
        if: startsWith(matrix.ruby, '3.2') && matrix.activerecord == '7.1'
        run: bundle exec mdl README.md CHANGELOG.md RELEASE.md

      # https://github.com/paambaati/codeclimate-action
      - name: Publish code coverage to code-climate
        uses: paambaati/codeclimate-action@v3.2
        if: (github.event_name == 'push') && startsWith(matrix.ruby, '3.2')