Strech/sidekiq-prometheus-exporter

View on GitHub
.github/workflows/ci.yaml

Summary

Maintainability
Test Coverage
---
name: CI
on:
  push:
    branches: ["master"]
  pull_request:
    branches: ["master"]
  schedule:
    # Run the workflow once per month
    - cron: "0 0 1 * *"
jobs:
  rubocop:
    name: Rubocop
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: 3.1.4
      - name: rubocop
        uses: reviewdog/action-rubocop@v2
        with:
          rubocop_version: gemfile
          rubocop_extensions: rubocop-rake:gemfile rubocop-rspec:gemfile rubocop-performance:gemfile
          reporter: github-pr-review
          fail_on_error: true

  test:
    needs: rubocop
    runs-on: ubuntu-latest
    name: Ruby ${{ matrix.ruby }} / Sidekiq ${{ matrix.sidekiq }}
    # Don't stop testing if the latest version has failures
    continue-on-error: ${{ matrix.ruby == 'latest' || matrix.sidekiq == 'latest' }}
    strategy:
      matrix:
        # Always keep a window of "5 most recent supperted"
        # including (or on top with) HEAD
        ruby: ["3.0.6", "3.1.4", "3.2.3", "3.3.0", "latest"]
        sidekiq: ["4.1.0", "4.x", "5.x", "6.x", "7.x", "latest"]
        # Allow failures ... kind-a
        exclude:
          - ruby: "3.0.6"
            sidekiq: "latest"
          - ruby: "3.1.4"
            sidekiq: "latest"
          - ruby: "3.2.3"
            sidekiq: "latest"
          - ruby: "3.3.0"
            sidekiq: "latest"

    container:
      image: ruby:${{ matrix.ruby }}

    steps:
      - uses: actions/checkout@v4

      - uses: actions/cache@v4
        id: vendor-cache
        with:
          path: vendor
          key: bundle-${{ matrix.ruby }}-sidekiq-${{ matrix.sidekiq }}-${{ hashFiles('**/*.gemspec') }}-${{ hashFiles('**/.*Gemfile.lock') }}

      - name: Upgrade Bundler to 2.x (for older Ruby versions)
        run: gem install bundler -v '~> 2.1'

      - name: Bundle install
        run: |
          bundle config path vendor/bundle
          bundle config gemfile gemfiles/sidekiq_${{ matrix.sidekiq }}.Gemfile
          bundle install

      - name: Run RSpec
        run: bundle exec rake spec