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
73 changes: 38 additions & 35 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
cpack
cp oneD*.pkg ../svOneDSolver-macOS.pkg
- name: Upload artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: macOS Installer
path: svOneDSolver-macOS.pkg
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
cpack
cp oneD*.deb ../svOneDSolver-Ubuntu.deb
- name: Upload artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Ubuntu Installer
path: svOneDSolver-Ubuntu.deb
Expand All @@ -81,38 +81,41 @@ jobs:
asset_name: svOneDSolver-${{github.ref_name}}-Ubuntu.deb
tag: ${{ github.ref }}

build-windows:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Cygwin
uses: cygwin/cygwin-install-action@master
with:
install-dir: C:\cygwin64
packages: make tcl zip gzip tar patch wget
- name: Install Visual Studio BuildTools
run: |
choco install visualstudio2017buildtools visualstudio2017-workload-vctools
- name: Build
run: |
cd BuildWithMake
dos2unix ./windows-build.sh
C:\cygwin64\bin\bash.exe -c "./build_windows_github.bat"
cp Release/sim*.msi ../svOneDSolver-Windows.msi
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: Windows Installer
path: svOneDSolver-Windows.msi
if-no-files-found: error
- name: Upload release asset
if: startsWith(github.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: svOneDSolver-Windows.msi
asset_name: svOneDSolver-${{github.ref_name}}-Windows.msi
tag: ${{ github.ref }}
# TODO: There's an issue for fixing the Windows build.
# Right now it's failing.
#
# build-windows:
# runs-on: windows-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: Install Cygwin
# uses: cygwin/cygwin-install-action@master
# with:
# install-dir: C:\cygwin64
# packages: make tcl zip gzip tar patch wget
# - name: Install Visual Studio BuildTools
# run: |
# choco install visualstudio2017buildtools visualstudio2017-workload-vctools
# - name: Build
# run: |
# cd BuildWithMake
# dos2unix ./windows-build.sh
# C:\cygwin64\bin\bash.exe -c "./build_windows_github.bat"
# cp Release/sim*.msi ../svOneDSolver-Windows.msi
# - name: Upload artifact
# uses: actions/upload-artifact@v4
# with:
# name: Windows Installer
# path: svOneDSolver-Windows.msi
# if-no-files-found: error
# - name: Upload release asset
# if: startsWith(github.ref, 'refs/tags/')
# uses: svenstaro/upload-release-action@v2
# with:
# repo_token: ${{ secrets.GITHUB_TOKEN }}
# file: svOneDSolver-Windows.msi
# asset_name: svOneDSolver-${{github.ref_name}}-Windows.msi
# tag: ${{ github.ref }}


8 changes: 6 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: build solver
shell: bash
run: |
Expand All @@ -19,4 +19,8 @@ jobs:
pip install numpy
- name: result tests
run: |
pytest
pytest Tests/SystemTests
- name: result unit tests
run: |
cd build_skyline
ctest
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ build
.cproject
.project
.settings/
.vscode/
74 changes: 72 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
CMAKE_MINIMUM_REQUIRED(VERSION 3.11)

# COMMON SETTINGS
PROJECT(OneDSolver)
Expand All @@ -9,6 +9,7 @@ ENABLE_LANGUAGE(C CXX)
OPTION(BUILD_SV_INSTALLER "Build SimVascular Installer" OFF)
OPTION(buildPy "Build Python Interface" OFF)
OPTION(buildDocs "Build Documentation" OFF)
OPTION(ENABLE_UNIT_TEST "Enable unit tests" ON)
SET(sparseSolverType "skyline" CACHE STRING "Use Sparse Solver")
SET_PROPERTY(CACHE sparseSolverType PROPERTY STRINGS skyline superlu csparse)

Expand Down Expand Up @@ -74,7 +75,7 @@ ENDIF()
# FILE(COPY "${CMAKE_CURRENT_SOURCE_DIR}/tests" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")

# COMPILER FLAGS
SET(CMAKE_CXX_FLAGS "-g -m64 -O3 -std=c++0x -fPIC")
SET(CMAKE_CXX_FLAGS "-g -m64 -O3 -std=c++20 -fPIC")

# PLACE EXECUTABLE IN BIN FOLDER
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
Expand Down Expand Up @@ -109,3 +110,72 @@ ENDIF()
if (BUILD_SV_INSTALLER)
add_subdirectory("${CMAKE_SOURCE_DIR}/Distribution")
ENDIF()

# Unit tests and Google Test
if(ENABLE_UNIT_TEST)

# Link pthread on ubuntu20
find_package(Threads REQUIRED)

# Install Google Test
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/refs/heads/main.zip
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
)
FetchContent_MakeAvailable(googletest)

enable_testing()
include(GoogleTest)

set(TESTBIN_DIRECTORY ${CMAKE_BINARY_DIR}/testbin)

# Copy test files into the build directory so tests can access them
file(GLOB TEST_FILES "${CMAKE_CURRENT_SOURCE_DIR}/Tests/UnitTests/TestFiles/*")
foreach(TEST_FILE ${TEST_FILES})
# Print the file being copied for debugging
file(COPY ${TEST_FILE} DESTINATION ${TESTBIN_DIRECTORY}/TestFiles/)
endforeach()

# For now, we're filtering out "main" so we can include all the
# other source files in the same way as the main executable.
#
# It would probably be better if we refactored to avoid including
# main in the overall list of source files. Instead, we could just
# include main only when we're building the executable. That could
# be a good first refactoring to avoid this hacky post-processing
# step.
set(SRC_C_FOR_TESTS ${SRC_C})
list(FILTER SRC_C_FOR_TESTS EXCLUDE REGEX "Source/main.cxx")

set(SRC_H_FOR_TESTS ${SRC_H})
list(FILTER SRC_H_FOR_TESTS EXCLUDE REGEX "Source/main.h")

# Find all .cpp files in the UnitTests folder and subfolders
file(GLOB TEST_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/Tests/UnitTests/*.cxx")

# Combine all test files into a single list
add_executable(UnitTestsExecutable ${TEST_SOURCES} ${SRC_C_FOR_TESTS} ${SRC_H_FOR_TESTS})

# For some solvers, we may need to link against additional libraries here.
# When we bump up against unit tests that require that, we should consider
# changing the strategy for how we generate executables in cmakelists to
# handle both use cases.
target_link_libraries(UnitTestsExecutable gtest gtest_main pthread)

# It's likely we'll need to include additional directories for some
# versions of the unit tests. That can be updated when/if we update
# the general strategy.
target_include_directories(UnitTestsExecutable PRIVATE ${SRCS_DIR})

# Set the output directory for the executable
set_target_properties(UnitTestsExecutable PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${TESTBIN_DIRECTORY}
)

# Add the test to CTest, we're setting the working directory to testbin
# because we're copying the input files there for now
add_test(NAME UnitTests COMMAND UnitTestsExecutable WORKING_DIRECTORY ${TESTBIN_DIRECTORY})

endif()
Loading