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 Ruby 3.1 to Circle tests #2129

Merged
merged 2 commits into from
Jan 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
version: 2.1

orbs:
browser-tools: circleci/browser-tools@1.2.3
browser-tools: circleci/browser-tools@1.2.4

commands:
shared_steps:
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
<<: *default_job
steps:
- shared_steps
# Run the tests against the versions of Rails that support Ruby 3
# Run the tests against the versions of Rails that support Ruby 3.0
- run: bundle exec appraisal install
- run: bundle exec appraisal rails60 rspec
- run: bundle exec appraisal rails61 rspec
Expand All @@ -102,10 +102,30 @@ jobs:
POSTGRES_DB: ruby30
POSTGRES_PASSWORD: ""

ruby-31:
<<: *default_job
steps:
- shared_steps
# Run the tests against the versions of Rails that support Ruby 3.1
- run: bundle exec appraisal install
- run: bundle exec appraisal rails61 rspec
docker:
- image: cimg/ruby:3.1-browsers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the browsers image here, or is the standard ruby:3.1 with the orb enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, the browsers variant supplies the dependencies needed for the orb to work:

The browsers variant is designed to work in conjunction with the CircleCI Browser Tools orb. You can use the orb to install a version of Google Chrome and/or Firefox into your build.

https://circleci.com/developer/images/image/cimg/ruby#browsers

But I'll push up a quick test commit just to confirm.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nickcharlton I pushed a commit with cimg/ruby:3.1 and it seems to work just fine. And looking at the 4 test runs of the previous commit vs the 4 test runs of that commit and it doesn't seem to take significantly longer to install chrome or anything like that on cimg/ruby:3.1 afaict. Shall we just go with this? I'm also opening a ticket w/ CircleCI to ask them what the -browsers image is needed for. Do you read that blurb from them differently? I'm not sure why one would need it.

Copy link
Contributor Author

@jordan-brough jordan-brough Jan 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, actually I forgot for a bit that this PR only uses cimg/ruby in the 3.1 tests. And there is a difference of 7s (with -browsers) vs 23s (without `-browsers) for "Install Google Chrome". We could try testing each version a few more times to confirm the speed difference. I've also opened that ticket w/ Circle to confirm.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nickcharlton I went ahead and did some speed testing and it does seem like the difference is probably that some stuff is preinstalled on -browsers, which makes the browser installation faster. However, I'd bet it probably makes the image download longer also.

What I saw:

test run "-browsers"? env spin up (incl download) chrome install total
link yes 30s 9s 39s
link yes 6s 7s 13s
link yes 13s 7s 20s
link no 5s 18s 23s
link no 12s 17s 29s
link no 3s 19s 22s

Lmk what you think and which you prefer. Circle has enough variability in timing that it's hard to really get a firm idea of things 😕

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see. Right, it is intentional on Circle's part. I didn't think to even look at that, so thanks for highlighting it.

I think we should go with what they recommend — it's a pity your table shows how variable the runs are (thanks for doing that!).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 sounds good. I've force-pushed to remove the commit that tried out the non--browsers variant.

environment:
PGHOST: localhost
PGUSER: administrate
RAILS_ENV: test
- image: postgres:10.1-alpine
environment:
POSTGRES_USER: administrate
POSTGRES_DB: ruby31
POSTGRES_PASSWORD: ""

workflows:
version: 2
multiple-rubies:
jobs:
- ruby-31
- ruby-30
- ruby-27
- ruby-26
8 changes: 2 additions & 6 deletions spec/example_app/config/secrets.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
default: &default
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>

development:
<<: *default
secret_key_base: 1a022e4f335d24af3d6bd622b9daef5a44808afbe16d4f1c8bed03675ab91ecd9c76ddc1a30f3fbb668b02c00abcba2ecc3714c95943b8f4af86289a2a46d5e1

test:
secret_key_base: test_secret

staging:
<<: *default
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>

production:
<<: *default
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>