Optimizing actions

So during the whole setup of my actions, I had no idea there were any limits to overall usage since the documentation only talked about concurrency limits, not total time limits. I got surprise billed since the default billing option is unlimited. While annoying, that’s fine, it was only a few bucks.

My real questions is: what can we do to optimize our build times? I’m definitely going to remove some of the extraneous platforms now that I know about it, however there’s a few things going on that are outside my ability to control:

  1. Windows time is charged double, but it’s by far the longest to compile.

  2. I have to use devenv to build and it has very expensive first time startup costs, line 28-29 is when devenv is invoked, it took 9 minutes just to start.

  1. How can we deal with dependencies on external SDK? I use Vulkan which takes 2 minutes each run to install.

  2. When trying to make any changes to CI, there’s alot of trial and error involved when pushing changes to the yml file. I probably blew 90% of my first months budget just getting things setup.

I think for the short term I’ll collapse seperate builds (debug,release,retail) into a single run so I the vulkan and deven costs don’t hit me too hard, but what can we do about some of these redundant, fixed costs in the long term? Is there any way to iterate on the build config without eating too much time other than disabling everything while iterating?

For 1, you just have to research things that generally help build speed locally.  If you’re building C++/C consider looking into precompiled headers, and/or investigate building with Clang (in my experience the Clang compiler ends up being much faster than MSVC)

For 2, you should try to determine what devenv is doing and where it’s putting artifacts that incur the startup cost, and then modify your workflow to try to cache those locations.  Unfotunately the caching right now is very limited (2 GB per repository, which is easy to blow past for a Windows C++/C build toolchain).  On the other hand if this startup time is orthogonal to your actual project configuration, maybe file an issue here:  https://github.com/actions/virtual-environments suggesting that they pre-run the command on the Windows build host images.  

For 3, follow this issue:  https://github.com/actions/virtual-environments/issues/18  It really seems to me that Vulkan should be part of the default build image.

For 4, you might try looking into the self-hosting functionality.  You could self-host on your own development machine and then do the bulk of the workflow development without incurring any cost, and only switch back to the Github Actions VMs at the end to ensure that it still works or debug any remaining issues.  Unfortunately Github Actions doesn’t really provide any means of reproducing the build environment / installed software that they setup, so that can be a source of bugs trying to run the same workflow between a local machine and the GA VMs.  

3 Likes

Thanks for all the responses.

  1. This was mostly just a comment about msvc being slower but then the time is charged more. Now that I know about the costs I’m going to reduce my matrix to do multiple compiles in one run to reduce setup cost, and not target multiple versions of OSes.

  2. Thanks for the suggession I opened an issues about it there: https://github.com/actions/virtual-environments/issues/128

  3. Thanks again, I followed and updated with my install script as an example

  4. Thats a great idea. Maybe it should be pushed more when introducing people to actions, I didn’t know I could just hook up my own pc for testing.