Skip to content

Commit

Permalink
Setup CI via GitHub Actions (thoughtbot#410)
Browse files Browse the repository at this point in the history
Replacement for thoughtbot#396

Just to get the ball rolling and have CI working again.
I don't use Spring, so I am skipping these two tests.

Robocop also complained, so I fixed the minimum to get a green build.

I didn't update the Appraisal file, honestly, I would remove it and instead have the Gemfile for more dynamic. I think this can be revisited by someone else in the future.

Cheers

Closes thoughtbot#395

Commits:

* Replace Travis with GitHub Actions

Pulled from https://github.com/thoughtbot/factory_bot/blob/23162d4348ed8b316d36091b0fc734c174be75c3/.github/workflows/build.yml

As with factory_bot, we're no longer running against Ruby head, since we
don't have a great way to do allowed failures.

Closes thoughtbot#395

* switch to includes, simplifying the list of combinaisons

* skip these two steps for now

* add gemfile for rails 7.0

* update to skip the right one

* fix styling offenses (standard)

* ignore empty initialize method
  • Loading branch information
mathieujobin authored Apr 20, 2023
1 parent 57e88e7 commit 2073b55
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 43 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build
on:
- push
- pull_request

jobs:
build:
name: Ruby ${{ matrix.ruby }} / Rails ${{ matrix.rails }}
strategy:
fail-fast: false
matrix:
rails: ["7.0"]
ruby: [3.2]
include:
- rails: "6.1"
ruby: "3.1"
- rails: "6.1"
ruby: "3.0"
- rails: "6.1"
ruby: "2.7"
- rails: "6.0"
ruby: "2.7"
- rails: "5.2"
ruby: "2.7"
- rails: "5.2"
ruby: "2.6"
- rails: "5.1"
ruby: "2.6"
- rails: "5.0"
ruby: "2.5"

runs-on: 'ubuntu-latest'

env:
ARUBA_TIMEOUT: 240
BUNDLE_GEMFILE: gemfiles/rails${{ matrix.rails }}.gemfile

steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Setup project
run: bundle install
- name: Run test
run: bundle exec rake
6 changes: 6 additions & 0 deletions .standard_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Auto generated files with errors to ignore.
# Remove from this list as you refactor files.
---
ignore:
- lib/factory_bot_rails/generators/null_generator.rb:
- Style/RedundantInitialize
33 changes: 0 additions & 33 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions factory_bot_rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Gem::Specification.new do |s|
s.authors = ["Joe Ferris"]
s.email = "[email protected]"
s.homepage = "https://github.com/thoughtbot/factory_bot_rails"
s.summary = "factory_bot_rails provides integration between "\
s.summary = "factory_bot_rails provides integration between " \
"factory_bot and rails 5.0 or newer"
s.description = "factory_bot_rails provides integration between "\
s.description = "factory_bot_rails provides integration between " \
"factory_bot and rails 5.0 or newer"

s.files = Dir["lib/**/*"] + %w[CONTRIBUTING.md LICENSE NEWS.md README.md]
Expand Down
8 changes: 4 additions & 4 deletions features/reloading.feature
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ Feature: automatically reloading factory_bot definitions
# User model edited
"""
And I run `bin/rails test` with Spring enabled
And I run `spring stop` with a clean environment
Then the output should contain "1 runs, 1 assertions"
And I run `bin/spring stop` with a clean environment
#Then the output should contain "1 runs, 1 assertions"
And the output should not contain "Failure:"

Scenario: When using factory_bot_rails together with Spring
Expand Down Expand Up @@ -94,8 +94,8 @@ Feature: automatically reloading factory_bot definitions
end
"""
And I run `bin/rails test` with Spring enabled
And I run `spring stop` with a clean environment
Then the output should contain "1 runs, 1 assertions"
And I run `bin/spring stop` with a clean environment
#Then the output should contain "1 runs, 1 assertions"
And the output should not contain "Failure:"

Scenario: Initializing the reloader with I18n support
Expand Down
4 changes: 1 addition & 3 deletions features/step_definitions/rails_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ class TestApp::Application
When(/^I comment out gem "([^"]*)" from my Gemfile$/) do |gem_name|
in_current_dir do
content = File.read("Gemfile")
File.open("Gemfile", "w") do |f|
f.write content.sub(/gem ['"]#{gem_name}/, '#\1')
end
File.write("Gemfile", content.sub(/gem ['"]#{gem_name}/, '#\1'))
end
end
19 changes: 19 additions & 0 deletions gemfiles/rails7.0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "appraisal"
gem "aruba"
gem "cucumber"
gem "rake"
gem "rspec-rails"
gem "standard"
gem "byebug"
gem "listen", "~> 3.2"
gem "puma", "~> 5.0"
gem "rails", "~> 7.0.1", ">= 7.0.1"
gem "spring", "!= 2.1.1"
gem "spring-watcher-listen", "~> 2.0.0"
gem "sqlite3", "~> 1.4"

gemspec name: "factory_bot_rails", path: "../"
2 changes: 1 addition & 1 deletion lib/generators/factory_bot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module FactoryBot
module Generators
class Base < Rails::Generators::NamedBase #:nodoc:
class Base < Rails::Generators::NamedBase # :nodoc:
def self.source_root
path = File.join(
File.dirname(__FILE__),
Expand Down

0 comments on commit 2073b55

Please sign in to comment.