Skip to content

Commit

Permalink
CI: added some "basic" GitHub Actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Oct 16, 2024
1 parent e35e4d9 commit 647e1c6
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 115 deletions.
254 changes: 143 additions & 111 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,133 +8,165 @@ on:
workflow_dispatch:

jobs:
cpp_python:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
# 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
# env:
# BUILDCACHE_ACCURACY: STRICT
# BUILDCACHE_COMPRESS_FORMAT: ZSTD
# BUILDCACHE_DEBUG: -1
# BUILDCACHE_LOG_FILE: ""
# 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: Run python_test_annotator (macOS only)
# if: ${{ runner.os == 'macOS' }}
# run: |
# cd build
# ctest -V -R python_test_annotator
# - name: Unit testing
# if: ${{ matrix.unit_tests == 'ON' }}
# 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
documentation:
name: Documentation
runs-on: ubuntu-latest
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
env:
BUILDCACHE_ACCURACY: STRICT
BUILDCACHE_COMPRESS_FORMAT: ZSTD
BUILDCACHE_DEBUG: -1
BUILDCACHE_LOG_FILE: ""
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: Run python_test_annotator (macOS only)
if: ${{ runner.os == 'macOS' }}
run: |
cd build
ctest -V -R python_test_annotator
- name: Unit testing
if: ${{ matrix.unit_tests == 'ON' }}
- name: Install dot
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
sudo apt update
sudo apt install graphviz
- name: Install Doxygen
run: |
sudo apt update
sudo apt install clang-format
- name: Install CMake and Ninja
uses: lukka/get-cmake@latest
sudo apt install doxygen
- name: Install Sphinx
run: |
pip3 install sphinx
- name: Configure libCellML
run: |
mkdir build
cd build
cmake -G Ninja ..
- name: Code formatting
- name: Documentation
run: |
cd build
ninja test_clang_format
ninja docs
2 changes: 2 additions & 0 deletions cmake/environmentchecks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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/)
Expand Down Expand Up @@ -93,6 +94,7 @@ else ()
BUILDCACHE_EXE
CLANG_TIDY_EXE
CLANG_FORMAT_EXE
DOT_EXE
FIND_EXE
GCC_COVERAGE_COMPILER_FLAGS_OK
GCOV_EXE
Expand Down
5 changes: 2 additions & 3 deletions docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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")
Expand All @@ -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()

2 changes: 1 addition & 1 deletion src/api/libcellml/generatorprofile.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 647e1c6

Please sign in to comment.