chkuendig / scummvm-demo

🕹️ ScummVM Web Demo (unofficial)
http://scummvm.kuendig.io/
10 stars 2 forks source link

Add cache action to speed up compilation #7

Closed neuromancer closed 2 years ago

chkuendig commented 2 years ago

I think this is generally a great idea. Since I activated all engines a full build takes more then an hour.

I'm wondering though how this will work with the fact that we cache the full submodule which is often the reason for the update? Would the checkout part of the action require to be rewritten to perform a pull if the folder is cached?

Alternatively we might want to redirect the object files into a separate folder (with OBJDIR or -o, see https://stackoverflow.com/questions/5178125/how-to-place-object-files-in-separate-subdirectory) which is cached

For emsdk and the game/demo files this could be done manually as part of the build. (but that's only a few minutes of the build)

neuromancer commented 2 years ago

I'm wondering though how this will work with the fact that we cache the full submodule which is often the reason for the update? Would the checkout part of the action require to be rewritten to perform a pull if the folder is cached?

Good point. I'm not sure how this interacts with the submodule. I guess we should try it and see if it works..

chkuendig commented 2 years ago

I approved your run, so I assume you can test this by adding commits to the PR?

neuromancer commented 2 years ago

Exactly. I'm finishing my day here, if you feel you want to take care of this sooner than later (perhaps because you saw a better way to do it), feel free to close the PR and open a new one. Otherwise, I will experiment with this tomorrow.

neuromancer commented 2 years ago

As expected, it failed in the deployment since it should only work for your own user. I temporary disabled the deployment so we can test the caching, but this needs manual approvals at each run from your side.

chkuendig commented 2 years ago

Wouldn't you be able to test this on https://github.com/neuromancer/scummvm-demo ? (you can activate github pages + actions on your own repo as well)

neuromancer commented 2 years ago

I just enabled it, let's see what happens.

neuromancer commented 2 years ago

The execution generated a 3GB cache. Let's see if this is faster than re-download and recompile everything..

neuromancer commented 2 years ago

Good news: this is working fine in my repository. It takes around 15 minutes instead of more than one hour. To really test this PR, I recommend to add more commits from scummvm master into the Emscripten PR to make sure the new changes are actually updated.

chkuendig commented 2 years ago

I'll merge this as it looks good. If something breaks we can always fix it later.

chkuendig commented 2 years ago

FYI: This didn't work. None of the changes done in the scummvm repo are updated/pulled in.

neuromancer commented 2 years ago

Uhm according to the CI tests, compilation is taking around 17minutes, which is very fast to recompile everything, however, it could be interfering with the git modules as you said. In my branch, I tried to use ccache, but emscripten requires a special fork of it, so finally I implemented a specific cache manually, take a look to this:

https://github.com/neuromancer/scummvm-demo/blob/main/.github/workflows/main.yml#L48-L65

I'm also rebasing automatically with scummvm master, but that's another topic of discussion.

chkuendig commented 2 years ago

I just noticed that my changes to the branch werent deployed, I assume thats because the cache skips the checkout (and neither performs a pull). I'll reopen https://github.com/chkuendig/scummvm-demo/issues/8.