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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimise CI #12418

Merged
merged 7 commits into from May 6, 2024
Merged

Optimise CI #12418

merged 7 commits into from May 6, 2024

Conversation

dacook
Copy link
Member

@dacook dacook commented Apr 29, 2024

What? Why?

One day the JS installation failed on a model spec, and I wondered why we would install JS anyway?

Today I decided to dive in and tried a few things. Some of them worked 馃帀

I left some history in, in case anyone's interested. Otherwise just review the overall diff.

What should we test?

green specs

Conversely, these tests are JS-only.
But surely we could convert it to a shell or node script. Maybe next time..
It saves the second unnecessary Rails boot-up (multiple seconds).
These tests don't run in the browser, therefore shouldn't need JavaScript at all.
But models can still run without.

Half of the controller runs also succeeded, so we could potentially separate those ones out.
Hmm, yes only 7 of them. It would save 20s, or 16% of controller CI runtimesi which are 2min. let's try..
@dacook dacook added the technical changes only These pull requests do not contain user facing changes and are grouped in release notes label Apr 29, 2024
@dacook dacook self-assigned this Apr 29, 2024
Arrgh it's not so simple.
It looks like both rspec and knapsack use glob for the pattern, so the pattern needs updating. Hmm that might not be too
 bad, but it makes it even less manageable.

Considering the system specs are a much bigger bottleneck, I'm going to avoid spending more time here.
@dacook dacook marked this pull request as ready for review April 30, 2024 00:32
Copy link
Collaborator

@rioug rioug left a comment

Choose a reason for hiding this comment

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

Thanks for adding comments 馃

@rioug rioug merged commit c046d59 into openfoodfoundation:master May 6, 2024
50 checks passed
@dacook
Copy link
Member Author

dacook commented May 6, 2024

I had a quick look at the runtimes before and after and can confirm about 20 seconds faster for model specs, yay!

@dacook
Copy link
Member Author

dacook commented May 6, 2024

Now the model specs are running faster, I think we could use one less runner. Currently:
5 x 2m20s = 11m40

If we use 4, it will still be less than 3m:
11m40 / 4 = 2m55s (if I did my maths right)

All system specs take longer than 3 min, so it's no slower.

We can give the extra runner to system_admin specs, which are the slowest.

But we still have a bottleneck: spec/system/admin/order_spec.rb takes 7m32s, while most others are done in 5min. We need to split that file up.
We should also look at the next largest (with a very similar name) spec/system/admin/orders_spec.rb 5m55s.

So I'll try and look at these this week:

  1. Move one runner from models, to system_admin
  2. Split order_spec.rb
  3. Consider also splitting orders_spec.rb

Oh and can we configure knapsack to use our bin/rspec script? This will use Spring and speed up multi-file system spec runners (currently it re-boots rails for each spec file, costing 20 seconds per additional file).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
technical changes only These pull requests do not contain user facing changes and are grouped in release notes
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants