puppetlabs / puppetlabs/cat-github-actions

gem CI workflow: Don't run rubocop multiple times

Open
#99 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
Shell
Stars
1
Forks
5
Avg merge
16m
Merged PRs (30d)
2

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read .github/workflows/gem_ci.yml around line 61 and inspect how the gem_ci workflow invokes the rubocop rake task within its Ruby/Puppet matrix. Update the workflow so RuboCop runs once outside that matrix, then verify the matrix still covers the remaining checks and that the workflow completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, ruby
Domain
ci-cd
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.