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
Re-organize and optimize GitHub Actions workflow #177
Re-organize and optimize GitHub Actions workflow #177
Conversation
fec2426
to
263450a
Compare
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.
Thanks for doing this @jcfr. A few notes:
- I would use the
ENH
orSTYLE
, as these do not address compiler errors or warnings, and some are clearlySTYLE
changes (e.g. re-ordering the flags, using local variables, etc.). - Can commit body messages be added to all commits, please? And the subject start with capitals in 1b1e625?
- Can this be split into 2 PRs: one for the refactoring of the GHA workflow commits, the other one for commit c636441?
- 1922edb and b6c3871 needd to be reworked, merged or refactored: e.g. a path is added in the first, that is then removed in the second.
- Split things in another way may clarify what is being done: e.g. reordering the flags can go in its own commit, changing the paths can go in its own commit, specifying the CMake variable types in the flags, etc. Otherwise, changes are difficult to review.
- Despite 263450a, and despite your PR to Slicer,
-DSlicer_USE_PYTHONQT
is stillON
. Can this be turned off now? - Why are we removing Ninja? Why do we prefer a second call to
cmake
instead of an explicit call to a specific compiler? If this is in line withstreamline future maintenance (e.g generalization to other operating system)
, that should be clear close to the explanation about removing Ninja. And clearly, that is a separate commit. Also, if at some point we want to useNinja
instead of the default compilerCMake
uses, willcmake
do this, ifGCC
is always present?
Also, part of the 1922edb commit message in here is contradictingIs it- Avoid explicit use build tool by leveraging `cmake --build <build-dir> --config <config>` - Since ninja automatically enables parallelism based on the number of available core, remove the use of `$(nproc)`
cmake
that automatically enables parallelism ?
Also the commit message ends with an unmeaningfulferfer
. - Why do we turn on support for
NumPy
? Previous builds are passing without it. I would first demonstrate (maybe with the Python test commit in the separate PR) that tests do not pass otherwise.
Thanks again JC.
Since most of these changes are related to continuous integration and compilation, I chose
I will do my best to have additional reference.
I was waiting for the CI to complete, since it is time consuming I deliberately decided to wait.
Python is currently a necessary requirement for this extension. This should be addressed on its own.
Ninja generator is still used. We are leveraging the CMake interface to build. This will then allow to choose different generator, support visual studio, etc ... without having to have custom invocation for the build tool.
Ninja automatically automatically enable parallelism. So specifying number of process is not needed here. Instead, we should look into having different for the link and build pool, but that is another topic. See https://discourse.slicer.org/t/ninja-build-using-too-many-cores/2304/2
Good catch. Remaining of recent commit squashing. I will fix it.
Building without running the test and/or using the modules is not sufficient. Disabling NumPy would prevent from running any tests. |
36b4557
to
06d9988
Compare
I believe all comments have been addressed. Thanks for the review. |
A few comments:
|
Specifying the type serves as documentation and also ensures all options are consistently specified. See https://cmake.org/cmake/help/latest/manual/cmake.1.html#options
Sorting options alphabetically allows to deterministically introduce new updates.
Remove the settings of options implicitly enabled or disabled. * Slicer_BUILD_vtkAddon: This option is enabled by default. * Slicer_BUILD_SimpleFilters: This option is implicitly disabled by setting Slicer_USE_SimpleITK to OFF
Simplify how the MultiVolume support is disabled by simply setting Slicer_BUILD_MULTIVOLUME_SUPPORT to OFF. This approach is more robust as it decouple the toggling of the overall capabilies from specific modules.
Adding the empty lines help visually parse the content. This is particularly important because:
|
Simplify the configuration of Qt by removing the need for extra env. variables like QTDIR and QTVER. Leverage instead the QT_ROOT_DIR env. variable implicitly set by the `jurplel/install-qt-action` action.
Refactor the jobs removing the need for global variables by: - consistently setting *_SOURCE_DIR and *_BUILD_DIR variable at the beginning of each job. - setting "Slicer_DIR" as an output of the "Build Slicer" job now identified as "slicer-build" - removing the need for explicitly creating directories and changing directories by using `-B` and `-S` CMake options References: * https://docs.github.com/en/github-ae@latest/actions/learn-github-actions/variables#passing-values-between-steps-and-jobs-in-a-workflow
Avoid explicit use build tool by leveraging `cmake --build <build-dir> --config <config>` Since ninja automatically enables parallelism based on the number of available core, remove the use of `$(nproc)`. > Ninja defaults to running commands in parallel anyway, so typically you don’t > need to pass -j. Source: https://ninja-build.org/manual.html
Do not install Qt Python as it is not used by this project. This allows to speed the worflow by reducing the time spend downloading and installing Qt.
Using `jobs.<job_id>.concurrency` ensures that only a single job or workflow using the same concurrency group will run at a time. This means that after updating a given branch, the on-going build will be cancelled ensuring the available runners are used to build the latest version. See https://docs.github.com/en/actions/using-jobs/using-concurrency Adapted from scikit-build/scikit-build@f0db9f31f (ci: cancel in-progress on repeated pushes)
Switch to using the checkout action optimized for downloading sources in the context of GitHub actions. See https://github.com/actions/checkout#checkout-multiple-repos-side-by-side
06d9988
to
967ce7c
Compare
All comment have been address and dedicated PR will be pushed to include the NumPy updates
Simplify GitHub Actions workflow
The changes below have been implemented to improve consistency, facilitate reuse, and streamline future maintenance (e.g generalization to other operating system)
-D
options alphabetically$QT_ROOT_DIR
env. variable. This remove the hard-coded arch-B
and-S
CMake optionsBOOL
andPATH
)$(nproc)
Along with the following optimizations
.md
files are modified