PurpleTurtleCreative / website

Official WordPress website of Purple Turtle Creative.
https://purpleturtlecreative.com/
1 stars 0 forks source link

Use caching in GitHub Action #9

Closed MichelleBlanchette closed 8 months ago

MichelleBlanchette commented 1 year ago

Deployments repeatedly install the same dependencies which takes quite a long time. Should be able to use GitHub Actions' caching functionality as described here: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows

And another simple overview described here: https://docs.github.com/en/actions/using-workflows/about-workflows#caching-dependencies

Review the durations of each job step in recent deployments to know which to optimize: https://github.com/PurpleTurtleCreative/website/actions/workflows/deploy.yml

Particularly, cache wp-content/plugins/completionist-pro for its commit SHA since that isn't always updated with every deployment. Sometimes I simply update the theme or update other plugins.

MichelleBlanchette commented 8 months ago

Now that the theme is also getting built, it's taking even longer!

MichelleBlanchette commented 8 months ago

Hmm... I typically do one deployment each month to simply update plugins when I'm not actively working on the theme or our own plugins and the cache action states:

Caches that are not accessed within the last week will also be evicted.

So this might not be helpful in the end, even if I were to successfully implement caching... 🤨

And even when I am working on the theme more actively, I don't really do multiple deployments since my local staging environment is very accurate for testing before I even perform a deployment.

MichelleBlanchette commented 8 months ago

Holy cow, that took the build time from 5m 25s to just 53s when all caches hit! Booyah! I also haven't taken down production in this process, so that's neat, too. 😏🥇

MichelleBlanchette commented 8 months ago

Success!! 🥳

Screenshot 2023-12-31 at 12 39 29 PM