Simulation: have simulation tasks run in their own thread #3075
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| ci: | |
| name: ${{ matrix.name }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: 'Windows static library (Intel)' | |
| os: windows-2022 | |
| arch: amd64 | |
| build_type: Release | |
| code_analysis: OFF | |
| code_coverage: OFF | |
| documentation: OFF | |
| javascript_support: OFF | |
| memory_checks: OFF | |
| python_support: OFF | |
| shared_libs: OFF | |
| unit_testing: ON | |
| target: unit_testing | |
| install_uninstall_and_package: ON | |
| install_prefix: cmake | |
| - name: 'Windows shared library (Intel)' | |
| os: windows-2022 | |
| arch: amd64 | |
| build_type: Release | |
| code_analysis: OFF | |
| code_coverage: OFF | |
| documentation: OFF | |
| javascript_support: OFF | |
| memory_checks: OFF | |
| python_support: OFF | |
| shared_libs: ON | |
| unit_testing: ON | |
| target: unit_testing | |
| install_uninstall_and_package: ON | |
| install_prefix: cmake | |
| copy_dll: ON | |
| - name: 'Windows static library (ARM)' | |
| os: windows-11-arm | |
| arch: amd64_arm64 | |
| build_type: Release | |
| code_analysis: OFF | |
| code_coverage: OFF | |
| documentation: OFF | |
| javascript_support: OFF | |
| memory_checks: OFF | |
| python_support: OFF | |
| shared_libs: OFF | |
| unit_testing: ON | |
| target: unit_testing | |
| install_uninstall_and_package: ON | |
| install_prefix: cmake | |
| - name: 'Windows shared library (ARM)' | |
| os: windows-11-arm | |
| arch: amd64_arm64 | |
| build_type: Release | |
| code_analysis: OFF | |
| code_coverage: OFF | |
| documentation: OFF | |
| javascript_support: OFF | |
| memory_checks: OFF | |
| python_support: OFF | |
| shared_libs: ON | |
| unit_testing: ON | |
| target: unit_testing | |
| install_uninstall_and_package: ON | |
| install_prefix: cmake | |
| copy_dll: ON | |
| - name: 'Linux static library (Intel)' | |
| os: ubuntu-24.04 | |
| build_type: Release | |
| code_analysis: OFF | |
| code_coverage: OFF | |
| documentation: OFF | |
| javascript_support: OFF | |
| memory_checks: OFF | |
| python_support: OFF | |
| shared_libs: OFF | |
| unit_testing: ON | |
| target: unit_testing | |
| install_uninstall_and_package: ON | |
| install_prefix: lib/cmake | |
| context: CC=gcc-14 CXX=g++-14 | |
| - name: 'Linux shared library (Intel)' | |
| os: ubuntu-24.04 | |
| build_type: Release | |
| code_analysis: OFF | |
| code_coverage: OFF | |
| documentation: OFF | |
| javascript_support: OFF | |
| memory_checks: OFF | |
| python_support: OFF | |
| shared_libs: ON | |
| unit_testing: ON | |
| target: unit_testing | |
| install_uninstall_and_package: ON | |
| install_prefix: lib/cmake | |
| - name: 'Linux static library (ARM)' | |
| os: ubuntu-24.04-arm | |
| build_type: Release | |
| code_analysis: OFF | |
| code_coverage: OFF | |
| documentation: OFF | |
| javascript_support: OFF | |
| memory_checks: OFF | |
| python_support: OFF | |
| shared_libs: OFF | |
| unit_testing: ON | |
| target: unit_testing | |
| install_uninstall_and_package: ON | |
| install_prefix: lib/cmake | |
| context: CC=gcc-14 CXX=g++-14 | |
| - name: 'Linux shared library (ARM)' | |
| os: ubuntu-24.04-arm | |
| build_type: Release | |
| code_analysis: OFF | |
| code_coverage: OFF | |
| documentation: OFF | |
| javascript_support: OFF | |
| memory_checks: OFF | |
| python_support: OFF | |
| shared_libs: ON | |
| unit_testing: ON | |
| target: unit_testing | |
| install_uninstall_and_package: ON | |
| install_prefix: lib/cmake | |
| - name: 'macOS static library (Intel)' | |
| os: macos-15-intel | |
| build_type: Release | |
| code_analysis: OFF | |
| code_coverage: OFF | |
| documentation: OFF | |
| javascript_support: OFF | |
| memory_checks: OFF | |
| python_support: OFF | |
| shared_libs: OFF | |
| unit_testing: ON | |
| target: unit_testing | |
| install_uninstall_and_package: ON | |
| install_prefix: lib/cmake | |
| - name: 'macOS shared library (Intel)' | |
| os: macos-15-intel | |
| build_type: Release | |
| code_analysis: OFF | |
| code_coverage: OFF | |
| documentation: OFF | |
| javascript_support: OFF | |
| memory_checks: OFF | |
| python_support: OFF | |
| shared_libs: ON | |
| unit_testing: ON | |
| target: unit_testing | |
| install_uninstall_and_package: ON | |
| install_prefix: lib/cmake | |
| - name: 'macOS static library (ARM)' | |
| os: macos-15 | |
| build_type: Release | |
| code_analysis: OFF | |
| code_coverage: OFF | |
| documentation: OFF | |
| javascript_support: OFF | |
| memory_checks: OFF | |
| python_support: OFF | |
| shared_libs: OFF | |
| unit_testing: ON | |
| target: unit_testing | |
| install_uninstall_and_package: ON | |
| install_prefix: lib/cmake | |
| - name: 'macOS shared library (ARM)' | |
| os: macos-15 | |
| build_type: Release | |
| code_analysis: OFF | |
| code_coverage: OFF | |
| documentation: OFF | |
| javascript_support: OFF | |
| memory_checks: OFF | |
| python_support: OFF | |
| shared_libs: ON | |
| unit_testing: ON | |
| target: unit_testing | |
| install_uninstall_and_package: ON | |
| install_prefix: lib/cmake | |
| - name: 'JavaScript bindings' | |
| os: ubuntu-24.04 | |
| build_type: Release | |
| code_analysis: OFF | |
| code_coverage: OFF | |
| documentation: OFF | |
| javascript_support: ON | |
| memory_checks: OFF | |
| python_support: OFF | |
| shared_libs: OFF | |
| unit_testing: OFF | |
| target: javascript_unit_testing | |
| - name: 'Windows Python bindings' | |
| os: windows-2022 | |
| arch: amd64 | |
| build_type: Release | |
| code_analysis: OFF | |
| code_coverage: OFF | |
| documentation: OFF | |
| javascript_support: OFF | |
| memory_checks: OFF | |
| python_support: ON | |
| shared_libs: OFF | |
| unit_testing: OFF | |
| target: python_unit_testing | |
| pip_install_test_and_uninstall: ON | |
| - name: 'Linux Python bindings' | |
| os: ubuntu-24.04 | |
| build_type: Release | |
| code_analysis: OFF | |
| code_coverage: OFF | |
| documentation: OFF | |
| javascript_support: OFF | |
| memory_checks: OFF | |
| python_support: ON | |
| shared_libs: OFF | |
| unit_testing: OFF | |
| target: python_unit_testing | |
| pip_install_test_and_uninstall: ON | |
| - name: 'macOS Python bindings' | |
| os: macos-15 | |
| build_type: Release | |
| code_analysis: OFF | |
| code_coverage: OFF | |
| documentation: OFF | |
| javascript_support: OFF | |
| memory_checks: OFF | |
| python_support: ON | |
| shared_libs: OFF | |
| unit_testing: OFF | |
| context: PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:$PATH | |
| target: python_unit_testing | |
| pip_install_prerequisites: sudo uv pip install --system cmake scikit-build | |
| pip_install_test_and_uninstall: ON | |
| - name: 'Code formatting' | |
| os: ubuntu-24.04 | |
| build_type: Release | |
| code_analysis: OFF | |
| code_coverage: OFF | |
| documentation: OFF | |
| javascript_support: OFF | |
| memory_checks: OFF | |
| python_support: OFF | |
| shared_libs: OFF | |
| unit_testing: OFF | |
| context: PATH=$GITHUB_WORKSPACE:$PATH | |
| target: check_code_formatting | |
| - name: 'JavaScript code formatting' | |
| os: ubuntu-24.04 | |
| build_type: Release | |
| code_analysis: OFF | |
| code_coverage: OFF | |
| documentation: OFF | |
| javascript_support: OFF | |
| memory_checks: OFF | |
| python_support: OFF | |
| shared_libs: OFF | |
| unit_testing: OFF | |
| target: javascript_check_code_formatting | |
| - name: 'Python code formatting' | |
| os: ubuntu-24.04 | |
| build_type: Release | |
| code_analysis: OFF | |
| code_coverage: OFF | |
| documentation: OFF | |
| javascript_support: OFF | |
| memory_checks: OFF | |
| python_support: OFF | |
| shared_libs: OFF | |
| unit_testing: OFF | |
| target: python_check_code_formatting | |
| - name: 'Code analysis' | |
| os: ubuntu-24.04 | |
| build_type: Release | |
| code_analysis: ON | |
| code_coverage: OFF | |
| documentation: OFF | |
| javascript_support: OFF | |
| memory_checks: OFF | |
| python_support: OFF | |
| shared_libs: OFF | |
| unit_testing: ON | |
| context: PATH=$GITHUB_WORKSPACE:$PATH CC=/usr/local/bin/clang CXX=/usr/local/bin/clang++ | |
| - name: 'Code coverage' | |
| os: macos-15 | |
| build_type: Release | |
| code_analysis: OFF | |
| code_coverage: ON | |
| documentation: OFF | |
| javascript_support: OFF | |
| memory_checks: OFF | |
| python_support: OFF | |
| shared_libs: ON | |
| unit_testing: ON | |
| context: PATH=/opt/homebrew/opt/llvm/bin:$PATH CC=/opt/homebrew/opt/llvm/bin/clang CXX=/opt/homebrew/opt/llvm/bin/clang++ | |
| target: code_coverage | |
| - name: 'Memory checks' | |
| os: macos-15 | |
| build_type: Debug | |
| code_analysis: OFF | |
| code_coverage: OFF | |
| documentation: OFF | |
| javascript_support: OFF | |
| memory_checks: ON | |
| python_support: OFF | |
| shared_libs: ON | |
| unit_testing: ON | |
| target: memory_checks | |
| - name: 'Documentation' | |
| os: ubuntu-24.04 | |
| build_type: Release | |
| code_analysis: OFF | |
| code_coverage: OFF | |
| documentation: ON | |
| javascript_support: OFF | |
| memory_checks: OFF | |
| python_support: OFF | |
| shared_libs: OFF | |
| unit_testing: OFF | |
| target: documentation | |
| env: | |
| BUILDCACHE_ACCURACY: STRICT | |
| BUILDCACHE_COMPRESS_FORMAT: ZSTD | |
| BUILDCACHE_DEBUG: -1 | |
| BUILDCACHE_LOG_FILE: "" | |
| steps: | |
| - name: Set the timezone to New Zealand | |
| uses: szenius/set-timezone@v2.0 | |
| with: | |
| timezoneWindows: 'New Zealand Standard Time' | |
| timezoneLinux: 'Pacific/Auckland' | |
| timezoneMacos: 'Pacific/Auckland' | |
| - name: Check out libOpenCOR | |
| uses: actions/checkout@v4 | |
| - name: Install Python | |
| if: ${{ matrix.documentation == 'ON' || matrix.python_support == 'ON' || matrix.target == 'python_check_code_formatting' }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install CMake and Ninja | |
| uses: lukka/get-cmake@latest | |
| - name: Install buildcache | |
| uses: opencor/buildcache-action@v1 | |
| with: | |
| cache_key: ci-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.code_analysis }}-${{ matrix.code_coverage }}-${{ matrix.documentation }}-${{ matrix.javascript_support }}-${{ matrix.memory_checks }}-${{ matrix.python_support }}-${{ matrix.shared_libs }}-${{ matrix.unit_testing }}-${{ matrix.target }} | |
| - name: Configure MSVC | |
| if: ${{ runner.os == 'Windows' }} | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| with: | |
| arch: ${{ matrix.arch }} | |
| - name: Install GCC 14 | |
| if: ${{ runner.os == 'Linux' }} | |
| run: | | |
| sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-14 g++-14 | |
| - name: Install LLVM | |
| if: ${{ matrix.code_coverage == 'ON' }} | |
| run: brew install llvm | |
| - name: Install LLVM+Clang tools | |
| if: ${{ matrix.code_analysis == 'ON' }} | |
| run: | | |
| wget https://github.com/opencor/gha/releases/download/gha/clang.tar.gz -O - | tar -xz | |
| sudo mv clang /usr/local/bin | |
| sudo cp /usr/local/bin/clang /usr/local/bin/clang++ | |
| wget https://github.com/opencor/gha/releases/download/gha/clang-include.tar.gz -O - | tar -xz | |
| sudo mv include/* /usr/local/include | |
| wget https://github.com/opencor/gha/releases/download/gha/clang-format.tar.gz -O - | tar -xz | |
| sudo mv clang-format /usr/local/bin | |
| wget https://github.com/opencor/gha/releases/download/gha/clang-tidy.tar.gz -O - | tar -xz | |
| sudo mv clang-tidy /usr/local/bin | |
| wget https://github.com/opencor/gha/releases/download/gha/llvm-ar.tar.gz -O - | tar -xz | |
| sudo mv llvm-ar /usr/local/bin | |
| wget https://github.com/opencor/gha/releases/download/gha/llvm-ranlib.tar.gz -O - | tar -xz | |
| sudo mv llvm-ranlib /usr/local/bin | |
| - name: Install Emscripten | |
| if: ${{ matrix.javascript_support == 'ON' }} | |
| uses: mymindstorm/setup-emsdk@v14 | |
| - name: Install Biome | |
| if: ${{ matrix.target == 'javascript_check_code_formatting' }} | |
| run: | | |
| curl -L https://github.com/biomejs/biome/releases/latest/download/biome-linux-x64 -o biome | |
| chmod +x biome | |
| mv biome /usr/local/bin | |
| - name: Install uv | |
| if: ${{ matrix.documentation == 'ON' || matrix.python_support == 'ON' || matrix.target == 'python_check_code_formatting' }} | |
| uses: astral-sh/setup-uv@v6 | |
| - name: Install Ruff | |
| if: ${{ matrix.target == 'python_check_code_formatting' }} | |
| run: uv pip install --system ruff | |
| - name: Install pytest and pytest-html | |
| if: ${{ matrix.python_support == 'ON' }} | |
| run: uv pip install --system pytest pytest-html | |
| - name: Install Sphinx and some Sphinx packages | |
| if: ${{ matrix.documentation == 'ON' }} | |
| run: uv pip install --system sphinx~=8.0 sphinx-copybutton sphinx-inline-tabs | |
| - name: Install NumPy | |
| if: ${{ matrix.python_support == 'ON' }} | |
| run: uv pip install --system numpy | |
| - name: Install Doxygen | |
| if: ${{ matrix.documentation == 'ON' }} | |
| run: | | |
| wget https://github.com/opencor/gha/releases/download/gha/doxygen.tar.gz -O - | tar -xz | |
| sudo mv doxygen /usr/local/bin | |
| - name: Configure libOpenCOR | |
| shell: bash | |
| run: | | |
| if [ '${{ matrix.install_prefix }}' != '' ]; then export D_INSTALL_PREFIX='-DINSTALL_PREFIX=${{ github.workspace }}/install'; fi | |
| ${{ matrix.context }} cmake -G Ninja -S . -B build -DBUILD_TYPE=${{ matrix.build_type }} -DCODE_ANALYSIS=${{ matrix.code_analysis }} -DCODE_COVERAGE=${{ matrix.code_coverage }} -DDOCUMENTATION=${{ matrix.documentation }} $D_INSTALL_PREFIX -DJAVASCRIPT_BINDINGS=${{ matrix.javascript_support }} -DJAVASCRIPT_UNIT_TESTING=${{ matrix.javascript_support }} -DMEMORY_CHECKS=${{ matrix.memory_checks }} -DPYTHON_BINDINGS=${{ matrix.python_support }} -DPYTHON_UNIT_TESTING=${{ matrix.python_support }} -DSHARED_LIBS=${{ matrix.shared_libs }} -DUNIT_TESTING=${{ matrix.unit_testing }} | |
| - name: Build libOpenCOR | |
| if: ${{ (matrix.install_uninstall_and_package == 'ON') || (matrix.javascript_support == 'ON') || (matrix.python_support == 'ON') }} | |
| run: cmake --build build | |
| - name: Unit testing | |
| if: ${{ (matrix.unit_testing == 'ON') && (matrix.code_analysis == 'OFF') && (matrix.code_coverage == 'OFF') && (matrix.memory_checks == 'OFF') }} | |
| run: cmake --build build --target ${{ matrix.target }} | |
| - name: JavaScript unit testing | |
| if: ${{ matrix.javascript_support == 'ON' }} | |
| run: cmake --build build --target ${{ matrix.target }} | |
| - name: Python unit testing | |
| if: ${{ matrix.python_support == 'ON' }} | |
| run: cmake --build build --target ${{ matrix.target }} | |
| - name: Python unit testing report | |
| if: ${{ matrix.python_support == 'ON' }} | |
| run: cmake --build build --target ${{ matrix.target }}_report | |
| - name: Code formatting | |
| if: ${{ matrix.target == 'check_code_formatting' }} | |
| run: cmake --build build --target ${{ matrix.target }} | |
| - name: JavaScript code formatting | |
| if: ${{ matrix.target == 'javascript_check_code_formatting' }} | |
| run: cmake --build build --target ${{ matrix.target }} | |
| - name: Python code formatting | |
| if: ${{ matrix.target == 'python_check_code_formatting' }} | |
| run: cmake --build build --target ${{ matrix.target }} | |
| - name: Code analysis | |
| if: ${{ matrix.name == 'Code analysis' }} | |
| run: cmake --build build | |
| - name: Code coverage | |
| if: ${{ matrix.code_coverage == 'ON' }} | |
| run: | | |
| cmake --build build --target ${{ matrix.target }} | |
| if [ `cmake --build build --target ${{ matrix.target }} | grep TOTAL | sed 's/ /\n/g' | grep "100.00%" | wc -l | sed 's/ //g'` -eq 4 ]; then exit 0; else exit 1; fi | |
| - name: Code coverage report | |
| if: ${{ matrix.code_coverage == 'ON' }} | |
| run: cmake --build build --target ${{ matrix.target }}_report | |
| - name: Memory checks | |
| if: ${{ matrix.memory_checks == 'ON' }} | |
| run: cmake --build build --target ${{ matrix.target }} | |
| - name: Documentation | |
| if: ${{ matrix.documentation == 'ON' }} | |
| run: cmake --build build --target ${{ matrix.target }} | |
| - name: Install libOpenCOR | |
| if: ${{ matrix.install_uninstall_and_package == 'ON' }} | |
| run: cmake --build build --target install | |
| - name: Test libOpenCOR | |
| if: ${{ matrix.install_uninstall_and_package == 'ON' }} | |
| shell: bash | |
| run: | | |
| cd tests/install | |
| if [ '${{ matrix.install_prefix }}' != '' ]; then export D_CMAKE_PREFIX_PATH='-DCMAKE_PREFIX_PATH=${{ github.workspace }}/install/${{ matrix.install_prefix }}'; fi | |
| cmake -G Ninja -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} $D_CMAKE_PREFIX_PATH | |
| cmake --build build | |
| if [ '${{ matrix.copy_dll }}' == 'ON' ]; then cp "${{ github.workspace }}/install/bin/libOpenCOR.dll" build; fi | |
| build/testInstall | |
| - name: Uninstall libOpenCOR | |
| if: ${{ matrix.install_uninstall_and_package == 'ON' }} | |
| run: cmake --build build --target uninstall | |
| - name: Package libOpenCOR | |
| if: ${{ matrix.install_uninstall_and_package == 'ON' }} | |
| run: | | |
| cd build | |
| cpack | |
| - name: pip install libOpenCOR | |
| if: ${{ matrix.pip_install_test_and_uninstall == 'ON' }} | |
| run: | | |
| ${{ matrix.pip_install_prerequisites }} | |
| uv pip install --system . | |
| - name: Test libOpenCOR Python | |
| if: ${{ matrix.pip_install_test_and_uninstall == 'ON' }} | |
| run: | | |
| cd tests/install/bindings/python | |
| python3 test_install.py | |
| - name: pip uninstall libOpenCOR | |
| if: ${{ matrix.pip_install_test_and_uninstall == 'ON' }} | |
| run: uv pip uninstall --system libopencor | |
| spell_check: | |
| name: Spell check | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Set the timezone to New Zealand | |
| uses: szenius/set-timezone@v2.0 | |
| with: | |
| timezoneLinux: 'Pacific/Auckland' | |
| - name: Check out libOpenCOR | |
| uses: actions/checkout@v4 | |
| - name: Spell check | |
| uses: codespell-project/actions-codespell@v2 | |
| with: | |
| check_filenames: true | |
| skip: ./extern | |
| exclude_file: .codespellexclude |