enkessler/cuke_modeler

View on GitHub
.github/workflows/ci.yml

Summary

Maintainability
Test Coverage
name: CI

on:
  push:
  pull_request:
  workflow_dispatch:
  schedule:
    - cron: '0 0 1 * *'  # Monthly

jobs:

  test_ubuntu:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest]
        ruby-version: [ '2.3', '2.5', '2.7', '3.0',
                        'jruby-9.1.17.0', 'jruby-9.3.4.0']
        gemfile: [ gherkin9, gherkin10, gherkin11, gherkin12, gherkin13, gherkin14,
                   gherkin15, gherkin16, gherkin17, gherkin18, gherkin19, gherkin20,
                   gherkin21, gherkin22, gherkin23, gherkin24, gherkin25, gherkin26,
                   gherkin27, gherkin28, gherkin29, gherkin30 ]
        exclude:
          # Requires at least Ruby 2.5
          - ruby-version: 2.3
            gemfile: gherkin27
          - ruby-version: jruby-9.1.17.0
            gemfile: gherkin27
          - ruby-version: 2.3
            gemfile: gherkin28
          - ruby-version: jruby-9.1.17.0
            gemfile: gherkin28
          # Requires at least Ruby 3.0
          - ruby-version: 2.3
            gemfile: gherkin29
          - ruby-version: 2.5
            gemfile: gherkin29
          - ruby-version: 2.7
            gemfile: gherkin29
          - ruby-version: jruby-9.1.17.0
            gemfile: gherkin29
          - ruby-version: jruby-9.3.4.0
            gemfile: gherkin29

          - ruby-version: 2.3
            gemfile: gherkin30
          - ruby-version: 2.5
            gemfile: gherkin30
          - ruby-version: 2.7
            gemfile: gherkin30
          - ruby-version: jruby-9.1.17.0
            gemfile: gherkin30
          - ruby-version: jruby-9.3.4.0
            gemfile: gherkin30

    runs-on: ${{ matrix.os }}
    env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
      BUNDLE_GEMFILE: testing/gemfiles/${{ matrix.gemfile }}.gemfile
      JRUBY_OPTS: '-J-Djdk.io.File.enableADS=true' # Because of a JDK bug that might get fixed at some point
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby-version }}
          bundler-cache: true # runs 'bundle install' and caches installed gems automatically
      - name: Run CI Rake task
        run: bundle exec rake cuke_modeler:test_everything
      - name: Push code coverage to Coveralls (conditional)
        uses: coverallsapp/github-action@master
        with:
          github-token: ${{ secrets.github_token }}
          path-to-lcov: "./reports/coverage/lcov/lcov.info"
          parallel: true
          flag-name: run-${{ matrix.os }}-${{ matrix.ruby-version }}-${{ matrix.gemfile }}
        if: matrix.ruby-version != '2.3' && matrix.ruby-version != 'jruby-9.1.17.0'

  test_macos:
    strategy:
      fail-fast: false
      matrix:
        # TODO: Split the MacOS job into two jobs ('test_macos_older' and 'test_macos_newer') with different OS
        # portions of the matrix instead of having one job with clunky exclusions?

        os: [macos-latest, macos-13]
        ruby-version: [ '2.3', '2.5', '2.7', '3.0',
                        'jruby-9.1.17.0', 'jruby-9.3.4.0']
        gemfile: [ gherkin9, gherkin10, gherkin11, gherkin12, gherkin13, gherkin14,
                   gherkin15, gherkin16, gherkin17, gherkin18, gherkin19, gherkin20,
                   gherkin21, gherkin22, gherkin23, gherkin24, gherkin25, gherkin26,
                   gherkin27, gherkin28, gherkin29, gherkin30 ]
        exclude:
          # Requires at least Ruby 2.5
          - ruby-version: 2.3
            gemfile: gherkin27
          - ruby-version: jruby-9.1.17.0
            gemfile: gherkin27
          - ruby-version: 2.3
            gemfile: gherkin28
          - ruby-version: jruby-9.1.17.0
            gemfile: gherkin28
          # Requires at least Ruby 3.0
          - ruby-version: 2.3
            gemfile: gherkin29
          - ruby-version: 2.5
            gemfile: gherkin29
          - ruby-version: 2.7
            gemfile: gherkin29
          - ruby-version: jruby-9.1.17.0
            gemfile: gherkin29
          - ruby-version: jruby-9.3.4.0
            gemfile: gherkin29

          - ruby-version: 2.3
            gemfile: gherkin30
          - ruby-version: 2.5
            gemfile: gherkin30
          - ruby-version: 2.7
            gemfile: gherkin30
          - ruby-version: jruby-9.1.17.0
            gemfile: gherkin30
          - ruby-version: jruby-9.3.4.0
            gemfile: gherkin30

          # Note: GitHub Actions 'include' can't override any matrix values. It can only add them. So an exhaustive
          # list of exclusions has to be used instead if we want to work with just one job matrix.

          # Newer versions of Ruby (>=2.6) can handle ARM, so they can run on the latest MacOS instead of an older one
          - os: macos-13
            ruby-version: 2.7
          - os: macos-13
            ruby-version: 3.0
          # Older versions of Ruby (<2.6) need AMD, so they can only run on an older MacOS instead of the latest one
          - os: macos-latest
            ruby-version: 2.3
          - os: macos-latest
            ruby-version: 2.5
          # These JRuby versions are not available on MacOS 14 (which is currently the latest MacOS available), so they can only run on an older one
          - os: macos-latest
            ruby-version: jruby-9.1.17.0
          - os: macos-latest
            ruby-version: jruby-9.3.4.0


          # Just not worth it to get these working and no additional and meaningful proof is provided by these
          # combinations, given the other combinations that are being tested.

          # Hits some kind of Java issue
          - os: macos-13
            ruby-version: jruby-9.1.17.0

    runs-on: ${{ matrix.os }}
    env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
      BUNDLE_GEMFILE: testing/gemfiles/${{ matrix.gemfile }}.gemfile
      JRUBY_OPTS: '-J-Djdk.io.File.enableADS=true' # Because of a JDK bug that might get fixed at some point
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby-version }}
          bundler-cache: true # runs 'bundle install' and caches installed gems automatically
      - name: Run CI Rake task
        run: bundle exec rake cuke_modeler:test_everything
      - name: Push code coverage to Coveralls (conditional)
        uses: coverallsapp/github-action@master
        with:
          github-token: ${{ secrets.github_token }}
          path-to-lcov: "./reports/coverage/lcov/lcov.info"
          parallel: true
          flag-name: run-${{ matrix.os }}-${{ matrix.ruby-version }}-${{ matrix.gemfile }}
        if: matrix.ruby-version != '2.3' && matrix.ruby-version != 'jruby-9.1.17.0'

  test_windows:
    strategy:
      fail-fast: false
      matrix:
        os: [windows-latest]
        ruby-version: [ '2.3', '2.5', '2.7', '3.0',
                        'jruby-9.1.17.0', 'jruby-9.3.4.0']
        gemfile: [ gherkin9, gherkin10, gherkin11, gherkin12, gherkin13, gherkin14,
                   gherkin15, gherkin16, gherkin17, gherkin18, gherkin19, gherkin20,
                   gherkin21, gherkin22, gherkin23, gherkin24, gherkin25, gherkin26,
                   gherkin27, gherkin28, gherkin29, gherkin30 ]
        exclude:
          # Requires at least Ruby 2.5
          - ruby-version: 2.3
            gemfile: gherkin27
          - ruby-version: jruby-9.1.17.0
            gemfile: gherkin27
          - ruby-version: 2.3
            gemfile: gherkin28
          - ruby-version: jruby-9.1.17.0
            gemfile: gherkin28
          # Requires at least Ruby 3.0
          - ruby-version: 2.3
            gemfile: gherkin29
          - ruby-version: 2.5
            gemfile: gherkin29
          - ruby-version: 2.7
            gemfile: gherkin29
          - ruby-version: jruby-9.1.17.0
            gemfile: gherkin29
          - ruby-version: jruby-9.3.4.0
            gemfile: gherkin29

          - ruby-version: 2.3
            gemfile: gherkin30
          - ruby-version: 2.5
            gemfile: gherkin30
          - ruby-version: 2.7
            gemfile: gherkin30
          - ruby-version: jruby-9.1.17.0
            gemfile: gherkin30
          - ruby-version: jruby-9.3.4.0
            gemfile: gherkin30

          # Just not worth it to get these working and no additional and meaningful proof is provided by these
          # combinations, given the other combinations that are being tested.

          # Problems building FFI native extensions during gem installation
          - os: windows-latest
            ruby-version: '2.3'

          # Hits some kind of Java bug
          - os: windows-latest
            ruby-version: jruby-9.3.4.0
            gemfile: gherkin23
          - os: windows-latest
            ruby-version: jruby-9.3.4.0
            gemfile: gherkin22
          - os: windows-latest
            ruby-version: jruby-9.3.4.0
            gemfile: gherkin20
          - os: windows-latest
            ruby-version: jruby-9.3.4.0
            gemfile: gherkin18
          - os: windows-latest
            ruby-version: jruby-9.3.4.0
            gemfile: gherkin15

    runs-on: ${{ matrix.os }}
    env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
      BUNDLE_GEMFILE: testing/gemfiles/${{ matrix.gemfile }}.gemfile
      JRUBY_OPTS: '-J-Djdk.io.File.enableADS=true' # Because of a JDK bug that might get fixed at some point
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby-version }}
          bundler-cache: true # runs 'bundle install' and caches installed gems automatically
      - name: Run CI Rake task
        run: bundle exec rake cuke_modeler:test_everything
      - name: Push code coverage to Coveralls (conditional)
        uses: coverallsapp/github-action@master
        with:
          github-token: ${{ secrets.github_token }}
          path-to-lcov: "./reports/coverage/lcov/lcov.info"
          parallel: true
          flag-name: run-${{ matrix.os }}-${{ matrix.ruby-version }}-${{ matrix.gemfile }}
        if: matrix.ruby-version != '2.3' && matrix.ruby-version != 'jruby-9.1.17.0'

  test_finish:
    needs: [ test_macos, test_ubuntu, test_windows ]
    runs-on: ubuntu-latest
    steps:
      - name: Coveralls Finished
        uses: coverallsapp/github-action@master
        with:
          github-token: ${{ secrets.github_token }}
          parallel-finished: true

  check_documentation:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: '3.0'
          bundler-cache: true # runs 'bundle install' and caches installed gems automatically
      - name: Run documentation check
        run: bundle exec rake cuke_modeler:check_documentation

  lint_code:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: '3.0'
          bundler-cache: true # runs 'bundle install' and caches installed gems automatically
      - name: Run RuboCop
        run: bundle exec rake cuke_modeler:rubocop