-
Notifications
You must be signed in to change notification settings - Fork 91
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: make test build more robust #213
Conversation
If we try to cross-build scx on builders with older versions of system's linux headers (such as those provided by linux-libc-headers in older releases of Ubuntu), we may hit build failures, due to the different kernel ABI, such as: error: invalid use of undefined type ‘struct btf_enum64’ To address this, introduce a new build option called "kernel_headers" that allows to specify a custom path for the kernel headers required during the build process. Signed-off-by: Andrea Righi <[email protected]>
Signed-off-by: Andrea Righi <[email protected]>
Signed-off-by: Andrea Righi <[email protected]>
During the build meson attempts to distribute the workload of multiple sub-projects across all available CPUs and parallelize each build within those projects, resulting in an NxN task generation. This process could potentially overload the CI systems, leading to potential failures (see for example issue #202). To mitigate this, always use --jobs=1 during the CI run, which serializes the build of sub-projects and restricts the level of parallelization to N. Signed-off-by: Andrea Righi <[email protected]>
- run: meson setup build -Dkernel=$(pwd)/linux | ||
- run: meson compile -C build | ||
- run: meson setup build -Dkernel=$(pwd)/linux -Dkernel_headers=./linux/usr/include | ||
- run: meson compile -C build --jobs=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just out of curiosity, why do we want to avoid overloading the system during a CI run given that all it's doing is building + testing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the moment this is not critical, but in the future, if we add more Rust components, they'll be all built in parallel by meson in a N^2 way (where N is the amount of CPUs), so there's the risk that at some point we may hit OOM conditions.
The issue is that meson will try to parallelize the sub-projects spawning N tasks, each task will run cargo that is not aware of meson, so it'll also try to spawn N tasks, causing a massive NxN parallel build workload... serializing each cargo run would still build the Rust components in parallel, but limited to N tasks.
Always use custom linux headers to prevent potential build failures and also use
--jobs=1
during the build to prevent overloading the system during the CI run.