Skip to content

gem CI workflow: Check if the gem builds #100

Open
@bastelfreak

Description

@bastelfreak

Use Case

It makes sense to check if a gem still builds within a PR. That ensures that an upcoming release isn't broken. At Vox Pupuli we use the following matrix:

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
      - name: Verify gem builds
        run: gem build --strict --verbose *.gemspec

Describe the Solution You Would Like

Run gem builds with gem build --strict --verbose *.gemspec during each PR. The same should be applied for releasing a gem.

Describe Alternatives You've Considered

A clear and concise description of any alternative solutions or features you've considered.

Additional Context

This can be considered as a breaking change for gems without proper dependency boundaries. In those cases the command will fail with --strict. This change shouldn't be implemented in the main branch but rather in something like a v2. See #89

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