Skip to content

Commit

Permalink
Refactor CI gemfiles
Browse files Browse the repository at this point in the history
Rather than have a gemfile per Ruby version, we can read it in from an
environment variable, since it's the only thing that's changing.
  • Loading branch information
sambostock committed Feb 1, 2024
1 parent 4b310bd commit cc23bd8
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 52 deletions.
44 changes: 24 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
name: Ruby ${{ matrix.ruby }} | Gemfile ${{ matrix.gemfile }}
continue-on-error: ${{ matrix.gemfile == 'rails_edge' }}
name: Ruby ${{ matrix.ruby }} | Rails ${{ matrix.rails }} | Gemfile ${{ matrix.gemfile }}
continue-on-error: ${{ matrix.rails == 'edge' }}
services:
redis:
image: redis
Expand All @@ -15,46 +15,50 @@ jobs:
strategy:
matrix:
ruby: ["2.6", "2.7", "3.0", "3.1", "3.2", "3.3"]
gemfile: [rails_5_2, rails_6_0, rails_6_1, rails_7_0, rails_7_1, rails_edge]
rails:
["~> 5.2.0", "~> 6.0.0", "~> 6.1.0", "~> 7.0.0", "~> 7.1.0", "edge"]
gemfile: [rails_gems]
exclude:
- ruby: "2.6"
gemfile: rails_7_0
rails: "~> 7.0.0"
- ruby: "2.6"
gemfile: rails_7_1
rails: "~> 7.1.0"
- ruby: "2.6"
gemfile: rails_edge
rails: "edge"
- ruby: "2.7"
gemfile: rails_7_1
rails: "~> 7.1.0"
- ruby: "2.7"
gemfile: rails_edge
rails: "edge"
- ruby: "3.0"
gemfile: rails_5_2
rails: "~> 5.2.0"
- ruby: "3.0"
gemfile: rails_7_1
rails: "~> 7.1.0"
- ruby: "3.0"
gemfile: rails_edge
rails: "edge"
- ruby: "3.1"
gemfile: rails_5_2
rails: "~> 5.2.0"
- ruby: "3.1"
gemfile: rails_6_0
rails: "~> 6.0.0"
- ruby: "3.2"
gemfile: rails_5_2
rails: "~> 5.2.0"
- ruby: "3.2"
gemfile: rails_6_0
rails: "~> 6.0.0"
- ruby: "3.2"
gemfile: rails_6_1
rails: "~> 6.1.0"
- ruby: "3.3"
gemfile: rails_5_2
rails: "~> 5.2.0"
- ruby: "3.3"
gemfile: rails_6_0
rails: "~> 6.0.0"
- ruby: "3.3"
gemfile: rails_6_1
rails: "~> 6.1.0"

include:
- ruby: head
gemfile: rails_edge
rails: "edge"
gemfile: rails_gems
env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
RAILS_GEMS_REQUIREMENTS: ${{ matrix.rails }}
steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down
5 changes: 0 additions & 5 deletions gemfiles/rails_5_2.gemfile

This file was deleted.

5 changes: 0 additions & 5 deletions gemfiles/rails_6_0.gemfile

This file was deleted.

11 changes: 0 additions & 11 deletions gemfiles/rails_6_1.gemfile

This file was deleted.

5 changes: 0 additions & 5 deletions gemfiles/rails_7_0.gemfile

This file was deleted.

5 changes: 0 additions & 5 deletions gemfiles/rails_7_1.gemfile

This file was deleted.

3 changes: 2 additions & 1 deletion gemfiles/rails_edge.gemfile → gemfiles/rails_gems.gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

@rails_gems_requirements = { github: "rails/rails", branch: "main" }
@rails_gems_requirements = ENV.fetch("RAILS_GEMS_REQUIREMENTS")
@rails_gems_requirements = { github: "rails/rails", branch: "main" } if @rails_gems_requirements == "edge"

eval_gemfile "../Gemfile"

0 comments on commit cc23bd8

Please sign in to comment.