Skip to content

gem CI workflow: Don't run rubocop multiple times #99

Open
@bastelfreak

Description

@bastelfreak

Use Case

At the moment the [gem_ci](https://github.com/puppetlabs/cat-github-actions/blob/main/.github/workflows/gem_ci.yml#L61 workflow runs the rubocop rake task multiple times. I think this should be updated. This check doesn't depend on the ruby/puppet version in the CI job. At Vox Pupuli we use something like this pattern:

jobs:
  rubocop:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install Ruby ${{ matrix.ruby }}
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: "3.3"
          bundler-cache: true
      - name: Run Rubocop
        run: bundle exec rake rubocop
  test:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        ruby:
          - "2.7"
          - "3.0"
          - "3.1"
          - "3.2"
          - "3.3"
    name: Ruby ${{ matrix.ruby }}
    steps:
      - uses: actions/checkout@v4
      - name: Install Ruby ${{ matrix.ruby }}
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby }}
          bundler-cache: true
      - name: Run tests
        run: bundle exec rake --rakefile Rakefile_ci -T | grep release
      - name: Verify gem builds
        run: gem build --strict --verbose *.gemspec

This defines a rubocop job outside of the matrix.

Describe the Solution You Would Like

Run rubocop only once.

Describe Alternatives You've Considered

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions