arturictus/sidekiq_alive

View on GitHub
.github/workflows/test.yml

Summary

Maintainability
Test Coverage
name: Test

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

jobs:
  rubocop:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          bundler-cache: true
          cache-version: 1
      - name: Run lint
        run: bundle exec rubocop --color
  coverage:
    runs-on: ubuntu-latest
    services:
      # Label used to access the service container
      redis:
        # Docker Hub image
        image: redis
        # Set health checks to wait until redis has started
        options: >-
          --health-cmd "redis-cli ping"
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
        ports:
          # Maps port 6379 on service container to the host
          - 6379:6379
    steps:
      - uses: actions/checkout@v4
      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          bundler-cache: true
          cache-version: 1
      - name: Run tests
        run: bundle exec rspec --force-color
      # - name: Code Coverage Summary
      #   uses: irongut/CodeCoverageSummary@v1.3.0
      #   with:
      #     filename: coverage/coverage.xml
      #     badge: true
      #     fail_below_min: true
      #     format: markdown
      #     hide_branch_rate: false
      #     hide_complexity: true
      #     indicators: true
      #     output: both
      #     # thresholds: '60 80'
      # - name: Add Coverage PR Comment
      #   uses: marocchino/sticky-pull-request-comment@v2
      #   if: github.event_name == 'pull_request'
      #   with:
      #     recreate: true
      #     path: code-coverage-results.md
  test:
    runs-on: ubuntu-latest
    needs: rubocop
    strategy:
      fail-fast: false
      matrix:
        ruby-version: ["3.2", "3.1", "3.0"]
        sidekiq-version: ["~> 6.5", "~> 7"]
        with-rackup: [true, false]
    # Service containers to run with `runner-job`
    services:
      # Label used to access the service container
      redis:
        # Docker Hub image
        image: redis
        # Set health checks to wait until redis has started
        options: >-
          --health-cmd "redis-cli ping"
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
        ports:
          # Maps port 6379 on service container to the host
          - 6379:6379
    steps:
      - uses: actions/checkout@v4
      - name: Set up Ruby ${{ matrix.ruby-version }} with Sidekiq ${{ matrix.sidekiq-version }}
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby-version }}
          bundler-cache: true
          cache-version: 1
        env:
          SIDEKIQ_VERSION_RANGE: ${{ matrix.sidekiq-version }}
          WITH_RACKUP: ${{ matrix.with-rackup }}
      - name: Run tests
        run: bundle exec rspec --force-color
        env:
          SIDEKIQ_VERSION_RANGE: ${{ matrix.sidekiq-version }}
          WITH_RACKUP: ${{ matrix.with-rackup }}