Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# configuration for code coverage testing with codecov
coverage:
status:
project:
default:
informational: true
patch:
default:
informational: true
codecov:
token: ${{ secrets.CODECOV_TOKEN }}
17 changes: 17 additions & 0 deletions .github/workflows/codechecks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This workflow checks for compliance with the Google C++ style guide.
name: Codechecks
on: [push, pull_request]
jobs:
clang-format:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
brew install clang-format
- name: Run clang-format
run: |
mkdir Release
cd Release
cmake ..
make codecheck
30 changes: 30 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow builds and deploys the html documentation for svZeroDSolver.
name: Documentation
on: [push, pull_request]
permissions:
contents: write
jobs:
documentation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Make build directory
run: mkdir docs/build
- name: Build doxygen documentation
continue-on-error: false
uses: mattnotmitt/doxygen-action@edge
with:
working-directory: '.'
doxyfile-path: 'docs/Doxyfile'
enable-latex: true
- name: Save documentation
uses: actions/upload-artifact@v4
with:
name: documentation
path: ./docs/build/html
- name: Deploy documentation
if: github.ref == 'refs/heads/master'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/build/html
49 changes: 49 additions & 0 deletions .github/workflows/gui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# This workflow uses Cypress for end-to-end testing of the 0D model GUI.

name: GUI-tests

on: [push, pull_request]

jobs:
cypress-run:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Install dependencies
working-directory: tests/cypress
run: npm install

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10' # Use the Python version compatible with your Flask app

- name: Install Flask dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flask

- name: Start Flask Application
run: |
cd applications/svZeroDGUI
FLASK_APP=app.py flask run --host=0.0.0.0 --port=8902 &
env:
FLASK_ENV: development

- name: Run Cypress tests
uses: cypress-io/github-action@v5
with:
start: npm start
working-directory: tests/cypress
170 changes: 170 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
# This workflow builds and tests svZeroDSolver. It is built and tested on
# different versions of ubuntu and macOS.
name: Build and test
on: [push, pull_request]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-latest, macos-13, macos-latest, windows-latest]
version: [13] # GCC version
fail-fast: false
env:
GCC_V: ${{ matrix.version }}
CONDA_ENV: zerod
PYTHONPATH: ${{ github.workspace }}
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
activate-environment: ${{env.CONDA_ENV}}
python-version: "3.11.4"
- name: Install ubuntu dependencies
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt update && sudo apt install build-essential cmake lcov

