Skip to content

Commit

Permalink
Allow custom bundle versions on ruby build matrix (#35)
Browse files Browse the repository at this point in the history
* Allow custom bundle versions on ruby build matrix

* Target major and minor versions only

* Remove global BUNDLER_VERSION to allow running with multiple versions of bundle in a single build

* Make 2.7 and 3.1 default ruby, 7, 6.1, 6.0, and 5.2 the default rails
  • Loading branch information
xjunior authored Nov 2, 2022
1 parent 16e5eff commit 068aa7c
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 30 deletions.
64 changes: 45 additions & 19 deletions .github/workflows/_ruby-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,75 @@ on:
rubygems_api_key:
required: true
inputs:
before_build:
type: string
required: false
package:
required: true
type: string
workdir:
required: false
type: string
ruby:
required: true
default: '["2.7", "3.1"]'
required: false
type: string
rails:
required: true
default: '["7.0","6.1","6.0","5.2"]'
required: false
type: string
bundler:
default: '["2"]'
required: false
type: string

env:
PROJECT_DIR: 'packages/${{ inputs.package }}'

jobs:
build:
runs-on: ubuntu-latest
name: Ruby ${{ matrix.ruby }} / Rails ${{ matrix.rails }}
name: Ruby ${{ matrix.ruby }} / Rails ${{ matrix.rails }} / Bundler ${{ matrix.bundler }}
strategy:
fail-fast: false
matrix:
ruby: ${{ fromJSON(inputs.ruby) }}
rails: ${{ fromJSON(inputs.rails) }}
bundler: ${{ fromJSON(inputs.bundler) }}
exclude:
- rails: '5.2.8.1'
ruby: '3.1.2'
- rails: '7.0.3.1'
ruby: '2.7.4'
- rails: '5.2'
ruby: '3.1'
- rails: '5.2'
ruby: '3.0'
- rails: '6.0'
ruby: '3.0'
- rails: '6.0'
ruby: '3.1'
- rails: '7.0'
ruby: '2.7'
- rails: '7.0'
ruby: '3.0'
- ruby: '3.1'
bundler: '1'
env:
RAILS_VERSION: '~> ${{ matrix.rails }}'
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
env:
RAILS_VERSION: '~> ${{ matrix.rails }}'
BUNDLER_VERSION: '${{ matrix.bundler }}'
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
working-directory: ${{ env.PROJECT_DIR }}
env:
RAILS_VERSION: ${{ matrix.rails }}
bundler: ${{ matrix.bundler }}
ruby-version: ${{ matrix.ruby }}
working-directory: ${{ inputs.workdir }}
- name: Before build
if: ${{ inputs.before_build != '' }}
run: '${{ inputs.before_build }}'
- name: Run the build script
working-directory: ${{ env.PROJECT_DIR }}
working-directory: ${{ inputs.workdir }}
run: bundle exec rake
env:
RAILS_VERSION: ${{ matrix.rails }}
- name: Ensure license compliance
working-directory: ${{ env.PROJECT_DIR }}
working-directory: ${{ inputs.workdir }}
run: bundle exec license_finder

release:
Expand All @@ -59,4 +85,4 @@ jobs:
env:
RELEASE_COMMAND: rake build release:guard_clean release:rubygem_push
RUBYGEMS_API_KEY: ${{ secrets.rubygems_api_key }}
WORKDIR: ${{ env.PROJECT_DIR }}
WORKDIR: ${{ inputs.workdir }}
3 changes: 1 addition & 2 deletions .github/workflows/audit_tracker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ jobs:
uses: ./.github/workflows/_ruby-package.yml
with:
package: ${{ github.workflow }}
ruby: '["2.7.4", "3.1.2"]'
rails: '["7.0.3.1","6.1.6.1","6.0.5.1","5.2.8.1"]'
workdir: 'packages/${{ github.workflow }}'
secrets: inherit
3 changes: 1 addition & 2 deletions .github/workflows/consent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ jobs:
uses: ./.github/workflows/_ruby-package.yml
with:
package: ${{ github.workflow }}
ruby: '["2.7.4", "3.1.2"]'
rails: '["7.0.3.1","6.1.6.1","6.0.5.1","5.2.8.1"]'
workdir: 'packages/${{ github.workflow }}'
secrets: inherit
3 changes: 1 addition & 2 deletions .github/workflows/lumberaxe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ jobs:
uses: ./.github/workflows/_ruby-package.yml
with:
package: ${{ github.workflow }}
ruby: '["2.7.4", "3.1.2"]'
rails: '["7.0.3.1","6.1.6.1","6.0.5.1","5.2.8.1"]'
workdir: 'packages/${{ github.workflow }}'
secrets: inherit
3 changes: 1 addition & 2 deletions .github/workflows/nitro_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ jobs:
uses: ./.github/workflows/_ruby-package.yml
with:
package: ${{ github.workflow }}
ruby: '["2.7.4", "3.1.2"]'
rails: '["7.0.3.1","6.1.6.1","6.0.5.1","5.2.8.1"]'
workdir: 'packages/${{ github.workflow }}'
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/rubocop-cobra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ jobs:
uses: ./.github/workflows/_ruby-package.yml
with:
package: ${{ github.workflow }}
ruby: '["2.7.4", "3.1.2"]'
workdir: 'packages/${{ github.workflow }}'
rails: '["any"]'
secrets: inherit
3 changes: 1 addition & 2 deletions .github/workflows/rubocop-powerhome.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ jobs:
uses: ./.github/workflows/_ruby-package.yml
with:
package: ${{ github.workflow }}
ruby: '["2.7.4", "3.1.2"]'
rails: '["7.0.3.1","6.1.6.1","6.0.5.1","5.2.8.1"]'
workdir: 'packages/${{ github.workflow }}'
secrets: inherit

0 comments on commit 068aa7c

Please sign in to comment.