Skip to content

Commit

Permalink
Check in all Gemfile.lock (#100)
Browse files Browse the repository at this point in the history
The dependencies used in CI and by a fresh checkout of the project
should be known good, and upgrades should be explicit (by Renovate in
our case) so that we can identify clearly the source of breakage (CI
failing on Renovate PRs).

Fixes #97.

---------

Co-authored-by: Carlos Palhares <[email protected]>
  • Loading branch information
benlangfeld and xjunior authored Jul 14, 2023
1 parent 9dfbf45 commit 4568e58
Show file tree
Hide file tree
Showing 101 changed files with 7,584 additions and 70 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/_ruby-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
on:
workflow_call:
secrets:
rubygems_api_key:
required: true
inputs:
before_build:
type: string
required: false
package:
required: true
type: string
workdir:
required: false
type: string
ruby:
default: '["2.7","3.1","3.2"]'
required: false
type: string
gemfiles:
default: '["Gemfile"]'
required: false
type: string
bundler:
default: '["2"]'
required: false
type: string
exclude:
default: '[]'
required: false
type: string

jobs:
build:
runs-on: ubuntu-latest
name: Ruby ${{ matrix.ruby }} / Bundler ${{ matrix.bundler }} / ${{ matrix.gemfile }}
strategy:
fail-fast: false
matrix:
ruby: ${{ fromJSON(inputs.ruby) }}
gemfile: ${{ fromJSON(inputs.gemfiles) }}
bundler: ${{ fromJSON(inputs.bundler) }}
exclude: ${{ fromJSON(inputs.exclude)}}
env:
BUNDLE_GEMFILE: '${{ matrix.gemfile }}'
BUNDLER_VERSION: '${{ matrix.bundler }}'
RAILS_ENV: test
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
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: ${{ inputs.workdir }}
run: bundle exec rake
- name: Ensure license compliance
working-directory: ${{ inputs.workdir }}
run: bundle exec license_finder

release:
needs: build
runs-on: ubuntu-latest
if: ${{ contains(github.ref, 'refs/tags/v') && contains(github.ref, inputs.package) }}
steps:
- uses: actions/checkout@v3
- uses: powerhome/publish-rubygems-action@git-safe-directory
env:
RELEASE_COMMAND: rake build release:guard_clean release:rubygem_push
RUBYGEMS_API_KEY: ${{ secrets.rubygems_api_key }}
WORKDIR: ${{ inputs.workdir }}
3 changes: 2 additions & 1 deletion .github/workflows/audit_tracker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ on:

jobs:
ruby:
uses: ./.github/workflows/_ruby-package.yml
uses: ./.github/workflows/_ruby-workflow.yml
with:
package: ${{ github.workflow }}
workdir: 'packages/${{ github.workflow }}'
gemfiles: "['gemfiles/rails_6_0.gemfile','gemfiles/rails_6_1.gemfile','gemfiles/rails_7_0.gemfile']"
secrets: inherit
4 changes: 2 additions & 2 deletions .github/workflows/camel_trail.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ on:

jobs:
ruby:
uses: ./.github/workflows/_ruby-package.yml
uses: ./.github/workflows/_ruby-workflow.yml
with:
package: ${{ github.workflow }}
workdir: 'packages/${{ github.workflow }}'
rails: '["6.1","6.0"]'
gemfiles: "['gemfiles/rails_6_0.gemfile','gemfiles/rails_6_1.gemfile']"
secrets: inherit
8 changes: 7 additions & 1 deletion .github/workflows/consent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@ on:

jobs:
ruby:
uses: ./.github/workflows/_ruby-package.yml
uses: ./.github/workflows/_ruby-workflow.yml
with:
package: ${{ github.workflow }}
workdir: 'packages/${{ github.workflow }}'
gemfiles: "['gemfiles/rails_6_0.gemfile','gemfiles/rails_6_1.gemfile','gemfiles/rails_7_0.gemfile']"
exclude: |-
[
{ 'ruby': '3.2', 'gemfile': 'gemfiles/rails_6_0.gemfile'},
{ 'ruby': '3.2', 'gemfile': 'gemfiles/rails_6_1.gemfile'},
]
secrets: inherit
3 changes: 1 addition & 2 deletions .github/workflows/cygnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ on:

jobs:
ruby:
uses: ./.github/workflows/_ruby-package.yml
uses: ./.github/workflows/_ruby-workflow.yml
with:
package: ${{ github.workflow }}
workdir: 'packages/${{ github.workflow }}'
rails: '["any"]'
secrets: inherit
3 changes: 1 addition & 2 deletions .github/workflows/data_taster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ on:

jobs:
ruby:
uses: ./.github/workflows/_ruby-package.yml
uses: ./.github/workflows/_ruby-workflow.yml
with:
package: ${{ github.workflow }}
workdir: 'packages/${{ github.workflow }}'
rails: '["any"]'
secrets: inherit
4 changes: 2 additions & 2 deletions .github/workflows/edgestitch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ on:

jobs:
ruby:
uses: ./.github/workflows/_ruby-package.yml
uses: ./.github/workflows/_ruby-workflow.yml
with:
package: ${{ github.workflow }}
workdir: 'packages/${{ github.workflow }}'
before_build: sudo /etc/init.d/mysql start
rails: "['6.0','6.1','7.0']"
gemfiles: "['gemfiles/rails_6_0.gemfile','gemfiles/rails_6_1.gemfile','gemfiles/rails_7_0.gemfile']"
secrets: inherit
3 changes: 2 additions & 1 deletion .github/workflows/lumberaxe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ on:

jobs:
ruby:
uses: ./.github/workflows/_ruby-package.yml
uses: ./.github/workflows/_ruby-workflow.yml
with:
package: ${{ github.workflow }}
workdir: 'packages/${{ github.workflow }}'
gemfiles: "['gemfiles/rails_6_0.gemfile','gemfiles/rails_6_1.gemfile','gemfiles/rails_7_0.gemfile']"
secrets: inherit
3 changes: 2 additions & 1 deletion .github/workflows/nitro_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ on:

jobs:
ruby:
uses: ./.github/workflows/_ruby-package.yml
uses: ./.github/workflows/_ruby-workflow.yml
with:
package: ${{ github.workflow }}
workdir: 'packages/${{ github.workflow }}'
gemfiles: "['gemfiles/rails_6_0.gemfile','gemfiles/rails_6_1.gemfile','gemfiles/rails_7_0.gemfile']"
secrets: inherit
3 changes: 1 addition & 2 deletions .github/workflows/rabbet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ on:

jobs:
ruby:
uses: ./.github/workflows/_ruby-package.yml
uses: ./.github/workflows/_ruby-workflow.yml
with:
package: ${{ github.workflow }}
workdir: 'packages/${{ github.workflow }}'
rails: '["any"]'
secrets: inherit
3 changes: 1 addition & 2 deletions .github/workflows/rubocop-cobra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ on:

jobs:
ruby:
uses: ./.github/workflows/_ruby-package.yml
uses: ./.github/workflows/_ruby-workflow.yml
with:
package: ${{ github.workflow }}
workdir: 'packages/${{ github.workflow }}'
rails: '["any"]'
secrets: inherit
3 changes: 2 additions & 1 deletion .github/workflows/rubocop-powerhome.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ on:

jobs:
ruby:
uses: ./.github/workflows/_ruby-package.yml
uses: ./.github/workflows/_ruby-workflow.yml
with:
package: ${{ github.workflow }}
workdir: 'packages/${{ github.workflow }}'
gemfiles: "['gemfiles/rails_6_0.gemfile','gemfiles/rails_6_1.gemfile','gemfiles/rails_7_0.gemfile']"
secrets: inherit
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ config/master.key
/.bundle
/vendor/bundle

# these should all be checked in to normalize the environment:
# Gemfile.lock, .ruby-version, .ruby-gemset

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

Expand Down
2 changes: 1 addition & 1 deletion packages/audit_tracker/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@

# rspec failure tracking
.rspec_status
Gemfile.lock

spec/internal/db/*.sqlite
8 changes: 8 additions & 0 deletions packages/audit_tracker/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
require:
- rubocop-powerhome

Style/FrozenStringLiteralComment:
Exclude:
- 'gemfiles/*'

Bundler/OrderedGems:
Exclude:
- 'gemfiles/*'
13 changes: 13 additions & 0 deletions packages/audit_tracker/Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

appraise "rails-6-0" do
gem "rails", "6.0.6.1"
end

appraise "rails-6-1" do
gem "rails", "6.1.7.4"
end

appraise "rails-7-0" do
gem "rails", "7.0.6"
end
4 changes: 0 additions & 4 deletions packages/audit_tracker/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ source "https://rubygems.org"

gemspec

rails_version = ENV.fetch("RAILS_VERSION", ">= 5.2.8.1")

gem "rails", rails_version

gem "byebug"
gem "license_finder", ">= 7.0"
gem "rake", ">= 13.0"
Expand Down
Loading

0 comments on commit 4568e58

Please sign in to comment.