- name: Install dependencies to get correct version numbers (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: conda install -c conda-forge libstdcxx-ng=${GCC_V} gcc=${GCC_V}

- name: Install dependencies to get correct version numbers (MacOS)
if: startsWith(matrix.os, 'macos')
run: |
brew install gcc@${GCC_V}
ln -s /usr/local/bin/gcc-${GCC_V} /usr/local/bin/gcc

- name: Install dependencies for windows
if: startsWith(matrix.os, 'windows')
shell: pwsh
run: |
choco install mingw --no-progress
conda install -y -c conda-forge cmake graphviz python-graphviz pydot
pip install --upgrade cmake-setuptools

- name: Install POISX-like svZeroDSolver
if: ${{!startsWith(matrix.os, 'windows')}}
run: conda run pip install -e ".[dev]"

- name: Install Windows svZeroDSolver
if: startsWith(matrix.os, 'windows')
shell: pwsh
run: |
$Env:CMAKE_GENERATOR = 'MinGW Makefiles'
Write-Host "→ Using CMAKE_GENERATOR = $Env:CMAKE_GENERATOR"
pip install --no-build-isolation -v .[dev]
pip show pysvzerod

- name: Install Networkx
run: |
conda run pip install networkx

- name: Test the build
run: |
cd tests
conda run pytest -v --durations=0 --ignore=test_dirgraph.py

- name: Build using CMake for POISX-like Systems
if: ${{!startsWith(matrix.os, 'windows')}}
run: |
mkdir Release
cd Release
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_DISTRIBUTION=ON ..
make -j2

- name: Build using CMake for Windows Systems
if: startsWith(matrix.os, 'windows')
shell: pwsh
run: |
mkdir Release
cd Release
cmake -G "MinGW Makefiles" `
-DCMAKE_BUILD_TYPE=Release `
-DENABLE_DISTRIBUTION=ON `
..
cmake --build . --parallel 2

- name: Test interface POISX-like Systems
if: ${{!startsWith(matrix.os, 'windows')}}
run: |
cd tests/test_interface
mkdir build_tests
cd build_tests
cmake ../
make -j2
cd test_01
./svZeroD_interface_test01 ../../../../Release ../../test_01/svzerod_3Dcoupling.json
cd ../test_02
./svZeroD_interface_test02 ../../../../Release ../../test_02/svzerod_tuned.json

- name: Test interface Windows Systems
if: startsWith(matrix.os, 'windows')
shell: pwsh
run: |
cd tests/test_interface
mkdir build_tests
cd build_tests
cmake -G "MinGW Makefiles" ..
cmake --build . --parallel 2
cd test_01
./svZeroD_interface_test01.exe `
../../../../Release `
../../test_01/svzerod_3Dcoupling.json

cd ../test_02
./svZeroD_interface_test02 `
../../../../Release `
../../test_02/svzerod_tuned.json

- name: Generate code coverage
if: startsWith(matrix.os, 'ubuntu-22.04')
run: |
cd Release
cmake -DENABLE_COVERAGE=ON ..
make -j2
cd ../tests
conda run pytest -v --durations=0 --coverage --ignore=test_dirgraph.py
cd ../Release
make coverage

- name: Save coverage report
if: startsWith(matrix.os, 'ubuntu-22.04')
uses: actions/upload-artifact@v4
with:
name: coverage_report
path: Release/coverage

- name: Upload coverage reports to Codecov
if: startsWith(matrix.os, 'ubuntu-22.04')
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Build installer POISX-like Systems
if: ${{!startsWith(matrix.os, 'windows')}}
run: |
cd Release
cpack
cp distribution/svZeroDSolver_* ..

- name: Install NSIS
if: startsWith(matrix.os, 'windows')
run: choco install nsis -y

- name: Build installer Windows Systems
if: startsWith(matrix.os, 'windows')
shell: pwsh
run: |
# NSIS will be at C:\Program Files (x86)\NSIS\Bin
echo "C:\Program Files (x86)\NSIS\Bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
cd Release
cpack -C Release
Copy-Item distribution\svZeroDSolver_* -Destination ..\

- name: Upload installer
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }} installer
path: svZeroDSolver_*
if-no-files-found: error
40 changes: 40 additions & 0 deletions .github/workflows/test_visualization.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Test Visualization Application

on: [push, pull_request]

jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}

steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r tests/requirements.txt

- name: Install Graphviz
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y graphviz

- name: Install Graphviz (macOS)
if: runner.os == 'macOS'
run: |
brew install graphviz

- name: Run tests
run: |
pytest tests/test_dirgraph.py
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,13 @@ endif()
# -----------------------------------------------------------------------------
# Eigen is a header-only C++ template library for linear algebra.
#
# Tell FetchContent not to re-check for updates once Eigen is downloaded
set(FETCHCONTENT_UPDATES_DISCONNECTED TRUE)

FetchContent_Declare(
Eigen
GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git
GIT_TAG master
GIT_TAG 3.4.0
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE)

Expand Down
9 changes: 4 additions & 5 deletions applications/pysvzerod.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-FileCopyrightText: Copyright (c) Stanford University, The Regents of the University of California, and others.
// SPDX-License-Identifier: BSD-3-Clause
// SPDX-FileCopyrightText: Copyright (c) Stanford University, The Regents of the
// University of California, and others. SPDX-License-Identifier: BSD-3-Clause
/**
* @file pysvzerod.cpp
* @brief Python interface for svZeroDSolver
Expand Down Expand Up @@ -65,9 +65,8 @@ PYBIND11_MODULE(pysvzerod, m) {
py::module_ sys = py::module_::import("sys");
auto argv = sys.attr("argv").cast<std::vector<std::string>>();
if (argv.size() != 3) {
std::cout
<< "Usage: svzerodsolver path/to/config.json path/to/output.csv"
<< std::endl;
std::cout << "Usage: svzerodsolver path/to/config.json path/to/output.csv"
<< std::endl;
exit(1);
}
std::ifstream ifs(argv[1]);
Expand Down
16 changes: 10 additions & 6 deletions applications/svzerodcalibrator.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-FileCopyrightText: Copyright (c) Stanford University, The Regents of the University of California, and others.
// SPDX-License-Identifier: BSD-3-Clause
// SPDX-FileCopyrightText: Copyright (c) Stanford University, The Regents of the
// University of California, and others. SPDX-License-Identifier: BSD-3-Clause
/**
* @file svzerodcalibrator.cpp
* @brief Main routine for svZeroDCalibrator
Expand All @@ -26,7 +26,8 @@ int main(int argc, char* argv[]) {
std::ifstream input_file(input_file_name);

if (!input_file.is_open()) {
std::cerr << "[svzerodcalibrator] Error: The input file '" << input_file_name << "' cannot be opened." << std::endl;
std::cerr << "[svzerodcalibrator] Error: The input file '"
<< input_file_name << "' cannot be opened." << std::endl;
return 1;
}

Expand All @@ -36,16 +37,19 @@ int main(int argc, char* argv[]) {
try {
output_config = calibrate(config);
} catch (const nlohmann::json::parse_error& e) {
std::cerr << "[svzerodcalibrator] Error: The input file '" << input_file_name
<< "' does not have the parameters needed by the calibrate program." << std::endl;
std::cerr
<< "[svzerodcalibrator] Error: The input file '" << input_file_name
<< "' does not have the parameters needed by the calibrate program."
<< std::endl;
return 1;
}

// Write optimized simulation config
std::ofstream out_file(output_file_name);

if (!out_file.is_open()) {
std::cerr << "[svzerodcalibrator] Error: The output file '" << output_file_name << "' cannot be opened." << std::endl;
std::cerr << "[svzerodcalibrator] Error: The output file '"
<< output_file_name << "' cannot be opened." << std::endl;
return 1;
}

Expand Down
Loading
Loading