Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CircleCI with a matrix build #33

Merged
merged 17 commits into from
Jan 5, 2024
109 changes: 109 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
version: 2.1

_references:
ruby_versions: &ruby_versions
ruby-version:
- "3.3.0"
- "3.2.2"
- "3.1.4"
- "3.0.6"
rails_version_prefixess: &rails_version_prefixes
rails-version-prefix:
- "7.1"
- "7.0"
- "6.1"

orbs:
ruby: circleci/[email protected]

jobs:
test:
parameters:
ruby-version:
type: string
rails-version-prefix:
type: string

executor:
name: ruby/default
tag: <<parameters.ruby-version>>
environment:
RAILS_VERSION_PREFIX: <<parameters.rails-version-prefix>>
steps:
- checkout
- ruby/install-deps:
# Have to set this since there's no lockfile
bundler-version: ">2"
# Do not use deployment mode, because we don't have a lockfile
path: "bundle"
# Always install the latest versions available
with-cache: false
- ruby/rspec-test
test-ruby-head:
parameters:
rails-version-prefix:
type: string
docker:
- image: cimg/base:stable
environment:
RAILS_VERSION: <<parameters.rails-version-prefix>>
steps:
- checkout
- ruby/install:
# RVM wants Ruby 2 for some reason to install Ruby head.
# But then it will use 2.7.8 by default in the future;
# we must use `rvm use ruby-head` before every command that matters
version: "2.7.8"
- ruby/install:
version: ruby-head
- restore_cache:
keys:
- v1-{{ arch }}-ruby-head-bundler
- run:
name: Install Ruby dependencies
command: |
rvm use ruby-head
ruby --version
gem install bundler
bundle config set path bundle
bundle update
- save_cache:
key: v1-{{ arch }}-ruby-head-bundler
paths:
- ./bundle
- run:
name: RSpec tests
command: |
rvm use ruby-head
ruby --version
mkdir -p /tmp/test-results/rspec
bundle exec rspec --profile 10 --format RspecJunitFormatter --out /tmp/test-results/rspec/results.xml --format progress
- store_test_results:
path: /tmp/test-results/rspec

workflows:
test:
jobs:
- test:
name: "test-ruby-<<matrix.ruby-version>>-rails-<<matrix.rails-version-prefix>>"
matrix:
parameters:
<<: *ruby_versions
<<: *rails_version_prefixes
test-head:
jobs:
- test:
name: "test-ruby-<<matrix.ruby-version>>-rails-main"
matrix:
parameters:
<<: *ruby_versions
rails-version-prefix:
- main
exclude:
- ruby-version: 3.0.6
rails-version-prefix: main
- test-ruby-head:
name: "test-ruby-head-rails-<<matrix.rails-version-prefix>>"
matrix:
parameters:
<<: *rails_version_prefixes
32 changes: 0 additions & 32 deletions .github/workflows/pr-security.yaml

This file was deleted.

14 changes: 12 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
ruby '3.2.2'

source 'https://rubygems.org'

gemspec

# Lock Rails down in the matrix build, but not by default
rails_version_prefix = ENV.fetch("RAILS_VERSION_PREFIX", nil)
if rails_version_prefix == "main"
gem "activesupport", github: "rails/rails", branch: "main"
gem "activerecord", github: "rails/rails", branch: "main"
gem "railties", github: "rails/rails", branch: "main"
elsif rails_version_prefix
gem "activesupport", "~> #{rails_version_prefix}.0"
gem "activerecord", "~> #{rails_version_prefix}.0"
gem "railties", "~> #{rails_version_prefix}.0"
end
1 change: 1 addition & 0 deletions acts_as_scrubbable.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Gem::Specification.new do |s|
s.add_development_dependency 'pry-byebug' , '~> 3.2'
s.add_development_dependency 'terminal-notifier-guard' , '~> 1.6'
s.add_development_dependency 'activerecord-nulldb-adapter', '~> 1.0'
s.add_development_dependency 'rspec_junit_formatter'

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- spec/*`.split("\n")
Expand Down