👷 Cache gatsby builds#1075
Conversation
Signed-off-by: Alexandre Franke <alexandre.franke@gmail.com>
|
Looking at the logs I see: ...so it looks like this isn't actually capturing and caching state? |
|
Good catch, will investigate. |
|
… and it seems obvious to me now that the working-directory (and therefore the paths) must be incorrect. 🤦♂️ |
Signed-off-by: Alexandre Franke <alexandre.franke@gmail.com>
|
For your initial run with a cold cache, the Gatsby step took 9m 41s, of which 6m 40s was "Gatsby Build." I re-ran the workflow, and the Gatsby step completed in 2m 55s, of which 50s was "Gatsby Build." This is effectively a no-op, since no content changed from what was already cached. Caching itself seems to take on the order of ~10s to download, ~40s to upload. And the no-op Gatsby run was nearly a minute. So it seems like a lower bound for Gatsby is ~2 minutes, and the workflow itself adds a fixed cost of ~2 minutes on top of that (pulling the Docker image, tarring and uploading artifacts, etc.) So a best case scenario with Gatsby is probably 6 minutes end-to-end, including 2 minutes for the "Packaging" step at the end of the workflow. Switching to Hugo or Zola would make the build step effectively instantaneous, eliminate the need to pull a 500 MB Docker Image shaving off over a minute, and remove the need for caching, saving another minute... so the best case scenario with Hugo is probably ~3 minutes end to end? |
|
Right, halved build times, but also plain markdown files for content which makes editing easier. Migration seems indeed to be the way to go. I can still merge this in the meantime right? |
|
Just to check... let's throw a commit with a page edit into this PR and see how long it takes to rebuild. |
|
(And also double-check that the built artifact is actually identical to the same commit build without a cache. After that, we can revert the edit and merge.) |
Signed-off-by: Alexandre Franke <alexandre.franke@gmail.com>
The gatsby job of the run after I added a commit took 3m 55s (whole workflow took 6m 9s).
None of the gatsby artifacts are identical between before I implement cache, after I add cache, and after I add cache and make an edit. Upon closer inspection, I see the changes are files like I don’t know if those are supposed be “refreshed” like that on each build. Shall we proceed with the merge?
I know it doesn’t have anything to do with the purpose of the MR, but it’s a change I’d reapply afterwards anyway, so does it make sense to just leave it in? |
I'd prefer to keep things separate just for hygiene sake, but I wouldn't block on it |
This reverts commit 8761ebf.
This caches the
.cacheandpublicdirectories, as suggested by the Gatsby documentation (it’s worth noting we are still on 2.24).From running the workflow several times for that commit, I can see that the cache is saved and restored, but I don’t notice a significant performance improvement. I suggest we merge it (assuming I didn’t break anything) and see how it behaves over a series of commits. I reckon worst case is we don’t save anything.