From 5febd95cbf9e58e1bafbeda56cb4984e617362d9 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 16 Oct 2024 09:46:14 +1300 Subject: [PATCH 01/12] CI: added some "basic" GitHub Actions. --- .github/workflows/ci.yml | 111 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..b279063427 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,111 @@ +name: CI + +on: + pull_request: + branches: [ main ] + workflow_dispatch: + +env: + BUILDCACHE_ACCURACY: STRICT + BUILDCACHE_COMPRESS_FORMAT: ZSTD + BUILDCACHE_DEBUG: -1 + BUILDCACHE_LOG_FILE: "" + +jobs: + cpp_python: + name: ${{ matrix.name }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - name: 'Windows static (BPT)' + os: windows-latest + bindings_python: ON + build_shared: OFF + unit_tests: ON + set_path: $env:Path="C:\libxml2\bin;C:\zlib\bin;"+$env:Path + additional_cmake_options: -DLIBXML2_INCLUDE_DIR="C:\libxml2\include\libxml2" -DLIBXML2_LIBRARY="C:\libxml2\lib\libxml2.lib" -DZLIB_INCLUDE_DIR="C:\zlib\include" -DZLIB_LIBRARY="C:\zlib\lib\z_dll.lib" + - name: 'Windows shared (BPT)' + os: windows-latest + bindings_python: ON + build_shared: ON + unit_tests: ON + set_path: $env:Path="C:\libxml2\bin;C:\zlib\bin;"+$env:Path + additional_cmake_options: -DLIBXML2_INCLUDE_DIR="C:\libxml2\include\libxml2" -DLIBXML2_LIBRARY="C:\libxml2\lib\libxml2.lib" -DZLIB_INCLUDE_DIR="C:\zlib\include" -DZLIB_LIBRARY="C:\zlib\lib\z_dll.lib" + - name: 'Linux static (B)' + os: ubuntu-latest + bindings_python: OFF + build_shared: OFF + unit_tests: OFF + - name: 'Linux shared (BPT)' + os: ubuntu-latest + bindings_python: ON + build_shared: ON + unit_tests: ON + - name: 'macOS static (Intel) (BT)' + os: macos-13 + bindings_python: OFF + build_shared: OFF + unit_tests: ON + - name: 'macOS shared (Intel) (BPT)' + os: macos-13 + bindings_python: ON + build_shared: ON + unit_tests: ON + - name: 'macOS static (ARM) (BT)' + os: macos-latest + bindings_python: OFF + build_shared: OFF + unit_tests: ON + - name: 'macOS shared (ARM) (BPT)' + os: macos-latest + bindings_python: ON + build_shared: ON + unit_tests: ON + steps: + - name: Check out libCellML + uses: actions/checkout@v4 + - name: Install Python (if needed) + if: ${{ matrix.bindings_python == 'ON' }} + uses: actions/setup-python@v5 + with: + python-version: '3.13' + - name: Install CMake and Ninja + uses: lukka/get-cmake@latest + - name: Install buildcache + uses: mikehardy/buildcache-action@v2 + with: + cache_key: ${{ matrix.os }}-${{ matrix.build_shared }} + - name: Configure MSVC (Windows only) + if: ${{ runner.os == 'Windows' }} + uses: ilammy/msvc-dev-cmd@v1 + - name: Install libxml2 (Windows only) + if: ${{ runner.os == 'Windows' }} + run: | + Invoke-WebRequest -UseBasicParsing https://github.com/cellml/gha/releases/download/gha/libxml2.zip -OutFile libxml2.zip + Expand-Archive -LiteralPath libxml2.zip -DestinationPath C:\ + - name: Install SWIG (macOS only and if needed) + if: ${{ runner.os == 'macOS' && matrix.bindings_python == 'ON' }} + run: | + brew install swig + - name: Install zlib (Windows only) + if: ${{ runner.os == 'Windows' }} + run: | + Invoke-WebRequest -UseBasicParsing https://github.com/cellml/gha/releases/download/gha/zlib.zip -OutFile zlib.zip + Expand-Archive -LiteralPath zlib.zip -DestinationPath C:\ + - name: Configure libCellML + run: | + mkdir build + cd build + ${{ matrix.set_path }} + cmake -G Ninja -DBINDINGS_PYTHON=${{ matrix.bindings_python }} -DBUILD_SHARED=${{ matrix.build_shared }} -DCOVERAGE=OFF -DLLVM_COVERAGE=OFF -DMEMCHECK=OFF -DUNIT_TESTS=${{ matrix.unit_tests }} ${{ matrix.additional_cmake_options }} .. + - name: Build libCellML + run: | + cd build + ninja + - name: Unit testing + if: ${{ matrix.unit_tests == 'ON' }} + run: | + cd build + ninja test From cf90c3bd3deeb7818375112e078b4d3aeeb18488 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 16 Oct 2024 13:41:15 +1300 Subject: [PATCH 02/12] CI: added some "basic" GitHub Actions. --- .github/workflows/ci.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b279063427..8ef4447caf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -109,3 +109,26 @@ jobs: run: | cd build ninja test + code_formatting: + name: Code formatting + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - name: Check out libCellML + uses: actions/checkout@v4 + - name: Install ClangFormat + run: | + sudo apt update + sudo apt install clang-format + - name: Install CMake and Ninja + uses: lukka/get-cmake@latest + - name: Configure libCellML + run: | + mkdir build + cd build + cmake -G Ninja .. + - name: Code formatting + run: | + cd build + ninja test_clang_format From 96877a67512dfa4547d9fe1f63827d28949ce4af Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 16 Oct 2024 14:00:00 +1300 Subject: [PATCH 03/12] CI: added some "basic" GitHub Actions. --- .github/workflows/ci.yml | 32 ++++++++++++++ cmake/environmentchecks.cmake | 2 + docs/CMakeLists.txt | 5 +-- docs/conf.in.py | 66 ++++++++++++++-------------- src/api/libcellml/generatorprofile.h | 2 +- 5 files changed, 70 insertions(+), 37 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ef4447caf..067e470736 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -132,3 +132,35 @@ jobs: run: | cd build ninja test_clang_format + documentation: + name: Documentation + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - name: Check out libCellML + uses: actions/checkout@v4 + - name: Install CMake and Ninja + uses: lukka/get-cmake@latest + - name: Install buildcache + uses: mikehardy/buildcache-action@v2 + - name: Install dot + run: | + sudo apt update + sudo apt install graphviz + - name: Install Doxygen + run: | + sudo apt update + sudo apt install doxygen + - name: Install Sphinx + run: | + pip3 install sphinx + - name: Configure libCellML + run: | + mkdir build + cd build + cmake -G Ninja -DBINDINGS_PYTHON=OFF .. + - name: Documentation + run: | + cd build + ninja docs diff --git a/cmake/environmentchecks.cmake b/cmake/environmentchecks.cmake index 071e33682c..59c61a3baf 100644 --- a/cmake/environmentchecks.cmake +++ b/cmake/environmentchecks.cmake @@ -45,6 +45,7 @@ else () endif() find_program(CLANG_FORMAT_EXE NAMES ${PREFERRED_CLANG_FORMAT_NAMES} clang-format) find_program(CLANG_TIDY_EXE NAMES ${PREFERRED_CLANG_TIDY_NAMES} clang-tidy) + find_program(DOT_EXE NAMES ${PREFERRED_FIND_NAMES} dot) find_program(FIND_EXE NAMES ${PREFERRED_FIND_NAMES} find) find_program(GCOV_EXE NAMES ${PREFERRED_GCOV_NAMES} gcov) find_program(LLVM_COV_EXE NAMES ${PREFERRED_LLVM_COV_NAMES} llvm-cov HINTS ${LLVM_BIN_DIR} /Library/Developer/CommandLineTools/usr/bin/) @@ -93,6 +94,7 @@ else () BUILDCACHE_EXE CLANG_TIDY_EXE CLANG_FORMAT_EXE + DOT_EXE FIND_EXE GCC_COVERAGE_COMPILER_FLAGS_OK GCOV_EXE diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 6795596e50..8498fc7b4a 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -49,7 +49,7 @@ if(SPHINX_FOUND) COMMENT "Building HTML documentation with Sphinx") endif() -if(DOXYGEN_FOUND) +if(DOXYGEN_FOUND AND DOT_EXE) set(DOXYGEN_DOCS_TARGET api_docs) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in.config ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) add_custom_target(${DOXYGEN_DOCS_TARGET} @@ -76,7 +76,7 @@ if(LIBCELLML_COVERAGE) COMMENT "Running coverage tests with html output") endif() -if(SPHINX_FOUND OR DOXYGEN_FOUND OR LIBCELLML_COVERAGE) +if(SPHINX_FOUND AND DOXYGEN_FOUND AND LIBCELLML_COVERAGE) add_custom_target(docs DEPENDS ${SPHINX_DOCS_TARGET} ${DOXYGEN_DOCS_TARGET} ${COVERAGE_DOCS_TARGET} ${DOXYGEN_API_XML_DOCS_TARGET} COMMENT "Generating documentation") @@ -86,4 +86,3 @@ if(SPHINX_FOUND OR DOXYGEN_FOUND OR LIBCELLML_COVERAGE) COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/_doctrees COMMENT "Cleaning documentation") endif() - diff --git a/docs/conf.in.py b/docs/conf.in.py index 1fad261573..b671f63111 100644 --- a/docs/conf.in.py +++ b/docs/conf.in.py @@ -47,42 +47,42 @@ # These are the shorthand for external links. Use them in the other pages as: # :shortcut:`Shortcut text ` NB space before < # Declare below as: -# 'shortcut': ('http://linkhere/%s',''), NB have to put the string insertion %s to make it work +# 'shortcut': ('http://linkhere/%s', None), NB have to put the string insertion %s to make it work extlinks = { # NB for deployment outside of the libcellml.org domain, you will need to include the root of the href for the # :api: shortcut here. This only works internally. - 'api': ('/documentation/latest/api/classlibcellml_1_1%s', ''), - 'buildbot': ('https://buildbot.net/%s',''), - 'cellml': ('https://www.cellml.org/%s',''), - 'cellml2spec': ('https://www.cellml.org/specifications/cellml_2.0%s', ''), - 'clang': ('https://clang.llvm.org/%s',''), - 'cmake': ('https://cmake.org/%s',''), - 'doxygen': ('http://www.doxygen.nl/%s',''), - 'forcescheduler': ('http://docs.buildbot.net/latest/developer/cls-forcesched.html%s',''), - 'gcc': ('https://gcc.gnu.org/%s',''), - 'gcovr': ('https://gcovr.com/%s',''), - 'git': ('https://git-scm.com/%s',''), - 'github': ('https://github.com/%s',''), - 'github_desktop': ('https://desktop.github.com/%s',''), - 'github_help': ('https://help.github.com%s',''), - 'github_rtd': ('https://github.com/rtfd/readthedocs.org/issues%s',''), - 'google_style_guide': ('https://google.github.io/styleguide/cppguide.html%s',''), - 'graphviz': ('http://graphviz.org%s',''), - 'htpasswd': ('https://httpd.apache.org/docs/current/programs/htpasswd.html%s',''), - 'libcellml_repo': ('https://github.com/cellml/libcellml/%s',''), - 'libcellml_buildbot': ('https://autotest.bioeng.auckland.ac.nz/buildbot/libcellml/#/builders%s',''), - 'libxml2': ('http://xmlsoft.org/%s',''), - 'mathml': ('https://www.w3.org/Math/%s',''), - 'msvs': ('https://visualstudio.microsoft.com%s',''), - 'opencmiss_libxml2_repo': ('https://github.com/OpenCMISS-Dependencies/libxml2/releases%s',''), - 'opencmiss_zlib_repo': ('https://github.com/OpenCMISS-Dependencies/zlib/releases%s',''), - 'python': ('https://www.python.org/%s',''), - 'sphinx': ('http://www.sphinx-doc.org/en/master/%s',''), - 'swig':('http://swig.org%s',''), - 'swigwin_download': ('https://sourceforge.net/projects/swig/files/swigwin/%s',''), - 'wikipedia': ('https://en.wikipedia.org/wiki%s',''), - 'xml': ('https://www.w3.org/XML/%s',''), - 'zlib': ('https://www.zlib.net/%s',''), + 'api': ('/documentation/latest/api/classlibcellml_1_1%s', None), + 'buildbot': ('https://buildbot.net/%s', None), + 'cellml': ('https://www.cellml.org/%s', None), + 'cellml2spec': ('https://www.cellml.org/specifications/cellml_2.0%s', None), + 'clang': ('https://clang.llvm.org/%s', None), + 'cmake': ('https://cmake.org/%s', None), + 'doxygen': ('http://www.doxygen.nl/%s', None), + 'forcescheduler': ('http://docs.buildbot.net/latest/developer/cls-forcesched.html%s', None), + 'gcc': ('https://gcc.gnu.org/%s', None), + 'gcovr': ('https://gcovr.com/%s', None), + 'git': ('https://git-scm.com/%s', None), + 'github': ('https://github.com/%s', None), + 'github_desktop': ('https://desktop.github.com/%s', None), + 'github_help': ('https://help.github.com%s', None), + 'github_rtd': ('https://github.com/rtfd/readthedocs.org/issues%s', None), + 'google_style_guide': ('https://google.github.io/styleguide/cppguide.html%s', None), + 'graphviz': ('http://graphviz.org%s', None), + 'htpasswd': ('https://httpd.apache.org/docs/current/programs/htpasswd.html%s', None), + 'libcellml_repo': ('https://github.com/cellml/libcellml/%s', None), + 'libcellml_buildbot': ('https://autotest.bioeng.auckland.ac.nz/buildbot/libcellml/#/builders%s', None), + 'libxml2': ('http://xmlsoft.org/%s', None), + 'mathml': ('https://www.w3.org/Math/%s', None), + 'msvs': ('https://visualstudio.microsoft.com%s', None), + 'opencmiss_libxml2_repo': ('https://github.com/OpenCMISS-Dependencies/libxml2/releases%s', None), + 'opencmiss_zlib_repo': ('https://github.com/OpenCMISS-Dependencies/zlib/releases%s', None), + 'python': ('https://www.python.org/%s', None), + 'sphinx': ('http://www.sphinx-doc.org/en/master/%s', None), + 'swig':('http://swig.org%s', None), + 'swigwin_download': ('https://sourceforge.net/projects/swig/files/swigwin/%s', None), + 'wikipedia': ('https://en.wikipedia.org/wiki%s', None), + 'xml': ('https://www.w3.org/XML/%s', None), + 'zlib': ('https://www.zlib.net/%s', None), } # The master toctree document. diff --git a/src/api/libcellml/generatorprofile.h b/src/api/libcellml/generatorprofile.h index 10335d24d8..fb9c90510c 100644 --- a/src/api/libcellml/generatorprofile.h +++ b/src/api/libcellml/generatorprofile.h @@ -2587,7 +2587,7 @@ class LIBCELLML_EXPORT GeneratorProfile * Set the @c std::string for the name of the state variable type that is * used in a differential model. * - * @param stateTypeString The @c std::string to use for the name of the + * @param stateVariableTypeString The @c std::string to use for the name of the * state variable type. */ void setStateVariableTypeString(const std::string &stateVariableTypeString); From b6d52b0900c11c9b11ed3c70c38377f6deb581b0 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 16 Oct 2024 15:34:08 +1300 Subject: [PATCH 04/12] CI: added some "basic" GitHub Actions. --- .github/workflows/ci.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 067e470736..49f3d1d342 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -164,3 +164,29 @@ jobs: run: | cd build ninja docs + coverage: + name: Code coverage + runs-on: macos-latest + strategy: + fail-fast: false + steps: + - name: Check out libCellML + uses: actions/checkout@v4 + - name: Install CMake and Ninja + uses: lukka/get-cmake@latest + - name: Install buildcache + uses: mikehardy/buildcache-action@v2 + - name: Install LLVM + run: | + brew install --overwrite llvm + brew info llvm + - name: Configure libCellML + run: | + mkdir build + cd build + cmake -G Ninja -DBINDINGS_PYTHON=OFF .. + - name: Code coverage + run: | + cd build + ninja llvm_coverage + if [ `ninja llvm_coverage | grep TOTAL | sed 's/ /\n/g' | grep "100.00%" | wc -l | sed 's/ //g'` -eq 4 ]; then exit 0; else exit 1; fi From 1add1b6cabd8e4249d6f50dbc5e06430c53813c6 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 16 Oct 2024 15:53:43 +1300 Subject: [PATCH 05/12] CI: added some "basic" GitHub Actions. --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 49f3d1d342..679cfeba9a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -190,3 +190,28 @@ jobs: cd build ninja llvm_coverage if [ `ninja llvm_coverage | grep TOTAL | sed 's/ /\n/g' | grep "100.00%" | wc -l | sed 's/ //g'` -eq 4 ]; then exit 0; else exit 1; fi + memory_leaks: + name: Memory leaks + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - name: Check out libCellML + uses: actions/checkout@v4 + - name: Install CMake and Ninja + uses: lukka/get-cmake@latest + - name: Install buildcache + uses: mikehardy/buildcache-action@v2 + - name: Install Valgrind + run: | + sudo apt update + sudo apt install valgrind + - name: Configure libCellML + run: | + mkdir build + cd build + cmake -G Ninja -DBINDINGS_PYTHON=OFF .. + - name: Memory leaks + run: | + cd build + ninja memcheck From 1dce2018b41cb759be0e6f29afb1025d666ec44a Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 16 Oct 2024 16:58:15 +1300 Subject: [PATCH 06/12] CI: added some "basic" GitHub Actions. --- .github/workflows/ci.yml | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 679cfeba9a..6b4eb835a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -215,3 +215,53 @@ jobs: run: | cd build ninja memcheck + javascript: + name: JavaScript (BT) + runs-on: macos-latest + strategy: + fail-fast: false + env: + LIBCELLML_WASM_DIR: wasm + LIBXML2_VERSION: 2.9.10 + ZLIB_VERSION: 1.2.3 + steps: + - name: Check out libCellML + uses: actions/checkout@v4 + - name: Install CMake and Ninja + uses: lukka/get-cmake@latest + - name: Install buildcache + uses: mikehardy/buildcache-action@v2 + - name: Install Emscripten + run: | + brew install --overwrite emscripten + - name: Set up the build directory + run: | + mkdir build + - name: Build zlib + run: | + cd build + ZLIB_BUILD_DIR=zlib-wasm + git clone https://github.com/OpenCMISS-Dependencies/zlib.git -b v${ZLIB_VERSION} + mkdir ${ZLIB_BUILD_DIR} + emcmake cmake -G Ninja -S zlib -B ${ZLIB_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/${LIBCELLML_WASM_DIR} -DBUILD_SHARED_LIBS=OFF + cmake --build ${ZLIB_BUILD_DIR} + cmake --install ${ZLIB_BUILD_DIR} + - name: Build libxml2 + run: | + cd build + LIBXML2_BUILD_DIR=libxml2-wasm + git clone https://github.com/OpenCMISS-Dependencies/libxml2.git -b v${LIBXML2_VERSION} + mkdir ${LIBXML2_BUILD_DIR} + emcmake cmake -G Ninja -S libxml2 -B ${LIBXML2_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/${LIBCELLML_WASM_DIR} -DZLIB_DIR=~/${LIBCELLML_WASM_DIR}/lib/cmake/ZLIB-${ZLIB_VERSION} -DBUILD_SHARED_LIBS=OFF -DLIBXML2_WITH_ICONV=OFF -DLIBXML2_WITH_LZMA=OFF -DLIBXML2_WITH_PYTHON=OFF -DLIBXML2_WITH_TESTS=OFF -DLIBXML2_WITH_PROGRAMS=OFF + cmake --build ${LIBXML2_BUILD_DIR} + cmake --install ${LIBXML2_BUILD_DIR} + - name: Build libCellML + run: | + cd build + mkdir ${LIBCELLML_WASM_DIR} + emcmake cmake -G Ninja -S .. -B ${LIBCELLML_WASM_DIR} -DLibXml2_DIR=~/${LIBCELLML_WASM_DIR}/lib/cmake/libxml2-${LIBXML2_VERSION} -DBUILD_TYPE=Release + cmake --build ${LIBCELLML_WASM_DIR} + - name: Unit testing + run: | + cd build + cmake --build ${LIBCELLML_WASM_DIR} --target jest_test From aefa695f16ecacd271e9cdaf3de208167b8e1fa3 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 16 Oct 2024 17:42:03 +1300 Subject: [PATCH 07/12] CI: added some "basic" GitHub Actions. --- .github/workflows/ci.yml | 142 +++++++++++++++++++-------------------- 1 file changed, 71 insertions(+), 71 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6b4eb835a2..86d33ff01f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,46 +19,46 @@ jobs: fail-fast: false matrix: include: - - name: 'Windows static (BPT)' + - name: 'Windows static - C++/Python' os: windows-latest bindings_python: ON build_shared: OFF unit_tests: ON set_path: $env:Path="C:\libxml2\bin;C:\zlib\bin;"+$env:Path additional_cmake_options: -DLIBXML2_INCLUDE_DIR="C:\libxml2\include\libxml2" -DLIBXML2_LIBRARY="C:\libxml2\lib\libxml2.lib" -DZLIB_INCLUDE_DIR="C:\zlib\include" -DZLIB_LIBRARY="C:\zlib\lib\z_dll.lib" - - name: 'Windows shared (BPT)' + - name: 'Windows shared - C++/Python' os: windows-latest bindings_python: ON build_shared: ON unit_tests: ON set_path: $env:Path="C:\libxml2\bin;C:\zlib\bin;"+$env:Path additional_cmake_options: -DLIBXML2_INCLUDE_DIR="C:\libxml2\include\libxml2" -DLIBXML2_LIBRARY="C:\libxml2\lib\libxml2.lib" -DZLIB_INCLUDE_DIR="C:\zlib\include" -DZLIB_LIBRARY="C:\zlib\lib\z_dll.lib" - - name: 'Linux static (B)' + - name: 'Linux static - C++ (build only)' os: ubuntu-latest bindings_python: OFF build_shared: OFF unit_tests: OFF - - name: 'Linux shared (BPT)' + - name: 'Linux shared - C++/Python' os: ubuntu-latest bindings_python: ON build_shared: ON unit_tests: ON - - name: 'macOS static (Intel) (BT)' + - name: 'macOS static - C++ (Intel)' os: macos-13 bindings_python: OFF build_shared: OFF unit_tests: ON - - name: 'macOS shared (Intel) (BPT)' + - name: 'macOS shared - C++/Python (Intel)' os: macos-13 bindings_python: ON build_shared: ON unit_tests: ON - - name: 'macOS static (ARM) (BT)' + - name: 'macOS static - C++ (ARM)' os: macos-latest bindings_python: OFF build_shared: OFF unit_tests: ON - - name: 'macOS shared (ARM) (BPT)' + - name: 'macOS shared - C++/Python (ARM)' os: macos-latest bindings_python: ON build_shared: ON @@ -109,61 +109,79 @@ jobs: run: | cd build ninja test - code_formatting: - name: Code formatting - runs-on: ubuntu-latest + javascript: + name: JavaScript + runs-on: macos-latest strategy: fail-fast: false + env: + LIBCELLML_WASM_DIR: wasm + LIBXML2_VERSION: 2.9.10 + ZLIB_VERSION: 1.2.3 steps: - name: Check out libCellML uses: actions/checkout@v4 - - name: Install ClangFormat - run: | - sudo apt update - sudo apt install clang-format - name: Install CMake and Ninja uses: lukka/get-cmake@latest - - name: Configure libCellML + - name: Install buildcache + uses: mikehardy/buildcache-action@v2 + - name: Install Emscripten + run: | + brew install --overwrite emscripten + - name: Set up the build directory run: | mkdir build + - name: Build zlib + run: | cd build - cmake -G Ninja .. - - name: Code formatting + ZLIB_BUILD_DIR=zlib-wasm + git clone https://github.com/OpenCMISS-Dependencies/zlib.git -b v${ZLIB_VERSION} + mkdir ${ZLIB_BUILD_DIR} + emcmake cmake -G Ninja -S zlib -B ${ZLIB_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/${LIBCELLML_WASM_DIR} -DBUILD_SHARED_LIBS=OFF + cmake --build ${ZLIB_BUILD_DIR} + cmake --install ${ZLIB_BUILD_DIR} + - name: Build libxml2 run: | cd build - ninja test_clang_format - documentation: - name: Documentation + LIBXML2_BUILD_DIR=libxml2-wasm + git clone https://github.com/OpenCMISS-Dependencies/libxml2.git -b v${LIBXML2_VERSION} + mkdir ${LIBXML2_BUILD_DIR} + emcmake cmake -G Ninja -S libxml2 -B ${LIBXML2_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/${LIBCELLML_WASM_DIR} -DZLIB_DIR=~/${LIBCELLML_WASM_DIR}/lib/cmake/ZLIB-${ZLIB_VERSION} -DBUILD_SHARED_LIBS=OFF -DLIBXML2_WITH_ICONV=OFF -DLIBXML2_WITH_LZMA=OFF -DLIBXML2_WITH_PYTHON=OFF -DLIBXML2_WITH_TESTS=OFF -DLIBXML2_WITH_PROGRAMS=OFF + cmake --build ${LIBXML2_BUILD_DIR} + cmake --install ${LIBXML2_BUILD_DIR} + - name: Build libCellML + run: | + cd build + mkdir ${LIBCELLML_WASM_DIR} + emcmake cmake -G Ninja -S .. -B ${LIBCELLML_WASM_DIR} -DLibXml2_DIR=~/${LIBCELLML_WASM_DIR}/lib/cmake/libxml2-${LIBXML2_VERSION} -DBUILD_TYPE=Release + cmake --build ${LIBCELLML_WASM_DIR} + - name: Unit testing + run: | + cd build + cmake --build ${LIBCELLML_WASM_DIR} --target jest_test + code_formatting: + name: Code formatting runs-on: ubuntu-latest strategy: fail-fast: false steps: - name: Check out libCellML uses: actions/checkout@v4 - - name: Install CMake and Ninja - uses: lukka/get-cmake@latest - - name: Install buildcache - uses: mikehardy/buildcache-action@v2 - - name: Install dot - run: | - sudo apt update - sudo apt install graphviz - - name: Install Doxygen + - name: Install ClangFormat run: | sudo apt update - sudo apt install doxygen - - name: Install Sphinx - run: | - pip3 install sphinx + sudo apt install clang-format + - name: Install CMake and Ninja + uses: lukka/get-cmake@latest - name: Configure libCellML run: | mkdir build cd build - cmake -G Ninja -DBINDINGS_PYTHON=OFF .. - - name: Documentation + cmake -G Ninja .. + - name: Code formatting run: | cd build - ninja docs + ninja test_clang_format coverage: name: Code coverage runs-on: macos-latest @@ -215,15 +233,11 @@ jobs: run: | cd build ninja memcheck - javascript: - name: JavaScript (BT) - runs-on: macos-latest + documentation: + name: Documentation + runs-on: ubuntu-latest strategy: fail-fast: false - env: - LIBCELLML_WASM_DIR: wasm - LIBXML2_VERSION: 2.9.10 - ZLIB_VERSION: 1.2.3 steps: - name: Check out libCellML uses: actions/checkout@v4 @@ -231,37 +245,23 @@ jobs: uses: lukka/get-cmake@latest - name: Install buildcache uses: mikehardy/buildcache-action@v2 - - name: Install Emscripten - run: | - brew install --overwrite emscripten - - name: Set up the build directory + - name: Install dot run: | - mkdir build - - name: Build zlib + sudo apt update + sudo apt install graphviz + - name: Install Doxygen run: | - cd build - ZLIB_BUILD_DIR=zlib-wasm - git clone https://github.com/OpenCMISS-Dependencies/zlib.git -b v${ZLIB_VERSION} - mkdir ${ZLIB_BUILD_DIR} - emcmake cmake -G Ninja -S zlib -B ${ZLIB_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/${LIBCELLML_WASM_DIR} -DBUILD_SHARED_LIBS=OFF - cmake --build ${ZLIB_BUILD_DIR} - cmake --install ${ZLIB_BUILD_DIR} - - name: Build libxml2 + sudo apt update + sudo apt install doxygen + - name: Install Sphinx run: | - cd build - LIBXML2_BUILD_DIR=libxml2-wasm - git clone https://github.com/OpenCMISS-Dependencies/libxml2.git -b v${LIBXML2_VERSION} - mkdir ${LIBXML2_BUILD_DIR} - emcmake cmake -G Ninja -S libxml2 -B ${LIBXML2_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/${LIBCELLML_WASM_DIR} -DZLIB_DIR=~/${LIBCELLML_WASM_DIR}/lib/cmake/ZLIB-${ZLIB_VERSION} -DBUILD_SHARED_LIBS=OFF -DLIBXML2_WITH_ICONV=OFF -DLIBXML2_WITH_LZMA=OFF -DLIBXML2_WITH_PYTHON=OFF -DLIBXML2_WITH_TESTS=OFF -DLIBXML2_WITH_PROGRAMS=OFF - cmake --build ${LIBXML2_BUILD_DIR} - cmake --install ${LIBXML2_BUILD_DIR} - - name: Build libCellML + pip3 install sphinx + - name: Configure libCellML run: | + mkdir build cd build - mkdir ${LIBCELLML_WASM_DIR} - emcmake cmake -G Ninja -S .. -B ${LIBCELLML_WASM_DIR} -DLibXml2_DIR=~/${LIBCELLML_WASM_DIR}/lib/cmake/libxml2-${LIBXML2_VERSION} -DBUILD_TYPE=Release - cmake --build ${LIBCELLML_WASM_DIR} - - name: Unit testing + cmake -G Ninja -DBINDINGS_PYTHON=OFF .. + - name: Documentation run: | cd build - cmake --build ${LIBCELLML_WASM_DIR} --target jest_test + ninja docs From c055c696f3d45fe5ae55460fa944c40b684715b5 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 22 Oct 2024 12:19:40 +1300 Subject: [PATCH 08/12] Make sure that we can find the version of llvm-cov that we installed. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 86d33ff01f..13c2affa03 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -197,7 +197,7 @@ jobs: - name: Install LLVM run: | brew install --overwrite llvm - brew info llvm + echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.bash_profile - name: Configure libCellML run: | mkdir build From 6c63b5c6c4a983e9bd0d5dbdb9bab2c8fa18671f Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 22 Oct 2024 12:41:01 +1300 Subject: [PATCH 09/12] CMake: use the PATH as a hint to find llvm-cov and llvm-profdata. Indeed, someone might have a version of llvm-cov and llvm-profdata that they use and which is not located in /Library/Developer/CommandLineTools/usr/bin. --- cmake/environmentchecks.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/environmentchecks.cmake b/cmake/environmentchecks.cmake index 59c61a3baf..4a66b37fab 100644 --- a/cmake/environmentchecks.cmake +++ b/cmake/environmentchecks.cmake @@ -48,8 +48,8 @@ else () find_program(DOT_EXE NAMES ${PREFERRED_FIND_NAMES} dot) find_program(FIND_EXE NAMES ${PREFERRED_FIND_NAMES} find) find_program(GCOV_EXE NAMES ${PREFERRED_GCOV_NAMES} gcov) - find_program(LLVM_COV_EXE NAMES ${PREFERRED_LLVM_COV_NAMES} llvm-cov HINTS ${LLVM_BIN_DIR} /Library/Developer/CommandLineTools/usr/bin/) - find_program(LLVM_PROFDATA_EXE NAMES ${PREFERRED_LLVM_PROFDATA_NAMES} llvm-profdata HINTS ${LLVM_BIN_DIR} /Library/Developer/CommandLineTools/usr/bin/) + find_program(LLVM_COV_EXE NAMES ${PREFERRED_LLVM_COV_NAMES} llvm-cov HINTS ${LLVM_BIN_DIR} ENV PATH /Library/Developer/CommandLineTools/usr/bin/) + find_program(LLVM_PROFDATA_EXE NAMES ${PREFERRED_LLVM_PROFDATA_NAMES} llvm-profdata HINTS ${LLVM_BIN_DIR} ENV PATH /Library/Developer/CommandLineTools/usr/bin/) find_program(VALGRIND_EXE NAMES ${PREFERRED_VALGRIND_NAMES} valgrind) find_program(INSTALL_NAME_TOOL_EXE NAMES ${PREFERRED_INSTALL_NAME_TOOL_NAMES} install_name_tool) From 62a53310665f0cc88c635d6d8e3457c24f811465 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 22 Oct 2024 12:41:15 +1300 Subject: [PATCH 10/12] CMake: let the user know where the coverage report can be found. --- tests/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index cf64a66c27..1dbf26da87 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -191,6 +191,7 @@ if(LIBCELLML_LLVM_COVERAGE) add_custom_target(llvm_coverage_report COMMAND ${LLVM_COV_EXE} show $ -instr-profile=${DATA_PROFILE_FILENAME} -format=html -Xdemangler c++filt -Xdemangler -n -o coverage_report --show-expansions --show-branches=count + COMMAND echo "The coverage report can be found at ${CMAKE_CURRENT_BINARY_DIR}/${COVERAGE_REPORT_DIR}coverage_report/index.html." DEPENDS prepare_llvm_coverage WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Running LLVM coverage missing lines command") From 81f7f8c29a3e9c27f3e0ae0cb750cec8d277c383 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 5 Nov 2024 15:00:50 +1300 Subject: [PATCH 11/12] Documentation: removed the need for dot. --- .github/workflows/ci.yml | 4 ---- cmake/environmentchecks.cmake | 2 -- docs/CMakeLists.txt | 2 +- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 13c2affa03..b7abf4e9f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -245,10 +245,6 @@ jobs: uses: lukka/get-cmake@latest - name: Install buildcache uses: mikehardy/buildcache-action@v2 - - name: Install dot - run: | - sudo apt update - sudo apt install graphviz - name: Install Doxygen run: | sudo apt update diff --git a/cmake/environmentchecks.cmake b/cmake/environmentchecks.cmake index 9da1d7810f..260b5c0ae4 100644 --- a/cmake/environmentchecks.cmake +++ b/cmake/environmentchecks.cmake @@ -46,7 +46,6 @@ else () endif() find_program(CLANG_FORMAT_EXE NAMES ${PREFERRED_CLANG_FORMAT_NAMES} clang-format) find_program(CLANG_TIDY_EXE NAMES ${PREFERRED_CLANG_TIDY_NAMES} clang-tidy) - find_program(DOT_EXE NAMES ${PREFERRED_FIND_NAMES} dot) find_program(FIND_EXE NAMES ${PREFERRED_FIND_NAMES} find) find_program(GCOV_EXE NAMES ${PREFERRED_GCOV_NAMES} gcov) find_program(LLVM_COV_EXE NAMES ${PREFERRED_LLVM_COV_NAMES} llvm-cov HINTS ${LLVM_BIN_DIR} ENV PATH /Library/Developer/CommandLineTools/usr/bin/) @@ -95,7 +94,6 @@ else () BUILDCACHE_EXE CLANG_TIDY_EXE CLANG_FORMAT_EXE - DOT_EXE FIND_EXE GCC_COVERAGE_COMPILER_FLAGS_OK GCOV_EXE diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 8498fc7b4a..4c05459a24 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -49,7 +49,7 @@ if(SPHINX_FOUND) COMMENT "Building HTML documentation with Sphinx") endif() -if(DOXYGEN_FOUND AND DOT_EXE) +if(DOXYGEN_FOUND) set(DOXYGEN_DOCS_TARGET api_docs) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in.config ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) add_custom_target(${DOXYGEN_DOCS_TARGET} From b19bdade7509a8fb941b4ed9dd944dbbfd73f631 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Tue, 5 Nov 2024 22:33:33 +1300 Subject: [PATCH 12/12] CMake: reverted the logic for the `docs` target. --- docs/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 4c05459a24..bab96399b3 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -76,7 +76,7 @@ if(LIBCELLML_COVERAGE) COMMENT "Running coverage tests with html output") endif() -if(SPHINX_FOUND AND DOXYGEN_FOUND AND LIBCELLML_COVERAGE) +if(SPHINX_FOUND OR DOXYGEN_FOUND OR LIBCELLML_COVERAGE) add_custom_target(docs DEPENDS ${SPHINX_DOCS_TARGET} ${DOXYGEN_DOCS_TARGET} ${COVERAGE_DOCS_TARGET} ${DOXYGEN_API_XML_DOCS_TARGET} COMMENT "Generating documentation")