From 3adbff481b90e7c8398752e6c3489ed5b12f91c9 Mon Sep 17 00:00:00 2001 From: Abdessattar Sassi <457645+abdes@users.noreply.github.com> Date: Sat, 8 Apr 2023 10:33:39 +0400 Subject: [PATCH 01/26] docs: configure project folders for esbonio extension --- .vscode/settings.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 4783ab0..ae39248 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,6 @@ { - "esbonio.sphinx.confDir": "doc", + "esbonio.sphinx.confDir": "${workspaceFolder}/doc", + "esbonio.sphinx.buildDir": "${workspaceFolder}/out/html", "editor.rulers": [ 80, 100 @@ -292,4 +293,4 @@ "files.exclude": { "**/.sphinx": true }, -} +} \ No newline at end of file From a78e49a78c868473a724d0357eeaee37a5a75201 Mon Sep 17 00:00:00 2001 From: Abdessattar Sassi <457645+abdes@users.noreply.github.com> Date: Sat, 8 Apr 2023 10:34:09 +0400 Subject: [PATCH 02/26] docs: update sphinx theme option to new name --- doc/conf.py.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/conf.py.in b/doc/conf.py.in index 587d3b1..ed5fc54 100644 --- a/doc/conf.py.in +++ b/doc/conf.py.in @@ -115,7 +115,7 @@ html_theme_options = { "use_fullscreen_button": True, # We don't want the default navigation bar footer to be displayed on every # page. Mention of the book theme will be added in the home page. - "extra_navbar": "" + "extra_footer": "" } # -- Extension configuration ------------------------------------------------- From 8b4dd1739bfbfe057437bd3e96b5b29adf98fd1a Mon Sep 17 00:00:00 2001 From: Abdessattar Sassi <457645+abdes@users.noreply.github.com> Date: Sat, 8 Apr 2023 10:34:49 +0400 Subject: [PATCH 03/26] docs: update url for executable books logo --- doc/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/index.rst b/doc/index.rst index b4ac5fe..04b5ec0 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -74,7 +74,7 @@ use the project artifacts.* Acknowledgements ================ -.. figure:: https://executablebooks.org/en/latest/_static/logo-wide.png +.. figure:: https://executablebooks.org/en/latest/_static/logo-wide.svg :figclass: margin :alt: Executable Books Project :name: executable_book_logo From b25f5fb4005133767f3079ceb097879f26b278db Mon Sep 17 00:00:00 2001 From: Abdessattar Sassi <457645+abdes@users.noreply.github.com> Date: Sat, 8 Apr 2023 10:35:31 +0400 Subject: [PATCH 04/26] chore: update cmake common to latest --- cmake/common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/common b/cmake/common index 6376d60..d7a20ec 160000 --- a/cmake/common +++ b/cmake/common @@ -1 +1 @@ -Subproject commit 6376d60940d252b7e303bf01486e88d839bb03b5 +Subproject commit d7a20ec514ef83525d734d8ee39e03c712adbedc From b333b3858c204fa2151171f0ac494853089ffa37 Mon Sep 17 00:00:00 2001 From: Abdessattar Sassi <457645+abdes@users.noreply.github.com> Date: Sun, 9 Apr 2023 16:19:38 +0400 Subject: [PATCH 05/26] feat: upgrade CPM to 0.38.1 --- cmake/CPM.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/CPM.cmake b/cmake/CPM.cmake index 8302129..659e6e3 100644 --- a/cmake/CPM.cmake +++ b/cmake/CPM.cmake @@ -7,8 +7,8 @@ # Do this only once for the project by checking if we already have loaded CPM # which will define the CURRENT_CPM_VERSION, and if that version is what we want # to have here. -if(NOT CURRENT_CPM_VERSION VERSION_EQUAL 0.35.6) - set(CPM_DOWNLOAD_VERSION 0.35.6) +if(NOT CURRENT_CPM_VERSION VERSION_EQUAL 0.38.1) + set(CPM_DOWNLOAD_VERSION 0.38.1) if(CPM_SOURCE_CACHE) # Expand relative path. This is important if the provided path contains a From 60efa5b6517a331998a884926fcbf3b076b9d2e0 Mon Sep 17 00:00:00 2001 From: Abdessattar Sassi <457645+abdes@users.noreply.github.com> Date: Mon, 17 Apr 2023 12:21:15 +0400 Subject: [PATCH 06/26] style: reformat with cmake-format --- cmake/CompileOptions.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/CompileOptions.cmake b/cmake/CompileOptions.cmake index 0f5e8bd..da1138b 100644 --- a/cmake/CompileOptions.cmake +++ b/cmake/CompileOptions.cmake @@ -57,8 +57,8 @@ function(asap_set_compile_options) if(NOT x_WARNING) target_compile_options(${target} PRIVATE /WX) endif() - # Enable coverage profiling in Debug builds - # (see https://github.com/abdes/asap/issues/22) + # Enable coverage profiling in Debug builds (see + # https://github.com/abdes/asap/issues/22) target_link_options(${target} PRIVATE $<$:/PROFILE>) endforeach() endif() From 9f906fd88181bcb75132fc4a6f8127538a58f22a Mon Sep 17 00:00:00 2001 From: Abdessattar Sassi <457645+abdes@users.noreply.github.com> Date: Mon, 17 Apr 2023 14:20:15 +0400 Subject: [PATCH 07/26] feat: custom index.html should be optional in project doc root There are two possible documentation structure design: - submodules included inside the root doc folder (preferred) - submodules in their own doc folder and a separate sphinx target The custom index.html is really useful only in the second situation. Therefore it is now copied to the output dir only if it is present in the source dir. --- cmake/SphinxGeneration.cmake | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/cmake/SphinxGeneration.cmake b/cmake/SphinxGeneration.cmake index b0388c4..41fb2a4 100644 --- a/cmake/SphinxGeneration.cmake +++ b/cmake/SphinxGeneration.cmake @@ -90,27 +90,26 @@ if(SPHINX_FOUND) # invoked. set_target_properties(sphinx PROPERTIES EXCLUDE_FROM_ALL TRUE) - # Add a target for copying the index.html from the doc dir to the sphinx - # build dir. A dependency on this target will be added to the master sphinx - # target. - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sphinx/index.html - COMMAND - ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/doc/index.html - ${CMAKE_CURRENT_BINARY_DIR}/sphinx/index.html - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/doc/index.html) - add_custom_target(copy_doc_index ALL - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/sphinx/index.html) - # Setup sphinx doc master target and add other submodules as dependencies function(_add_master_sphinx_target) _master_sphinx_target() asap_with_sphinx(${master_sphinx_target}) - add_dependencies( - ${master_sphinx_target}_sphinx copy_doc_index - # Add more submodule documentation targets after this, using variables - # in the target names consistently with the module's CMakeLists.txt. - ) + + set(index_file_src "${CMAKE_CURRENT_SOURCE_DIR}/doc/index.html") + set(index_file_out "${CMAKE_CURRENT_BINARY_DIR}/sphinx/index.html") + if(EXISTS ${index_file_src}) + message( + STATUS "Will use project custom doc index file: ${index_file_src}") + # Add a target for copying the index.html from the doc dir to the sphinx + # build dir. A dependency on this target will be added to the master + # sphinx target. + add_custom_command( + OUTPUT ${index_file_out} + COMMAND ${CMAKE_COMMAND} -E copy ${index_file_src} ${index_file_out} + DEPENDS ${index_file_src}) + add_custom_target(copy_doc_index ALL DEPENDS ${index_file_out}) + add_dependencies(${master_sphinx_target}_sphinx copy_doc_index) + endif() add_dependencies(sphinx ${master_sphinx_target}_sphinx) endfunction() _add_master_sphinx_target() From 53e34e2f65f283f60f782b534701a6552db5b7fd Mon Sep 17 00:00:00 2001 From: Abdessattar Sassi <457645+abdes@users.noreply.github.com> Date: Mon, 17 Apr 2023 16:28:12 +0400 Subject: [PATCH 08/26] docs: there are no library modules anymore --- doc/index.rst | 10 ---------- doc/library-modules/index.rst | 35 ----------------------------------- 2 files changed, 45 deletions(-) delete mode 100644 doc/library-modules/index.rst diff --git a/doc/index.rst b/doc/index.rst index 04b5ec0..3ebe466 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -22,7 +22,6 @@ Last Updated on |date| getting-started/index project-development/index documentation/index - library-modules/index tools/index license changelog.md @@ -41,29 +40,20 @@ Parts of the documentation :doc:`Getting Started! ` ----------------------------------------------- - *start here to understand how to use this project as a starter for your own project* :doc:`Project Development ` ------------------------------------------------------ - *refer to this part of the documentation to understand the build system specifics for this project, the development workflow, coding and unit testing guidelines* :doc:`Documentation ` ------------------------------------------ - *refer to this part of the documentation to understand how project documentation is structured and built from source using `doxygen` and `sphinx`.* -:doc:`Library Modules ` ----------------------------------------------- -*check this out to explore the different modules part of this project. From -there, you can also jump to the detailed API documentation of each of those -modules.* - :doc:`Project Tools ` ---------------------------------- *get an introduction to the programs and scripts under the `tools` folder, diff --git a/doc/library-modules/index.rst b/doc/library-modules/index.rst deleted file mode 100644 index 6a11656..0000000 --- a/doc/library-modules/index.rst +++ /dev/null @@ -1,35 +0,0 @@ -.. Structure conventions - # with overline, for parts - * with overline, for chapters - = for sections - - for subsections - ^ for sub-subsections - " for paragraphs - -############### -Library Modules -############### - -.. |date| date:: - -Last Updated on |date| - -.. toctree:: - :maxdepth: 2 - :titlesonly: - :hidden: - -.. - Add modules below, for example: - - Module: common - Module: contract - - The `asap` projects comes with two built-in modules, offering some core basic - functionality: - - :doc:`common ` - ============================ - *offers some core and low level features such as platform/environment - detection and C++ language features not consistently provided by all - compilers on all platforms.* From d2c0fe46942871b47e758dc9f5bfe7a73412bc6e Mon Sep 17 00:00:00 2001 From: Abdessattar Sassi <457645+abdes@users.noreply.github.com> Date: Mon, 17 Apr 2023 16:29:02 +0400 Subject: [PATCH 09/26] docs: update for in-module or in-root sphinx docs --- doc/project-development/modules.rst | 82 +++++++++++++---------------- 1 file changed, 37 insertions(+), 45 deletions(-) diff --git a/doc/project-development/modules.rst b/doc/project-development/modules.rst index 71d0fd5..4282b09 100644 --- a/doc/project-development/modules.rst +++ b/doc/project-development/modules.rst @@ -206,48 +206,40 @@ Adding documentation to a module Documentation comes in two forms: `doxygen` API documentation and `sphinx` documentation. The former is embedded in the source code files, while the latter is written in its own separate files placed in a ```doc``` subdirectory under -the module root. - -1. The contents of the `doc` directory can be started by copying some of the - files from another existing module. In particular, the ```conf.py.in``` file, - can be copied from an existing module and used without modification. - - The module's `CMakeLists.txt` should then be modified to add the targets for - `doxygen` and `sphinx` documentation build as appropriate. - - .. code-block:: CMake - - # -------------------------------------------- - # API Documentation - # -------------------------------------------- - - asap_with_doxygen( - MODULE_NAME - ${MODULE_TARGET_NAME} - VERSION - ${META_MODULE_VERSION} - TITLE - "\"MyApp Module\"" - BRIEF - "\"Provides some stuff for MyApp.\"" - INPUT_PATH - "${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/include") - - asap_with_sphinx(${MODULE_TARGET_NAME}) - -2. Add target dependencies from the master sphinx documentation target to the - module's sphinx documentation target. This step is only required if you have - added a module sphinx documentation target. - - .. code-block:: CMake - - add_dependencies(master_sphinx - copy_doc_index - # Hardcode `asap` in the module name as we do not want this prefix to - # change with the forked project name. - asap_common_sphinx - asap_logging_sphinx - # Add more submodule documentation targets after this, using variables - # in the target names consistently with the module's CMakeLists.txt. - myapp - ) +the module root or in a sub-directory under the root ```doc``` directory. + +The module's `CMakeLists.txt` should be modified to add the targets for +`doxygen` as appropriate. .. code-block:: CMake + +.. code-block:: CMake + + asap_with_doxygen( + MODULE_NAME + ${MODULE_TARGET_NAME} + VERSION + ${META_MODULE_VERSION} + TITLE + "\"MyApp Module\"" + BRIEF + "\"Provides some stuff for MyApp.\"" + INPUT_PATH + "${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/include") + +For sphinx documentation, the recommended approach is to have all documentation +reside within the root ```doc``` directory in order to be able to have one +single configuration file and most importantly in order to make most IDEs happy +and generate previews. + +The contents of the `doc` directory can be started by copying some of the files +from another existing module. In particular, the ```conf.py.in``` file, can be +copied from an existing module and used without modification. + +If the module documentation is preferred to be inside the module itself, then a +separate sphinx project is required. The module's `CMakeLists.txt` should then +be modified to add the targets for `doxygen` and `sphinx` documentation build as +appropriate. The module's `CMakeLists.txt` should then be modified to add the targets for +`sphinx` as appropriate. + +.. code-block:: CMake + + asap_with_sphinx(${MODULE_TARGET_NAME}) From 9bfdd7e686c07e96aaf236b182f475693502e784 Mon Sep 17 00:00:00 2001 From: Abdessattar Sassi <457645+abdes@users.noreply.github.com> Date: Wed, 19 Apr 2023 16:06:09 +0400 Subject: [PATCH 10/26] chore: update example intersphinx mapping with working links --- doc/conf.py.in | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/doc/conf.py.in b/doc/conf.py.in index ed5fc54..b60454e 100644 --- a/doc/conf.py.in +++ b/doc/conf.py.in @@ -125,11 +125,8 @@ html_theme_options = { intersphinx_mapping = { # Add intersphinx config for submodules and third party libs # 'common': ( - # 'https://abdes.github.io/asap/asap_common/html', - # '@SPHINX_BUILD_DIR@/asap_common/html/objects.inv'), - # 'contract': ( - # 'https://abdes.github.io/asap/asap_contract/html', - # '@SPHINX_BUILD_DIR@/asap_contract/html/objects.inv'), + # 'https://asap-projects.github.io/asap-common/asap_common/html', + # 'https://asap-projects.github.io/asap-common/asap_common/html/objects.inv'), } # -- Options for todo extension ---------------------------------------------- From 1d15b95a0c29877dedcd5854b422a10f614559c2 Mon Sep 17 00:00:00 2001 From: Abdessattar Sassi <457645+abdes@users.noreply.github.com> Date: Wed, 19 Apr 2023 16:07:31 +0400 Subject: [PATCH 11/26] chore: add example of how to setup breathe --- doc/conf.py.in | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/conf.py.in b/doc/conf.py.in index b60454e..f81f445 100644 --- a/doc/conf.py.in +++ b/doc/conf.py.in @@ -48,9 +48,16 @@ extensions = [ 'sphinx.ext.viewcode', 'sphinx-prompt', 'sphinx_copybutton', - 'myst_parser' + 'myst_parser', + 'breathe' ] +# Setup the breathe extension +# breathe_projects = { +# "xxxxxx": "@DOXYGEN_BUILD_DIR@/asap_xxxxxx/xml" +# } +# breathe_default_project = "xxxxxx" + # Tell sphinx what the primary language being documented is. primary_domain = 'cpp' From f507b696ad3bc200bd359af7561f1a9a89d5ad85 Mon Sep 17 00:00:00 2001 From: Abdessattar Sassi <457645+abdes@users.noreply.github.com> Date: Thu, 20 Apr 2023 23:33:49 +0400 Subject: [PATCH 12/26] test: add "Misc" category to the test name for version-info --- tools/version-info/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/version-info/CMakeLists.txt b/tools/version-info/CMakeLists.txt index d30acf2..65ea72f 100644 --- a/tools/version-info/CMakeLists.txt +++ b/tools/version-info/CMakeLists.txt @@ -62,7 +62,7 @@ target_include_directories( if(ASAP_BUILD_TESTS) add_test( - NAME version-info + NAME "Misc:version-info" COMMAND ${MODULE_TARGET_NAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) endif() From 8d415b494f8df9474ec2c531350bea589243751f Mon Sep 17 00:00:00 2001 From: Abdessattar Sassi <457645+abdes@users.noreply.github.com> Date: Thu, 20 Apr 2023 23:35:56 +0400 Subject: [PATCH 13/26] chore: update cmake/common sub-module --- cmake/common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/common b/cmake/common index d7a20ec..d165dd7 160000 --- a/cmake/common +++ b/cmake/common @@ -1 +1 @@ -Subproject commit d7a20ec514ef83525d734d8ee39e03c712adbedc +Subproject commit d165dd7c259d40d08805a0e0bdda6ee04c7a54ff From 2990690503636cd1e4493a41e687950484cae138 Mon Sep 17 00:00:00 2001 From: Abdessattar Sassi <457645+abdes@users.noreply.github.com> Date: Fri, 21 Apr 2023 13:22:49 +0400 Subject: [PATCH 14/26] test: always run the version-info tool as part of ctest suite --- tools/version-info/CMakeLists.txt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tools/version-info/CMakeLists.txt b/tools/version-info/CMakeLists.txt index 65ea72f..fc06ab3 100644 --- a/tools/version-info/CMakeLists.txt +++ b/tools/version-info/CMakeLists.txt @@ -60,12 +60,11 @@ target_include_directories( # Run executable test # ------------------------------------------------------------------------------ -if(ASAP_BUILD_TESTS) - add_test( - NAME "Misc:version-info" - COMMAND ${MODULE_TARGET_NAME} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) -endif() +# Always run the version-info as part of ctest suite +add_test( + NAME "Misc: version-info" + COMMAND ${MODULE_TARGET_NAME} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) # ============================================================================== # Deployment instructions From b70e7789facc2ff4e71561813a19fa6ef90e9e25 Mon Sep 17 00:00:00 2001 From: Abdessattar Sassi <457645+abdes@users.noreply.github.com> Date: Fri, 21 Apr 2023 21:03:23 +0400 Subject: [PATCH 15/26] chore: more precise description of options --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4804533..506cf07 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,8 +81,8 @@ asap_push_project(${META_PROJECT_NAME}) # Project options # cmake-format: off option(BUILD_SHARED_LIBS "Build shared instead of static libraries." ON) -option(ASAP_BUILD_TESTS "Build tests." OFF) -option(ASAP_BUILD_EXAMPLES "Build examples." OFF) +option(ASAP_BUILD_TESTS "Setup target to build and run tests." OFF) +option(ASAP_BUILD_DOCS "Setup target to build the doxygen and sphinx docs." ON) option(ASAP_WITH_GOOGLE_ASAN "Instrument code with address sanitizer" OFF) option(ASAP_WITH_GOOGLE_UBSAN "Instrument code with undefined behavior sanitizer" OFF) option(ASAP_WITH_GOOGLE_TSAN "Instrument code with thread sanitizer" OFF) From 4c5ef88ab79bd1ad50b68e1cc2a41fc16ce73613 Mon Sep 17 00:00:00 2001 From: Abdessattar Sassi <457645+abdes@users.noreply.github.com> Date: Fri, 21 Apr 2023 21:04:53 +0400 Subject: [PATCH 16/26] fix: always include CTest even when ASAP_BUILD_TESTS is OFF This is to allow running the non-unit tests (Misc, etc...) --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 506cf07..709162a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -158,6 +158,8 @@ include(SphinxGeneration) # Testing # ------------------------------------------------------------------------------ +include(CTest) + if(ASAP_BUILD_TESTS) include(GoogleSanitizers) include(CodeCoverage) @@ -177,7 +179,6 @@ if(ASAP_BUILD_TESTS) "INSTALL_GTEST OFF") include(GoogleTest) - include(CTest) endif() # ------------------------------------------------------------------------------ From 481c24087a23ad551e3ccccd260fa4896c963c2c Mon Sep 17 00:00:00 2001 From: Abdessattar Sassi <457645+abdes@users.noreply.github.com> Date: Fri, 21 Apr 2023 21:06:20 +0400 Subject: [PATCH 17/26] feat: add build option to enable or disable docs targets New option: ASAP_BUILD_DOCS. When ON, doxygen and sphinx targets will be added and the detection of the required tools is done. --- CMakeLists.txt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 709162a..e54a456 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,6 +82,7 @@ asap_push_project(${META_PROJECT_NAME}) # cmake-format: off option(BUILD_SHARED_LIBS "Build shared instead of static libraries." ON) option(ASAP_BUILD_TESTS "Setup target to build and run tests." OFF) +option(ASAP_BUILD_EXAMPLES "Setup target to build the examples." OFF) option(ASAP_BUILD_DOCS "Setup target to build the doxygen and sphinx docs." ON) option(ASAP_WITH_GOOGLE_ASAN "Instrument code with address sanitizer" OFF) option(ASAP_WITH_GOOGLE_UBSAN "Instrument code with undefined behavior sanitizer" OFF) @@ -146,13 +147,15 @@ configure_file(.clangd.in ${CMAKE_SOURCE_DIR}/.clangd @ONLY) # Documentation - doxygen, sphinx/breathe/exhale # ------------------------------------------------------------------------------ -# Doxygen -set(DOXYGEN_BUILD_DIR "${CMAKE_BINARY_DIR}/dox") -include(DoxGeneration) +if (ASAP_BUILD_DOCS) + # Doxygen + set(DOXYGEN_BUILD_DIR "${CMAKE_BINARY_DIR}/dox") + include(DoxGeneration) -# Sphinx/breathe/exhale -set(SPHINX_BUILD_DIR "${CMAKE_BINARY_DIR}/sphinx") -include(SphinxGeneration) + # Sphinx/breathe/exhale + set(SPHINX_BUILD_DIR "${CMAKE_BINARY_DIR}/sphinx") + include(SphinxGeneration) +endif() # ------------------------------------------------------------------------------ # Testing From 4a740913d2ac44a4cf62f8304f1d380e55d64000 Mon Sep 17 00:00:00 2001 From: Abdessattar Sassi <457645+abdes@users.noreply.github.com> Date: Fri, 21 Apr 2023 21:06:56 +0400 Subject: [PATCH 18/26] chore: don't use special characters in test names --- tools/version-info/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/version-info/CMakeLists.txt b/tools/version-info/CMakeLists.txt index fc06ab3..f84feb2 100644 --- a/tools/version-info/CMakeLists.txt +++ b/tools/version-info/CMakeLists.txt @@ -62,7 +62,7 @@ target_include_directories( # Always run the version-info as part of ctest suite add_test( - NAME "Misc: version-info" + NAME "Misc:version-info" COMMAND ${MODULE_TARGET_NAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) From 27fce464c0664d160a519908898cc71d6ba95980 Mon Sep 17 00:00:00 2001 From: Abdessattar Sassi <457645+abdes@users.noreply.github.com> Date: Fri, 21 Apr 2023 21:07:43 +0400 Subject: [PATCH 19/26] feat: comprehensive ubuntu builds for CI --- .github/workflows/ubuntu-builds.yml | 198 ++++++++++++++++++++++++++++ 1 file changed, 198 insertions(+) create mode 100644 .github/workflows/ubuntu-builds.yml diff --git a/.github/workflows/ubuntu-builds.yml b/.github/workflows/ubuntu-builds.yml new file mode 100644 index 0000000..68de447 --- /dev/null +++ b/.github/workflows/ubuntu-builds.yml @@ -0,0 +1,198 @@ +name: ubuntu-builds + +on: [push, pull_request] + +env: + CMAKE_VERSION: 3.21.1 + NINJA_VERSION: 1.11.1 + CCACHE_VERSION: 4.8 + CC: '' + CXX: '' + GCC_VERSION: '' + CLANG_VERSION: '' + +jobs: + dev-build: + runs-on: ubuntu-22.04 + strategy: + matrix: + compiler: [gcc-10, gcc-11, gcc-12, clang-14, clang-15, clang-16] + build_type: [Debug, Release] + include: + - build_type: Debug + examples: ON + tests: OFF # the template asap has no unit tests + - build_type: Release + examples: ON + tests: OFF # the template asap has no unit tests + + steps: + - name: Split compiler name and version + id: split + env: + COMPILER: ${{ matrix.compiler }} + COMPILER_NAME: '' + COMPILER_VERSION: '' + run: | + COMPILER_NAME=${COMPILER%%-*} + COMPILER_VERSION=${COMPILER##*-} + echo "compiler_name=$COMPILER_NAME" >> $GITHUB_OUTPUT + if [ $COMPILER_NAME == 'gcc' ] + then + echo "gcc_version=$COMPILER_VERSION" >> $GITHUB_OUTPUT + elif [ $COMPILER_NAME == 'clang' ] + then + echo "clang_version=$COMPILER_VERSION" >> $GITHUB_OUTPUT + echo "gcc_version=11" >> $GITHUB_OUTPUT + fi + + - name: Install basic OS packages + run: | + sudo apt-get -qq update + sudo apt-get -qq -y install \ + software-properties-common \ + apt-transport-https \ + lsb-release \ + ca-certificates \ + curl \ + gnupg \ + build-essential + + - name: Install GCC (always runs) + run: | + # sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test + sudo apt-get -qq update && \ + sudo apt-get -qq -y install gcc-${{steps.split.outputs.gcc_version}} g++-${{steps.split.outputs.gcc_version}} + + - name: Install clang (only if building with clang) + if: ${{ steps.split.outputs.compiler_name == 'clang' }} + run: | + curl https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + sudo add-apt-repository -y 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-${{steps.split.outputs.clang_version}} main' + sudo apt-get -qq update + sudo apt-get -qq -y install \ + libllvm${{steps.split.outputs.clang_version}} \ + llvm-${{steps.split.outputs.clang_version}} \ + llvm-${{steps.split.outputs.clang_version}}-dev \ + llvm-${{steps.split.outputs.clang_version}}-runtime \ + llvm-${{steps.split.outputs.clang_version}}-linker-tools \ + lld-${{steps.split.outputs.clang_version}} \ + clang-${{steps.split.outputs.clang_version}} \ + clang-tools-${{steps.split.outputs.clang_version}} \ + clang-format-${{steps.split.outputs.clang_version}} \ + libclang1-${{steps.split.outputs.clang_version}} \ + libc++-${{steps.split.outputs.clang_version}}-dev \ + libc++abi-${{steps.split.outputs.clang_version}}-dev \ + clang-format-${{steps.split.outputs.clang_version}} \ + python3-clang-${{steps.split.outputs.clang_version}} \ + clang-tools-${{steps.split.outputs.clang_version}} \ + clang-tidy-${{steps.split.outputs.clang_version}} + + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Use GNU compilers (only if building with gcc/g++) + if: ${{ steps.split.outputs.compiler_name == 'gcc' }} + run: | + echo "CC=gcc" >> $GITHUB_ENV + echo "CXX=g++" >> $GITHUB_ENV + sudo update-alternatives --install \ + /usr/bin/gcc gcc /usr/bin/gcc-${{steps.split.outputs.gcc_version}} 110 \ + --slave /usr/bin/g++ g++ /usr/bin/g++-${{steps.split.outputs.gcc_version}} \ + --slave /usr/bin/gcov gcov /usr/bin/gcov-${{steps.split.outputs.gcc_version}} + + - name: Use clang (only if building with clang/clang++) + if: ${{ steps.split.outputs.compiler_name == 'clang' }} + run: | + echo "CC=clang" >> $GITHUB_ENV + echo "CXX=clang++" >> $GITHUB_ENV + for command in clang clang++ clang-apply-replacements clang-check \ + clang-query clang-tidy clang-format scan-build scan-view llvm-cov \ + llvm-profdata + do + sudo update-alternatives --install /usr/bin/$command $command \ + /usr/bin/$command-${{steps.split.outputs.clang_version}} 110 + done + clang --version + + - name: Setup ninja + # Do not use ninja-build from the distro repos as it is always old + uses: abdes/gha-setup-ninja@master + with: + version: ${{ env.NINJA_VERSION }} + + - name: Setup cmake + # Do not use cmake from the distro repos as it is not the version we + # want + uses: jwlawson/actions-setup-cmake@v1 + with: + cmake-version: ${{ env.CMAKE_VERSION }} + + - name: Install ccache from latest + run: | + CCACHE_DIST="ccache-${{ env.CCACHE_VERSION }}-linux-x86_64" + CCACHE_URL="https://github.com/ccache/ccache/releases/download/v$CCACHE_VERSION/$CCACHE_DIST.tar.xz" + echo "Installing ccache from: $CCACHE_URL" + curl -s -L -o ./ccache.tar.xz $CCACHE_URL + tar xf ./ccache.tar.xz + rm -f ./ccache.tar.xz + echo "$GITHUB_WORKSPACE/$CCACHE_DIST" >> $GITHUB_PATH + + - name: Log environment properties + run: | + echo "Build Type : ${{matrix.build_type}}" + echo "Compiler Name : ${{steps.split.outputs.compiler_name}}" + if [ ${{steps.split.outputs.compiler_name}} == 'clang' ] + then + echo "Clang Version : ${{steps.split.outputs.clang_version}}" + fi + echo "GCC Version : ${{steps.split.outputs.gcc_version}}" + ninja --version + cmake --version + gcc --version + clang --version + ccache --version + + - name: Setup ccache + uses: Chocobo1/setup-ccache-action@v1 + with: + install_ccache: false + update_packager_index: false + prepend_symlinks_to_path: false + windows_compile_environment: msvc # this field is required + + - name: Configure build + working-directory: ${{runner.workspace}} + run: | + cmake -B build -S $GITHUB_WORKSPACE \ + -D CMAKE_BUILD_TYPE=${{matrix.build_type}} \ + -G Ninja \ + -D CMAKE_MAKE_PROGRAM=ninja \ + -D USE_CCACHE=ON \ + -D ASAP_BUILD_TESTS=${{matrix.tests}} \ + -D ASAP_BUILD_EXAMPLES=${{matrix.examples}} \ + -D ASAP_BUILD_DOCS=OFF \ + -D CMAKE_INSTALL_PREFIX=install \ + -D CMAKE_VERBOSE_MAKEFILE=ON + + - name: Build main targets + working-directory: ${{runner.workspace}} + run: | + cmake --build build --target all + + - name: Build test targets + working-directory: ${{runner.workspace}} + if: ${{ matrix.tests == true }} + run: | + cmake --build build --target build-all-tests + + - name: Run tests with ctest + working-directory: ${{runner.workspace}} + # Hardcode 2 cores we know are there + run: | + ctest \ + --test-dir build \ + -C ${{matrix.build_type}} \ + -j 2 \ + --output-on-failure From e46196f7daf138c2fd33248fbc0593367149480b Mon Sep 17 00:00:00 2001 From: Abdessattar Sassi <457645+abdes@users.noreply.github.com> Date: Fri, 21 Apr 2023 22:52:05 +0400 Subject: [PATCH 20/26] feat: comprehensive windows builds for CI --- .github/workflows/windows-builds.yml | 91 ++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 .github/workflows/windows-builds.yml diff --git a/.github/workflows/windows-builds.yml b/.github/workflows/windows-builds.yml new file mode 100644 index 0000000..7cabc01 --- /dev/null +++ b/.github/workflows/windows-builds.yml @@ -0,0 +1,91 @@ +name: windows-builds + +on: [push, pull_request] + +env: + CMAKE_VERSION: 3.21.1 + NINJA_VERSION: 1.11.1 + CCACHE_VERSION: 4.8 + +jobs: + dev-build: + runs-on: windows-latest + strategy: + matrix: + generator: ['Ninja', 'NMake Makefiles', 'Visual Studio 17 2022'] + build_type: [Debug, Release] + include: + - build_type: Debug + examples: ON + tests: OFF # the template asap has no unit tests + - build_type: Release + examples: ON + tests: OFF # the template asap has no unit tests + + steps: + - name: Setup ninja (only if the generator is 'Ninja') + if: matrix.generator == 'Ninja' + uses: abdes/gha-setup-ninja@master + with: + version: ${{ env.NINJA_VERSION }} + + - name: Setup cmake + uses: jwlawson/actions-setup-cmake@v1 + with: + cmake-version: ${{ env.CMAKE_VERSION }} + + - name: Setup ccache + uses: Chocobo1/setup-ccache-action@v1 + with: + install_ccache: true + update_packager_index: false + prepend_symlinks_to_path: false + windows_compile_environment: msvc # this field is required + + - name: Set MSVC environment + uses: ilammy/msvc-dev-cmd@v1 + + - name: Log environment properties + run: | + echo "Build Type : ${{matrix.build_type}}" + echo "Generator : ${{matrix.generator}}" + if ('${{matrix.generator}}' -eq 'Ninja') { + ninja --version + } + cmake --version + ccache --version + + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Configure build + working-directory: ${{runner.workspace}} + run: | + cmake -B build -S asap ` + -D CMAKE_BUILD_TYPE=${{matrix.build_type}} ` + -G "${{ matrix.generator }}" ` + -D USE_CCACHE=ON ` + -D ASAP_BUILD_TESTS=${{matrix.tests}} ` + -D ASAP_BUILD_EXAMPLES=${{matrix.examples}} ` + -D ASAP_BUILD_DOCS=OFF ` + -D CMAKE_INSTALL_PREFIX=install ` + -D CMAKE_VERBOSE_MAKEFILE=ON + dir build + + - name: Build main targets + working-directory: ${{runner.workspace}} + run: | + cmake --build build --config ${{matrix.build_type}} + + - name: Build test targets + working-directory: ${{runner.workspace}} + if: matrix.tests == true + run: | + cmake --build build --config ${{matrix.build_type}} --target build-all-tests + + - name: Run tests with ctest + working-directory: ${{runner.workspace}} + # Hardcode 2 cores we know are there + run: | + ctest --test-dir build -C ${{matrix.build_type}} -j 2 --output-on-failure From 335f629d464cf655d32bec57321cbc54b6c7879d Mon Sep 17 00:00:00 2001 From: Abdessattar Sassi <457645+abdes@users.noreply.github.com> Date: Sat, 22 Apr 2023 10:47:06 +0400 Subject: [PATCH 21/26] chore: remove duplicate line --- tools/version-info/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/version-info/CMakeLists.txt b/tools/version-info/CMakeLists.txt index f84feb2..5627767 100644 --- a/tools/version-info/CMakeLists.txt +++ b/tools/version-info/CMakeLists.txt @@ -48,7 +48,6 @@ asap_add_executable(${MODULE_TARGET_NAME} WARNING SOURCES "src/main.cpp") target_compile_features(${MODULE_TARGET_NAME} PUBLIC cxx_constexpr) -target_compile_features(${MODULE_TARGET_NAME} PUBLIC cxx_constexpr) cmake_path(SET version_include_dir ${CMAKE_CURRENT_BINARY_DIR}/../../include NORMALIZE) target_include_directories( From 084ae866e16a7999c8612599610c385e0e555321 Mon Sep 17 00:00:00 2001 From: Abdessattar Sassi <457645+abdes@users.noreply.github.com> Date: Sat, 22 Apr 2023 10:52:22 +0400 Subject: [PATCH 22/26] feat: comprehensive macos builds for CI --- .github/workflows/macos-builds.yml | 86 ++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 .github/workflows/macos-builds.yml diff --git a/.github/workflows/macos-builds.yml b/.github/workflows/macos-builds.yml new file mode 100644 index 0000000..030026e --- /dev/null +++ b/.github/workflows/macos-builds.yml @@ -0,0 +1,86 @@ +name: macos-builds + +on: [push, pull_request] + +env: + CMAKE_VERSION: 3.21.1 + NINJA_VERSION: 1.11.1 + CCACHE_VERSION: 4.8 + CC: clang + CXX: clang++ + +jobs: + dev-build: + runs-on: macos-latest + strategy: + matrix: + generator: ['Unix Makefiles', Xcode] + build_type: [Debug, Release] + include: + - build_type: Debug + examples: ON + tests: OFF # the template asap has no unit tests + - build_type: Release + examples: ON + tests: OFF # the template asap has no unit tests + + steps: + - name: Setup cmake + uses: jwlawson/actions-setup-cmake@v1 + with: + cmake-version: ${{ env.CMAKE_VERSION }} + + - name: Setup ccache + uses: Chocobo1/setup-ccache-action@v1 + with: + install_ccache: true + update_packager_index: false + prepend_symlinks_to_path: false + + - name: Setup XCode + if: matrix.generator == 'Xcode' + uses: mobiledevops/xcode-select-version-action@v1 + with: + xcode-select-version: 13.1 + + - name: Log environment properties + run: | + echo "Build Type : ${{matrix.build_type}}" + echo "Generator : ${{matrix.generator}}" + cmake --version + clang --version + ccache --version + + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Configure build + working-directory: ${{runner.workspace}} + run: | + cmake -B build -S $GITHUB_WORKSPACE \ + -D CMAKE_BUILD_TYPE=${{matrix.build_type}} \ + -G "${{ matrix.generator }}" \ + -D USE_CCACHE=ON \ + -D ASAP_BUILD_TESTS=${{matrix.tests}} \ + -D ASAP_BUILD_EXAMPLES=${{matrix.examples}} \ + -D ASAP_BUILD_DOCS=OFF \ + -D CMAKE_INSTALL_PREFIX=install \ + -D CMAKE_VERBOSE_MAKEFILE=ON + + - name: Build main targets + working-directory: ${{runner.workspace}} + run: | + cmake --build build --config ${{matrix.build_type}} + + - name: Build test targets + working-directory: ${{runner.workspace}} + if: ${{ matrix.tests == true }} + run: | + cmake --build build --config ${{matrix.build_type}} --target build-all-tests + + - name: Run tests with ctest + working-directory: ${{runner.workspace}} + # Hardcode 2 cores we know are there + run: | + ctest --test-dir build -C ${{matrix.build_type}} -j 2 --output-on-failure From 844880907866c93043e07dd136f36af67183dd76 Mon Sep 17 00:00:00 2001 From: Abdessattar Sassi <457645+abdes@users.noreply.github.com> Date: Sat, 22 Apr 2023 11:25:36 +0400 Subject: [PATCH 23/26] chore: combine CI dev builds using callable workflows --- .github/workflows/all-dev-builds.yml | 11 +++++++++++ .github/workflows/macos-builds.yml | 2 +- .github/workflows/ubuntu-builds.yml | 2 +- .github/workflows/windows-builds.yml | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/all-dev-builds.yml diff --git a/.github/workflows/all-dev-builds.yml b/.github/workflows/all-dev-builds.yml new file mode 100644 index 0000000..32b3ed3 --- /dev/null +++ b/.github/workflows/all-dev-builds.yml @@ -0,0 +1,11 @@ +name: Matrix Development Builds + +on: [push, pull_request] + +jobs: + Linux: + uses: ./.github/workflows/ubuntu-builds.yml + Windows: + uses: ./.github/workflows/windows-builds.yml + MacOS: + uses: ./.github/workflows/macos-builds.yml diff --git a/.github/workflows/macos-builds.yml b/.github/workflows/macos-builds.yml index 030026e..cbe40af 100644 --- a/.github/workflows/macos-builds.yml +++ b/.github/workflows/macos-builds.yml @@ -1,6 +1,6 @@ name: macos-builds -on: [push, pull_request] +on: workflow_call env: CMAKE_VERSION: 3.21.1 diff --git a/.github/workflows/ubuntu-builds.yml b/.github/workflows/ubuntu-builds.yml index 68de447..e3477ae 100644 --- a/.github/workflows/ubuntu-builds.yml +++ b/.github/workflows/ubuntu-builds.yml @@ -1,6 +1,6 @@ name: ubuntu-builds -on: [push, pull_request] +on: workflow_call env: CMAKE_VERSION: 3.21.1 diff --git a/.github/workflows/windows-builds.yml b/.github/workflows/windows-builds.yml index 7cabc01..34d9289 100644 --- a/.github/workflows/windows-builds.yml +++ b/.github/workflows/windows-builds.yml @@ -1,6 +1,6 @@ name: windows-builds -on: [push, pull_request] +on: workflow_call env: CMAKE_VERSION: 3.21.1 From 6ce4d70d3c500413e968571198e703a642c313ad Mon Sep 17 00:00:00 2001 From: Abdessattar Sassi <457645+abdes@users.noreply.github.com> Date: Sat, 22 Apr 2023 11:30:53 +0400 Subject: [PATCH 24/26] chore: remove the release workflow Release builds and packaging will be redesigned. --- .github/workflows/cmake-build.yml | 349 ------------------------------ 1 file changed, 349 deletions(-) delete mode 100644 .github/workflows/cmake-build.yml diff --git a/.github/workflows/cmake-build.yml b/.github/workflows/cmake-build.yml deleted file mode 100644 index 3e45021..0000000 --- a/.github/workflows/cmake-build.yml +++ /dev/null @@ -1,349 +0,0 @@ -name: CMake Build Matrix - -on: [push, pull_request] - -env: - CMAKE_VERSION: 3.21.1 - NINJA_VERSION: 1.10.2 - BUILD_TYPE: Release - -jobs: - build: - name: ${{ matrix.config.name }} - runs-on: ${{ matrix.config.os }} - strategy: - fail-fast: false - matrix: - config: - - { - name: "Windows Latest MSVC", - os: windows-latest, - artifact: "Windows-MSVC.7z", - build_type: "Release", - cc: "cl", - cxx: "cl", - environment_script: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat", - archiver: "7z a", - generators: "Visual Studio 17 2022", - } - - { - name: "Ubuntu_GCC_10", - os: ubuntu-latest, - artifact: "Linux.7z", - build_type: "Release", - cc: "gcc-10", - cxx: "g++-10", - archiver: "7z a", - generators: "Ninja", - } - - { - name: "Ubuntu_GCC_11", - os: ubuntu-latest, - artifact: "Linux-GCC-11.7z", - build_type: "Release", - cc: "gcc", - cxx: "g++", - archiver: "7z a", - generators: "Ninja", - } - - { - name: "macOS Latest Clang", - os: macos-latest, - artifact: "macOS.7z", - build_type: "Release", - cc: "clang", - cxx: "clang++", - archiver: "7za a", - generators: "Ninja", - } - - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - - name: Print env - run: | - echo github.event.action: ${{ github.event.action }} - echo github.event_name: ${{ github.event_name }} - - - name: Download Ninja and CMake - shell: cmake -P {0} - run: | - set(cmake_version $ENV{CMAKE_VERSION}) - set(ninja_version $ENV{NINJA_VERSION}) - - message(STATUS "Using host CMake version: ${CMAKE_VERSION}") - - if ("${{ runner.os }}" STREQUAL "Windows") - set(ninja_suffix "win.zip") - set(cmake_suffix "windows-x86_64.zip") - set(cmake_dir "cmake-${cmake_version}-windows-x86_64/bin") - elseif ("${{ runner.os }}" STREQUAL "Linux") - set(ninja_suffix "linux.zip") - set(cmake_suffix "linux-x86_64.tar.gz") - set(cmake_dir "cmake-${cmake_version}-linux-x86_64/bin") - elseif ("${{ runner.os }}" STREQUAL "macOS") - set(ninja_suffix "mac.zip") - set(cmake_suffix "macos-universal.tar.gz") - set(cmake_dir "cmake-${cmake_version}-macos-universal/CMake.app/Contents/bin") - endif() - - set(ninja_url "https://github.com/ninja-build/ninja/releases/download/v${ninja_version}/ninja-${ninja_suffix}") - file(DOWNLOAD "${ninja_url}" ./ninja.zip SHOW_PROGRESS) - execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./ninja.zip) - - set(cmake_url "https://github.com/Kitware/CMake/releases/download/v${cmake_version}/cmake-${cmake_version}-${cmake_suffix}") - file(DOWNLOAD "${cmake_url}" ./cmake.zip SHOW_PROGRESS) - execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./cmake.zip) - - # Add to PATH environment variable - file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/${cmake_dir}" cmake_dir) - set(path_separator ":") - if ("${{ runner.os }}" STREQUAL "Windows") - set(path_separator ";") - endif() - file(APPEND "$ENV{GITHUB_PATH}" "$ENV{GITHUB_WORKSPACE}${path_separator}${cmake_dir}") - - if (NOT "${{ runner.os }}" STREQUAL "Windows") - execute_process( - COMMAND chmod +x ninja - COMMAND chmod +x ${cmake_dir}/cmake - ) - endif() - - - name: Install gcc-11 - shell: bash - if: endsWith(matrix.config.name, 'GCC_11') - run: | - sudo apt-get update - sudo apt-get install gcc-11 g++-11 - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11 - - - name: Install ccache - shell: cmake -P {0} - run: | - if("${{ runner.os }}" STREQUAL "Windows") - # If ccache behaves badly on windows, skip this step - execute_process(COMMAND choco install ccache) - elseif("${{ runner.os }}" STREQUAL "macOS") - execute_process(COMMAND brew install ccache) - elseif("${{ runner.os }}" STREQUAL "Linux") - set(ccache_version "4.6.3") - set(ccache_dist "ccache-${ccache_version}-linux-x86_64") - set(ccache_url "https://github.com/ccache/ccache/releases/download/v${ccache_version}/${ccache_dist}.tar.xz") - file(DOWNLOAD "${ccache_url}" ./ccache.tar.xz SHOW_PROGRESS) - execute_process(COMMAND ${CMAKE_COMMAND} -E tar zxvf ./ccache.tar.xz) - # Add to PATH environment variable - file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/${ccache_dist}" ccache_dir) - set(path_separator ":") - file(APPEND "$ENV{GITHUB_PATH}" "$ENV{GITHUB_WORKSPACE}${path_separator}${ccache_dir}") - else() - message(FATAL_ERROR, "${{ runner.os }} is not supported") - endif() - - - name: Setup ccache - # If ccache behaves badly on windows, skip this step - # if: runner.os != 'Windows' - uses: Chocobo1/setup-ccache-action@v1 - with: - install_ccache: false - update_packager_index: false - prepend_symlinks_to_path: false - windows_compile_environment: msvc # this field is required - - - name: Configure - shell: cmake -P {0} - run: | - set(ENV{CC} ${{ matrix.config.cc }}) - set(ENV{CXX} ${{ matrix.config.cxx }}) - - if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x") - execute_process( - COMMAND "${{ matrix.config.environment_script }}" && set - OUTPUT_FILE environment_script_output.txt - ) - file(STRINGS environment_script_output.txt output_lines) - foreach(line IN LISTS output_lines) - if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$") - set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}") - endif() - endforeach() - endif() - - set(path_separator ":") - if ("${{ runner.os }}" STREQUAL "Windows") - set(path_separator ";") - endif() - set(ENV{PATH} "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}") - - # If ccache shows some strange behavior on windows, you can easily - # disable it here by setting the variable to "OFF" - if (NOT "${{ runner.os }}" STREQUAL "Windows") - set(enable_ccache "ON") - else() - set(enable_ccache "ON") - endif() - - execute_process( - COMMAND cmake - -S . - -B build - -D CMAKE_BUILD_TYPE=$ENV{BUILD_TYPE} - -G Ninja - -D USE_CCACHE=${enable_ccache} - -D CMAKE_MAKE_PROGRAM=ninja - -D ASAP_BUILD_TESTS=ON - -D ASAP_BUILD_EXAMPLES=ON - -D CMAKE_INSTALL_PREFIX=install - -D CMAKE_VERBOSE_MAKEFILE=ON - RESULT_VARIABLE result - ) - if (NOT result EQUAL 0) - message(FATAL_ERROR "Bad exit status") - endif() - - - name: Build - shell: cmake -P {0} - run: | - set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ") - - if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x") - file(STRINGS environment_script_output.txt output_lines) - foreach(line IN LISTS output_lines) - if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$") - set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}") - endif() - endforeach() - endif() - - execute_process( - COMMAND cmake --build build --target all - RESULT_VARIABLE result - OUTPUT_VARIABLE output - ERROR_VARIABLE output - ECHO_OUTPUT_VARIABLE ECHO_ERROR_VARIABLE - ) - if (NOT result EQUAL 0) - string(REGEX MATCH "FAILED:.*$" error_message "${output}") - string(REPLACE "\n" "%0A" error_message "${error_message}") - message("::error::${error_message}") - message(FATAL_ERROR "Build failed") - endif() - - - name: Run tests - shell: cmake -P {0} - run: | - include(ProcessorCount) - ProcessorCount(N) - - set(ENV{CTEST_OUTPUT_ON_FAILURE} "ON") - - execute_process( - COMMAND ctest -j ${N} - WORKING_DIRECTORY build - RESULT_VARIABLE result - OUTPUT_VARIABLE output - ERROR_VARIABLE output - ECHO_OUTPUT_VARIABLE ECHO_ERROR_VARIABLE - ) - if (NOT result EQUAL 0) - string(REGEX MATCH "[0-9]+% tests.*[0-9.]+ sec.*$" test_results "${output}") - string(REPLACE "\n" "%0A" test_results "${test_results}") - message("::error::${test_results}") - message(FATAL_ERROR "Running tests failed!") - endif() - - - name: Install Strip - run: cmake --install build --strip - - - name: Pack - working-directory: install - run: cmake -E tar cfv ../${{ matrix.config.artifact }} --format=7zip . - - - name: Upload - uses: actions/upload-artifact@v1 - with: - path: ./${{ matrix.config.artifact }} - name: ${{ matrix.config.artifact }} - - release: - if: contains(github.ref, 'tags/v') - runs-on: ubuntu-latest - needs: build - - steps: - - name: Create Release - id: create_release - uses: actions/create-release@v1.0.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} - draft: false - prerelease: false - - - name: Store Release url - run: | - echo "${{ steps.create_release.outputs.upload_url }}" > ./upload_url - - - uses: actions/upload-artifact@v1 - with: - path: ./upload_url - name: upload_url - - publish: - if: contains(github.ref, 'tags/v') - name: ${{ matrix.config.name }} - runs-on: ${{ matrix.config.os }} - strategy: - fail-fast: false - matrix: - config: - - { - name: "Windows Latest MSVC", - artifact: "Windows-MSVC.7z", - os: windows-latest, - } - - { - name: "Ubuntu Latest GCC", - artifact: "Linux.7z", - os: ubuntu-latest, - } - - { - name: "macOS Latest Clang", - artifact: "macOS.7z", - os: macos-latest, - } - needs: release - - steps: - - name: Download artifact - uses: actions/download-artifact@v1 - with: - name: ${{ matrix.config.artifact }} - path: ./ - - - name: Download URL - uses: actions/download-artifact@v1 - with: - name: upload_url - path: ./ - - - id: set_upload_url - run: | - upload_url=`cat ./upload_url` - echo ::set-output name=upload_url::$upload_url - shell: bash - - - name: Upload to Release - id: upload_to_release - uses: actions/upload-release-asset@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.set_upload_url.outputs.upload_url }} - asset_path: ./${{ matrix.config.artifact }} - asset_name: ${{ matrix.config.artifact }} - asset_content_type: application/x-gtar From 5571aa28b91872135f0525f92f937ae5e3384475 Mon Sep 17 00:00:00 2001 From: Abdessattar Sassi <457645+abdes@users.noreply.github.com> Date: Mon, 4 Dec 2023 14:10:44 +0400 Subject: [PATCH 25/26] chore: update dependencies to latest --- cmake/common | 2 +- doxygen/doxygen-awesome-css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/common b/cmake/common index d165dd7..954e6ce 160000 --- a/cmake/common +++ b/cmake/common @@ -1 +1 @@ -Subproject commit d165dd7c259d40d08805a0e0bdda6ee04c7a54ff +Subproject commit 954e6cebe4c902d07d33beef166df89073a7b4f2 diff --git a/doxygen/doxygen-awesome-css b/doxygen/doxygen-awesome-css index 245c7c9..df88fe4 160000 --- a/doxygen/doxygen-awesome-css +++ b/doxygen/doxygen-awesome-css @@ -1 +1 @@ -Subproject commit 245c7c94c20eac22730ef89035967f78b77bf405 +Subproject commit df88fe4fdd97714fadfd3ef17de0b4401f804052 From e67e0425c1ee219e64c7a722641d36cf6daf0bdf Mon Sep 17 00:00:00 2001 From: Abdessattar Sassi <457645+abdes@users.noreply.github.com> Date: Mon, 4 Dec 2023 14:13:12 +0400 Subject: [PATCH 26/26] chore: upgrade CPM to 0.38.7 --- cmake/CPM.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/CPM.cmake b/cmake/CPM.cmake index 659e6e3..cce9b67 100644 --- a/cmake/CPM.cmake +++ b/cmake/CPM.cmake @@ -7,7 +7,7 @@ # Do this only once for the project by checking if we already have loaded CPM # which will define the CURRENT_CPM_VERSION, and if that version is what we want # to have here. -if(NOT CURRENT_CPM_VERSION VERSION_EQUAL 0.38.1) +if(NOT CURRENT_CPM_VERSION VERSION_EQUAL 0.38.7) set(CPM_DOWNLOAD_VERSION 0.38.1) if(CPM_SOURCE_CACHE)