www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Caching dependencies on GitHub Actions CI

Hello everyone,

I have made a GitHub action which caches the output of `dub 
upgrade` and build results, meaning it will cache and restore 
both ~/.dub and **/.dub across builds.

Using dub's native caching mechanism which checks for 
outdatedness with compiler and compilation options makes this an 
excellent option to speed up CI build times.

Additionally this action checks the output of the `dub upgrade` 
command to see if it failed due to a network failure or due to 
some other reason. In case of a network failure it will retry up 
to 3 times so the registry may randomly be unavailable in an 
upgrade. In serve-d this has made `dub upgrade` never fail in the 
commits since I introduced that 3x run with falloff.

The action can be found here:

https://github.com/WebFreak001/dub-upgrade
https://github.com/marketplace/actions/dub-upgrade

and can be added like so: (simple example without executable 
caching)

steps:
   - uses: actions/checkout v1


Dub
     with:
       compiler: dmd-latest

   - uses: WebFreak001/dub-upgrade v0.1


dependencies
     run: dub test


Executable caching means running another cache-only action at the 
end of your workflow which caches all the temporary output 
binaries. This will make dub skip compilation of the dependencies 
on the next run saying they are up-to-date. How to do this is 
described in the README.

This action is currently beta software (I just made it from start 
to finish in the past 80 minutes and I noticed quite a few typos 
in the release changelogs so there might as well be quite a few 
typos in the code) but if it runs well I will release it as 
stable soon enough.
Jul 31 2020