-
Notifications
You must be signed in to change notification settings - Fork 177
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
Add compiler caching support for CI checks #2624
Conversation
This also includes a rewrite of the current CI build script to match the latest recommended instructions for using MSYS2 with Github Actions
Using gcc 12 produces some warnings that make compilation fail
Ok so I think most things are working now for all platforms. The improvements in build times are significant and should considerably improve our build and test cycle. |
This makes it easier to test the workflow locally. https://github.com/msys2/setup-msys2
Ok, so it seems that even fixing the warnings doesn't solve the issue of the binary test failing. @Lestropie @jdtournier could you take a look at why the meshconvert test fails? It's very strange that this is only failing on Windows. |
I can replicate on my Win10 laptop - though I also get failures for |
OK, For |
But why didn't the check fail on the previous Windows CI workflow? |
Ok, having looked into this, I'm starting to think this might be a compiler bug... The offset reported by input stream's |
OK, a bit more context around the test_tellg()
and ran it on the
So the offset is already wrong as soon as we're read the first line... |
Yet more context on this issue... Here's another test cpp file that demonstrates the issue. This time, it writes a few lines of text (with a file open in binary mode), then dumps binary data, with single bytes incrementing in value and wrapping around for a long as requested. test_tellg.cpp
It turns out that things behave as expected as long as the file does not contain the ASCII 26 (substitute) character. Output from code above:
and output of same command with the commented line enabled (i.e. skipping the character with ASCII code 26):
According to Wikipedia, this ASCII 26 character used to mark the end-of-file, so maybe that has something to do with it. But regardless, the problematic character is encountered much later in the file, and yet it affects the file offsets reported way earlier. Feels like there's a glitch somewhere in MSYS2... |
OK, one solution that might work is to always open the file in binary mode, and strip any trailing carriage return |
Hmm that's quite strange. I compiled this MSVC (second example) and get:
so this may be a specific Windows issue. |
So it seems that as per this answer and here, |
Yes, I came across similar information, but this seems worse than that. In that first link, note the answer states:
And this is confirmed on the cppreference page for ftell():
What we get is clearly not re-usable in any sense - it's just plain wrong. But given the situation seems to affect pretty much all implementations on Windows (if I understand that second link correctly), I think the only sensible thing to do is always open all files in binary mode on all platforms, and strip out carriage returns if needed. We already open all output files in binary mode by default, and always write Unix newlines (no |
Can we move the MSYS2 |
8cbb258
to
7d867f3
Compare
This pull request add supports for compiler caching in the CI checks workflow. It uses sccache which is a compiler cache that speeds up recompilation by caching previous compilations by automatically detecting whether the same compilation is already cached. This allows us to leverage the free cache (up to 10GB) provided by Github Actions. At the moment, it only works with Clang/GCC builds on Linux and MacOS.
In our current workflow, all the checks are done by compiling from scratch and for example, a typical CI build with Clang on Linux takes about 35-40 minutes. My preliminary tests show that using sccache we can complete a cached build in about 5-10 minutes.
I've decided to use sccache instead of the more popular ccache because in my experience it has been more reliable on Windows (particularly with MSVC) and because they provide a pre-made Github Action to facilitate integration. However, this is not necessary and we could use ccache if wanted (integrating it should be fairly straightforward).
Any feedback welcome!