|
| 1 | +name: JRuby |
| 2 | + |
| 3 | +env: |
| 4 | + K_SOUP_COV_DO: false |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - 'main' |
| 10 | + tags: |
| 11 | + - '!*' # Do not execute on tags |
| 12 | + pull_request: |
| 13 | + branches: |
| 14 | + - '*' |
| 15 | + # Allow manually triggering the workflow. |
| 16 | + workflow_dispatch: |
| 17 | + |
| 18 | +permissions: |
| 19 | + contents: read |
| 20 | + |
| 21 | +# Cancels all previous workflow runs for the same branch that have not yet completed. |
| 22 | +concurrency: |
| 23 | + # The concurrency group contains the workflow name and the branch name. |
| 24 | + group: "${{ github.workflow }}-${{ github.ref }}" |
| 25 | + cancel-in-progress: true |
| 26 | + |
| 27 | +jobs: |
| 28 | + test: |
| 29 | + name: Specs - Ruby ${{ matrix.ruby }} ${{ matrix.appraisal }}${{ matrix.name_extra || '' }} |
| 30 | + if: "!contains(github.event.commits[0].message, '[ci skip]') && !contains(github.event.commits[0].message, '[skip ci]')" |
| 31 | + runs-on: ubuntu-22.04 |
| 32 | + continue-on-error: ${{ matrix.experimental || endsWith(matrix.ruby, 'head') }} |
| 33 | + env: # $BUNDLE_GEMFILE must be set at job level, so it is set for all steps |
| 34 | + BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }}.gemfile |
| 35 | + strategy: |
| 36 | + matrix: |
| 37 | + include: |
| 38 | + # TODO: truffleruby does not support upgrading rubygems; VALIDATE ASSUMPTION that same applies to JRuby |
| 39 | + # jruby-9.1 (targets Ruby 2.3 compatibility) |
| 40 | + - ruby: "jruby-9.1" |
| 41 | + appraisal: "ruby-2-3" |
| 42 | + exec_cmd: "rake spec" |
| 43 | + gemfile: "Appraisal.root" |
| 44 | + rubygems: default |
| 45 | + bundler: default |
| 46 | + |
| 47 | + # jruby-9.2 (targets Ruby 2.5 compatibility) |
| 48 | + - ruby: "jruby-9.2" |
| 49 | + appraisal: "ruby-2-5" |
| 50 | + exec_cmd: "rake spec" |
| 51 | + gemfile: "Appraisal.root" |
| 52 | + rubygems: default |
| 53 | + bundler: default |
| 54 | + |
| 55 | + # jruby-9.3 (targets Ruby 2.6 compatibility) |
| 56 | + - ruby: "jruby-9.3" |
| 57 | + appraisal: "ruby-2-6" |
| 58 | + exec_cmd: "rake spec" |
| 59 | + gemfile: "Appraisal.root" |
| 60 | + rubygems: default |
| 61 | + bundler: default |
| 62 | + |
| 63 | + # jruby-9.4 (targets Ruby 3.1 compatibility) |
| 64 | + - ruby: "jruby-9.4" |
| 65 | + appraisal: "ruby-3-1" |
| 66 | + exec_cmd: "rake spec" |
| 67 | + gemfile: "Appraisal.root" |
| 68 | + rubygems: default |
| 69 | + bundler: default |
| 70 | + |
| 71 | + steps: |
| 72 | + - name: Checkout |
| 73 | + uses: actions/checkout@v4 |
| 74 | + |
| 75 | + - name: Setup Ruby & RubyGems |
| 76 | + uses: ruby/setup-ruby@v1 |
| 77 | + with: |
| 78 | + ruby-version: ${{ matrix.ruby }} |
| 79 | + rubygems: ${{ matrix.rubygems }} |
| 80 | + bundler: ${{ matrix.bundler }} |
| 81 | + bundler-cache: false |
| 82 | + |
| 83 | + # Raw `bundle` will use the BUNDLE_GEMFILE set to matrix.gemfile (i.e. Appraisal.root) |
| 84 | + # We need to do this first to get appraisal installed. |
| 85 | + # NOTE: This does not use the main Gemfile at all. |
| 86 | + - name: Bundle install for Appraisal ${{ matrix.appraisal }} |
| 87 | + run: bundle |
| 88 | + - name: Install Appraisal ${{ matrix.appraisal }} dependencies |
| 89 | + run: bundle exec appraisal ${{ matrix.appraisal }} bundle |
| 90 | + - name: Run ${{ matrix.appraisal }} tests via ${{ matrix.exec_cmd }} |
| 91 | + run: bundle exec appraisal ${{ matrix.appraisal }} bundle exec ${{ matrix.exec_cmd }} |
0 commit comments