approvals / ApprovalTests.cpp

Native ApprovalTests for C++ on Linux, Mac and Windows
https://approvaltestscpp.readthedocs.io/en/latest/
Apache License 2.0
317 stars 51 forks source link

Try speeding up CI builds #133

Closed claremacrae closed 3 years ago

claremacrae commented 4 years ago

Feedback is painfully slow from our Travis and AppVeyor CI builds now:

claremacrae commented 4 years ago

Travis CI build times.xlsx

This shows that even on Linux, where Boost needs to be downloaded - which takes around 20-25 seconds, the bulk of the elapsed time is on the compile and link stage - suggesting that it's worth trying ccache.

claremacrae commented 4 years ago

Travis: 40 - 45 minutes elapsed time

I misread that - it's saying:

So we aren't having to wait for 43 mins - but even so, it would be nice to have feedback sooner - before we have moved on to other things...

claremacrae commented 4 years ago

Following the Travis instructions for enabling ccache (https://docs.travis-ci.com/user/caching/#ccache-cache):

Effect on Build Timings

Step Total build time Build log
Before enabling ccache 43 min 33 sec #83
First build after enabling ccache 60 min 55 sec #84
Second build after enabling ccache (no code changes) 39 min 33 sec #85

Consequences of ccache - first implementation:

OS Compiler Effect
Ubuntu gcc Better! ccache adds about 10 seconds to build time - but then takes at least 2 minutes off a repeat build - so really well worth it.
Ubuntu clang Worse! ccache adds a few seconds to build time - and then build time is even worse on repeat build - adding about 30 seconds per build
macOS Xcode Massively worse! ccache increases build macOS times from 3-4 minutes to 5-10 minutes for the initial build - and then 2 mins 20 to 8 mins 40 for repeat build
claremacrae commented 4 years ago

Useful links to improve the macOS builds - and maybe clang too:

claremacrae commented 4 years ago

Tool to validate Travis config: https://config.travis-ci.com/explore

claremacrae commented 4 years ago

This may help: https://github.com/argakiig/nano_imgui/blob/7ed76e27fb50732c0b3747c81784b8e4d83dc521/.travis.yml

claremacrae commented 4 years ago

By https://github.com/claremacrae/ApprovalTests.cpp/commit/0b826b252ab00fa4eb923ba737465c6d85f13e34 I have got the total build time down to 22 min 31 sec!

Most repeat builds take between

The outlier is Xcode 8.1.0 on a max)S 10.12 (Sierra) image, which taks 4 min 10 secs'.

Since Apple dropped support for that OS in October 2019, I don't plan to spend any time on improving build times on that configuration, so I'll remove it from the Travis build matrix instead.

claremacrae commented 4 years ago

Current status of Travis builds on the travis_ccache branch of my fork:

Step Elapsed built time Total build time Build log
Before enabling ccache 12 min 12 sec 43 min 33 sec #83
First build after enabling ccache 16 min 16 sec 60 min 55 sec #84
Second build after
enabling ccache
(no code changes)
11 min 09 sec 39 min 33 sec #85
Second build after
using Craig Scott mechanism
to properly enable ccache
in Makefiles, Ninja and XCode
12 min 05 sec 42 min 49 sec #89
Second build after
also stopping home-brew
from updating all packages
7 min 06 sec 22 min 31 sec #90
Second build after
dropping support for
Xcode 8.3 (macOS 11.12 Sierra)
6 min 08 sec 17 min 01 sec #91
Repeat of the above
(so some variability)
6 min 16 sec 18 min 37 sec #93
claremacrae commented 4 years ago

I think the only potential big gain now would be to cache the Boost download between Linux builds - which I would have to do manually, so which would complicate the script somewhat.

There are some hints on how to do that in this change: https://github.com/loot/loot/commit/863939c2c51b6f5a14f264cf71b7809f58b34c8a

claremacrae commented 4 years ago

Commits for this are on a branch on my fork: https://github.com/claremacrae/ApprovalTests.cpp/commits/travis_ccache

claremacrae commented 4 years ago

There are some useful links in this: https://github.com/marketplace/actions/conan-cache

claremacrae commented 4 years ago

Possibly also useful: https://raymii.org/s/articles/Github_Actions_cpp_boost_cmake_speedup.html

claremacrae commented 3 years ago

We deleted Travis builds in e54031bef345a6fb2d696e5a0fff9020d826a699 - and can live with the AppVeyor times for now, so I'm closing this issue.