zinc-collective / convene

An Operating System for the Solidarity Economy
https://convene.zinc.coop
Other
56 stars 19 forks source link

Speed up CI pipeline #1060

Closed KellyAH closed 1 year ago

KellyAH commented 1 year ago

A continuation of https://github.com/zinc-collective/convene/pull/1053

Problem:

The CI pipeline currently runs as 1 job that executes everything sequentially:

  1. builds the app
  2. runs all tests

Fix:

Break up the pipeline so after the app is built, unit, and feature tests run in parallel.

  1. build app
  2. --> run unit tests --> run browser tests

TODO:

zspencer commented 1 year ago

This is looking really good! It looks like the biggest time-savings will be removing homebrew from the CI pipeline; as that is adding 1.5m just to get homebrew installed, and another 4~5m to install the dependencies.

KellyAH commented 1 year ago

This is looking really good! It looks like the biggest time-savings will be removing homebrew from the CI pipeline; as that is adding 1.5m just to get homebrew installed, and another 4~5m to install the dependencies.

I think we need brew for overmind and other dependencies. Else overmind is not installed via bin/setup and rails doesn't start with bin/run. See failing run when brew was removed.

zspencer commented 1 year ago

What if we... didn't use overmind or other brew-based installation bits in CI?

KellyAH commented 1 year ago

I'm blocked on this. Waiting on a dev ops friend to advise me.

zspencer commented 1 year ago

RSpec in < 1m! This is the happiest I've ever been!

anaulin commented 1 year ago

Getting very close. Things seem to be working in parallel, much faster than before (no brew installations), but we still have a couple of smallish thing to cleanup (see checkboxes in PR description).

image

zspencer commented 1 year ago

4m!!! That's soooo fast!

KellyAH commented 1 year ago

Thanks @anaulin and @zspencer for helping this work get unstuck and closer to the finish line 🏁 🐎 . I'll see if I can tackle the DRY tasks this week.

anaulin commented 1 year ago

One thing I'm wondering about is that initial "install and cache dependencies" step: it does a bundle install and a yarn install, and that's it. The two test steps also have to then do bundle install and yarn install, and I don't know if the caches are shared between the different steps.

It might be better to just remove the separate "install" step, and just run the two different test sets in parallel.

Thoughts?

KellyAH commented 1 year ago

One thing I'm wondering about is that initial "install and cache dependencies" step: it does a bundle install and a yarn install, and that's it. The two test steps also have to then do bundle install and yarn install, and I don't know if the caches are shared between the different steps.

It might be better to just remove the separate "install" step, and just run the two different test sets in parallel.

Thoughts?

🤔 What happens if we leave the "bundle install and a yarn install" steps in the setup job and remove them from the 2 parallel test jobs?

🗒️ According to GHA cache doc caching seems to be shared between jobs.

Use caching when you want to reuse files that don't change often between jobs or workflow runs, such as build dependencies from a package management system.

anaulin commented 1 year ago

What happens if we leave the "bundle install and a yarn install" steps in the setup job and remove them from the 2 parallel test jobs?

I removed the yarn install steps from the test-_* jobs, and things still seem to work. I don't think I can remove the bundle install step without removing the "setup ruby" step, but I think that's ok, because it is takes about 5s (since things are cached):

image

zspencer commented 1 year ago

So, is this ready to merge then?! It looks amazing! I want it!!!

anaulin commented 1 year ago

GitHub doesn't support YAML block reuse via anchors just yet: image

So no "services" block reuse for us 🤷🏼‍♀️

anaulin commented 1 year ago

@zspencer i think this is good enough to merge (if we want to do more tightening, we can always do that in follow-up PRs)

KellyAH commented 1 year ago

Thanks so much for taking this over the finish line @anaulin 🏁 🏎️ I ran outta steam at the end and this past week has been packed with family projects. Thanks again! 🙇‍♀️

KellyAH commented 1 year ago

wow the time-saving is amazing. before this change, pipeline took ~7m 47s, now it's 3m 37s. 🌟

zspencer commented 1 year ago

This is the happiest I have ever been!