Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Enable cached builds #2

Merged
merged 7 commits into from
Jun 10, 2024
Merged

CI: Enable cached builds #2

merged 7 commits into from
Jun 10, 2024

Conversation

LeonMatthesKDAB
Copy link
Collaborator

@LeonMatthesKDAB LeonMatthesKDAB commented Jun 6, 2024

We should be able to speed up our CI by caching the build artifacts using sccache like we do in https://github.com/KDAB/cxx-qt/.
My goal is to stick below 10 min. CI build if at all possible.

Part of #3

@LeonMatthesKDAB LeonMatthesKDAB force-pushed the ci-cached-building branch 2 times, most recently from 9aff1e0 to c03d519 Compare June 7, 2024 07:28
@LeonMatthesKDAB LeonMatthesKDAB force-pushed the ci-cached-building branch 5 times, most recently from fd2a691 to 987fd80 Compare June 10, 2024 11:53
@LeonMatthesKDAB LeonMatthesKDAB enabled auto-merge (rebase) June 10, 2024 12:09
We use the embedded debug information for MSVC, because we ran into this error message in our windows CI:
```
FAILED: 3rdparty/fmt/CMakeFiles/fmt.dir/src/os.cc.obj
sccache C:\PROGRA~1\MICROS~2\2022\ENTERP~1\VC\Tools\MSVC\1440~1.338\bin\Hostx64\x64\cl.exe  /nologo /TP -DKNUT_BUILDDATE=\"2024-06-07\" -DKNUT_VERSION=\"1.0\" -DKNUT_VERSION_STRING="\"1.0 (revision: c91adac)\"" -DTEST_DATA_PATH=\"D:/a/knut/knut/test_data\" -ID:\a\knut\knut\build-ci\3rdparty\fmt -ID:\a\knut\knut\3rdparty\fmt -ID:\a\knut\knut\build-ci\3rdparty\fmt\fmt_autogen\include -ID:\a\knut\knut\3rdparty\fmt\include /DWIN32 /D_WINDOWS /GR /EHsc /Zi /O2 /Ob1 /DNDEBUG -std:c++latest -MD /showIncludes /Fo3rdparty\fmt\CMakeFiles\fmt.dir\src\os.cc.obj /Fdfmt.pdb /FS -c D:\a\knut\knut\3rdparty\fmt\src\os.cc
D:\a\knut\knut\3rdparty\fmt\src\os.cc: fatal error C1041: cannot open program database 'D:\a\knut\knut\build-ci\fmt.pdb'; if multiple CL.EXE write to the same .PDB file, please use /FS
```
Obviously /FS won't help, as that's already added.

However, in this issue: https://gitlab.kitware.com/cmake/cmake/-/issues/20222,
@mwestphal suggests that /Zi may be the issue. This makes sense, as
that's what's forcing the use of a separate pdb file for debug info.

If we use the Embedded format, this should fall back to /Z7, which
includes the debug information within the object files themselves.
So there should be no pdb file that can have lock contention.
We can adopt the strategy from CXX-Qt, which is working well.
Hopefully now we get fully cached builds.
This should allow us to update the version information on each commit, but
still cache most of the build.
The single compilation unit for version.cpp won't be cached, but
everything else can be cached, as the compiler arguments won't change on
every commit.
Forks are not allowed to update the cache
@LeonMatthesKDAB LeonMatthesKDAB merged commit 146227a into main Jun 10, 2024
3 checks passed
@LeonMatthesKDAB LeonMatthesKDAB deleted the ci-cached-building branch June 10, 2024 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants