ThomasKoppensteiner/sidekiq-undertaker

View on GitHub
.github/workflows/ruby-build.yml

Summary

Maintainability
Test Coverage
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby

name: Ruby-Build

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  test:

    runs-on: ubuntu-latest
    continue-on-error: ${{ matrix.experimental }} # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idcontinue-on-error

    services:
      redis:
        image: redis
        ports:
          - 6379:6379

    strategy:
      fail-fast: false
      matrix:
        # SEE: https://github.com/ruby/setup-ruby#supported-versions
        # https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#expanding-or-adding-matrix-configurations
        ruby-version: ['ruby', '3.1', '3.2', '3.3', 'jruby']
        experimental: [false]
        include: # HINT: Do not use arrays for values here
          - ruby-version: 'truffleruby'
            experimental: true
          - ruby-version: 'truffleruby+graalvm'
            experimental: true

    env:
      JRUBY_OPTS: '--debug'

    steps:
    - uses: actions/checkout@v4
    - name: Set up Ruby
    # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
    # change this to (see https://github.com/ruby/setup-ruby#versioning):
      uses: ruby/setup-ruby@v1
      with:
        ruby-version: ${{ matrix.ruby-version }}
        bundler-cache: true # runs 'bundle install' and caches installed gems automatically
    - name: Run tests
      run: COVERAGE=true bundle exec rspec
    - name: 'Upload Coverage Report'
      uses: actions/upload-artifact@v4
      if: ${{ matrix.ruby-version == 'ruby' }}
      with:
        name: coverage-report
        path: ./coverage
        retention-days: 1

  coverage:
    needs: [ test ]
    name: coverage
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: Download Coverage Report
      uses: actions/download-artifact@v4
      with:
        name: coverage-report
        path: ./coverage
    - uses: paambaati/codeclimate-action@v8.0.0
      env:
        # Set CC_TEST_REPORTER_ID as secret of your repo
        CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
      with:
        debug: true