Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

178 examples should run entirely by default unless flags are given #424

Merged
Show file tree
Hide file tree
Changes from 3 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
194 changes: 156 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ jobs:

###############################################################################

Windows:
Windows-build:
runs-on: windows-latest
env:
VCPKG_DEFAULT_TRIPLET: x64-windows
Expand All @@ -262,6 +262,7 @@ jobs:
run: |
choco install ccache
choco install ninja
choco install 7zip

- uses: hendrikmuhs/ccache-action@v1.2
with:
Expand Down Expand Up @@ -300,46 +301,100 @@ jobs:
- name: Build
run: cmake.exe --build C:\build --config Release --verbose

- name: Test with the first try
id: first-try
run: |
cd C:\build
ctest.exe --output-on-failure
continue-on-error: true

- name: Test with the second try for failed cases
id: second-try
if: ${{ steps.first-try.outcome == 'failure' }}
run: |
cd C:\build
ctest.exe --rerun-failed --output-on-failure
continue-on-error: true

- name: Test with the third try for failed cases
id: third-try
if: ${{ steps.second-try.outcome == 'failure' }}
run: |
cd C:\build
ctest.exe --rerun-failed --output-on-failure
continue-on-error: true

- name: Test with the fourth try for failed cases
id: fourth-try
if: ${{ steps.third-try.outcome == 'failure' }}
run: |
cd C:\build
ctest.exe --rerun-failed --output-on-failure
continue-on-error: true
- name: Zip build folder
run: 7z.exe a C:\build.7z "C:\build"

- name: Test with the last try for failed cases
if: ${{ steps.fourth-try.outcome == 'failure' }}
run: |
cd C:\build
ctest.exe --rerun-failed --output-on-failure
- uses: actions/upload-artifact@v3
with:
name: Windows-build
path: C:\build.7z
if-no-files-found: error
retention-days: 1

Windows-test:
needs: Windows-build
runs-on: windows-latest
env:
VCPKG_DEFAULT_TRIPLET: x64-windows

steps:
- uses: actions/checkout@v3 # Checks-out the repository under ${{github.workspace}}

- name: Update ccache and ninja # For correct caching with ccache on Windows
shell: bash
run: |
choco install ccache
choco install ninja
choco install 7zip

- uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.job }}

- uses: friendlyanon/setup-vcpkg@v1 # Setup vcpkg into ${{github.workspace}}
with:
committish: ${{ env.VCPKG_VERSION }}
cache-version: ${{env.VCPKG_VERSION}}

- name: Install dependencies
run: |
${{github.workspace}}\vcpkg\vcpkg.exe install --clean-after-build `
eigen3 `
tbb `
boost-program-options `
boost-geometry `
simbody `
gtest `
xsimd `
pybind11

- uses: actions/download-artifact@v3
with:
name: Windows-build
Xiangyu-Hu marked this conversation as resolved.
Show resolved Hide resolved

- name: Unzip build folder
run: 7z.exe e C:\build.7z

- name: Test with the first try
id: first-try
run: |
cd C:\build
ctest.exe --output-on-failure
continue-on-error: true

- name: Test with the second try for failed cases
id: second-try
if: ${{ steps.first-try.outcome == 'failure' }}
run: |
cd C:\build
ctest.exe --rerun-failed --output-on-failure
continue-on-error: true

- name: Test with the third try for failed cases
id: third-try
if: ${{ steps.second-try.outcome == 'failure' }}
run: |
cd C:\build
ctest.exe --rerun-failed --output-on-failure
continue-on-error: true

- name: Test with the fourth try for failed cases
id: fourth-try
if: ${{ steps.third-try.outcome == 'failure' }}
run: |
cd C:\build
ctest.exe --rerun-failed --output-on-failure
continue-on-error: true

- name: Test with the last try for failed cases
if: ${{ steps.fourth-try.outcome == 'failure' }}
run: |
cd C:\build
ctest.exe --rerun-failed --output-on-failure

###############################################################################

macOS:
macOS-build:
runs-on: macos-12
env:
VCPKG_DEFAULT_TRIPLET: x64-osx
Expand All @@ -358,7 +413,9 @@ jobs:
pkg-config `# for installing libraries with vcpkg`\
git \
cmake \
ninja
ninja \
zip \
unzip

- uses: hendrikmuhs/ccache-action@v1.2
with:
Expand Down Expand Up @@ -397,6 +454,67 @@ jobs:
- name: Build
run: cmake --build build --config Release --verbose

- name: Zip build folder
run: zip -r build.zip ./build

- uses: actions/upload-artifact@v3
with:
name: Linux-build
Xiangyu-Hu marked this conversation as resolved.
Show resolved Hide resolved
path: ${{github.workspace}}/build.zip
if-no-files-found: error
retention-days: 1

macOS-test:
needs: macOS-build
runs-on: macos-12
env:
VCPKG_DEFAULT_TRIPLET: x64-osx

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

- name: Install system dependencies
run: |
brew reinstall gfortran # to force having gfortran on PATH because github runners don't have it, just the versioned aliases, i.e. gfortran-11
# https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md
# https://github.com/actions/runner-images/issues/3371#issuecomment-839882565
# https://github.com/modflowpy/install-gfortran-action and https://github.com/awvwgk/setup-fortran
brew install \
pkg-config `# for installing libraries with vcpkg`\
git \
cmake \
ninja

- uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.job }}

- uses: friendlyanon/setup-vcpkg@v1 # Setup vcpkg into ${{github.workspace}}
with:
committish: ${{ env.VCPKG_VERSION }}
cache-version: ${{env.VCPKG_VERSION}}

- name: Install dependencies
run: |
${{github.workspace}}/vcpkg/vcpkg install --clean-after-build --allow-unsupported \
eigen3 \
tbb \
boost-program-options \
boost-geometry \
gtest \
simbody \
xsimd \
pybind11 \
opencascade

- uses: actions/download-artifact@v3
with:
name: Linux-build
Xiangyu-Hu marked this conversation as resolved.
Show resolved Hide resolved

- name: Unzip build folder
run: unzip build.zip

- name: Test with the first try
id: first-try
run: |
Expand Down
12 changes: 6 additions & 6 deletions PythonScriptStore/RegressionTest/regression_test_base_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ def compile_case(self) -> None:

def run_particle_relaxation(self) -> None:
print('Start particle relaxation for the simulation...')
command = f".{os.sep}{self.sphinxsys_case_name} --r=true"
command = f".{os.sep}{self.sphinxsys_case_name} --relax=true"
os.system(self.enter_sphinxsys_exec_folder)
os.system(command)
print('Simulating case is finished...')

def run_case(self) -> None:
print('Start case simulation...')
print(self.enter_sphinxsys_exec_folder)
command = f".{os.sep}{self.sphinxsys_case_name} --r=false --rt=true"
command = f".{os.sep}{self.sphinxsys_case_name} --regression=true"
os.system(self.enter_sphinxsys_exec_folder)
os.system(command)
print('Simulating case is finished...')

def run_case_with_reload(self) -> None:
print('Start case simulation with particle reload...')
print(self.enter_sphinxsys_exec_folder)
command = f".{os.sep}{self.sphinxsys_case_name} --r=false --i=true --rt=true"
command = f".{os.sep}{self.sphinxsys_case_name} --reload=true --regression=true"
os.system(self.enter_sphinxsys_exec_folder)
os.system(command)
print('Simulating case is finished...')
Expand Down Expand Up @@ -96,23 +96,23 @@ def copy_reload(self) -> None:

def run_particle_relaxation(self) -> None:
print('Start particle relaxation for the simulation...')
command = f".{os.sep}{self.sphinxsys_case_name} --r=true"
command = f".{os.sep}{self.sphinxsys_case_name} --relax=true"
os.chdir(self.sphinxsys_exec_path)
os.system(command)
print('Simulating case is finished...')

def run_case(self) -> None:
print('Start case simulation...')
print(self.enter_sphinxsys_exec_folder)
command = f".{os.sep}{self.sphinxsys_case_name} --r=false --rt=true"
command = f".{os.sep}{self.sphinxsys_case_name} --regression=true"
os.chdir(self.sphinxsys_exec_path)
os.system(command)
print('Simulating case is finished...')

def run_case_with_reload(self) -> None:
print('Start case simulation with particle reload...')
print(self.enter_sphinxsys_exec_folder)
command = f".{os.sep}{self.sphinxsys_case_name} --r=false --i=true --rt=true"
command = f".{os.sep}{self.sphinxsys_case_name} --reload=true --regression=true"
os.chdir(self.sphinxsys_exec_path)
os.system(command)
print('Simulating case is finished...')
Expand Down
24 changes: 12 additions & 12 deletions src/shared/sphinxsys_system/sph_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ void SPHSystem::handleCommandlineOptions(int ac, char *av[])

po::options_description desc("Allowed options");
desc.add_options()("help", "produce help message");
desc.add_options()("r", po::value<bool>(), "Particle relaxation.");
desc.add_options()("i", po::value<bool>(), "Particle reload from input file.");
desc.add_options()("rt", po::value<bool>(), "Regression test.");
desc.add_options()("relax", po::value<bool>(), "Particle relaxation.");
desc.add_options()("reload", po::value<bool>(), "Particle reload from input file.");
desc.add_options()("regression", po::value<bool>(), "Regression test.");
desc.add_options()("state_recording", po::value<bool>(), "State recording in output folder.");
desc.add_options()("restart_step", po::value<int>(), "Run form a restart file.");

Expand All @@ -70,35 +70,35 @@ void SPHSystem::handleCommandlineOptions(int ac, char *av[])
exit(0);
}

if (vm.count("r"))
if (vm.count("relax"))
{
run_particle_relaxation_ = vm["r"].as<bool>();
run_particle_relaxation_ = vm["relax"].as<bool>();
std::cout << "Particle relaxation was set to "
<< vm["r"].as<bool>() << ".\n";
<< vm["relax"].as<bool>() << ".\n";
}
else
{
std::cout << "Particle relaxation was set to default ("
<< run_particle_relaxation_ << ").\n";
}

if (vm.count("i"))
if (vm.count("reload"))
{
reload_particles_ = vm["i"].as<bool>();
reload_particles_ = vm["reload"].as<bool>();
std::cout << "Particle reload from input file was set to "
<< vm["i"].as<bool>() << ".\n";
<< vm["reload"].as<bool>() << ".\n";
}
else
{
std::cout << "Particle reload from input file was set to default ("
<< reload_particles_ << ").\n";
}

if (vm.count("rt"))
if (vm.count("regression"))
{
generate_regression_data_ = vm["rt"].as<bool>();
generate_regression_data_ = vm["regression"].as<bool>();
std::cout << "Generate regression test data set was set to "
<< vm["rt"].as<bool>() << ".\n";
<< vm["regression"].as<bool>() << ".\n";
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion tests/2d_examples/test_2d_airfoil/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "
target_link_libraries(${PROJECT_NAME} sphinxsys_2d)

add_test(NAME ${PROJECT_NAME}_particle_relaxation
COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING}
COMMAND ${PROJECT_NAME} --relax=true --state_recording=${TEST_STATE_RECORDING}
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
set_tests_properties(${PROJECT_NAME}_particle_relaxation PROPERTIES LABELS "particle relaxation")
4 changes: 2 additions & 2 deletions tests/2d_examples/test_2d_ball_shell_collision/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ ADD_EXECUTABLE(${PROJECT_NAME} ${DIR_SRCS})
set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}")
target_link_libraries(${PROJECT_NAME} sphinxsys_2d)

add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING}
add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --relax=true --state_recording=${TEST_STATE_RECORDING}
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --r=false --i=true --state_recording=${TEST_STATE_RECORDING}
add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --reload=true --state_recording=${TEST_STATE_RECORDING}
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})

set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "particle_relaxation, thick_surface, solid_dynamics, contact")
4 changes: 2 additions & 2 deletions tests/2d_examples/test_2d_collision/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ADD_EXECUTABLE(${PROJECT_NAME} ${DIR_SRCS})
set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}")
target_link_libraries(${PROJECT_NAME} sphinxsys_2d)

add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING}
add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --relax=true --state_recording=${TEST_STATE_RECORDING}
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --r=false --i=true --state_recording=${TEST_STATE_RECORDING}
add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --reload=true --state_recording=${TEST_STATE_RECORDING}
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ target_link_libraries(${PROJECT_NAME} extra_sources_2d)
set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}")

add_test(NAME ${PROJECT_NAME}_particle_relaxation
COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING}
COMMAND ${PROJECT_NAME} --relax=true --state_recording=${TEST_STATE_RECORDING}
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
add_test(NAME ${PROJECT_NAME}
COMMAND ${PROJECT_NAME} --r=false --i=true --state_recording=${TEST_STATE_RECORDING}
COMMAND ${PROJECT_NAME} --reload=true --state_recording=${TEST_STATE_RECORDING}
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
set_tests_properties(${PROJECT_NAME} PROPERTIES DEPENDS "${PROJECT_NAME}_particle_relaxation")
set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "periodic boundary, Eulerian")
4 changes: 2 additions & 2 deletions tests/2d_examples/test_2d_flow_around_cylinder/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/regression_test_tool/ DESTINATION ${BUILD_
aux_source_directory(. DIR_SRCS)
ADD_EXECUTABLE(${PROJECT_NAME} ${EXECUTABLE_OUTPUT_PATH} ${DIR_SRCS})

add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING}
add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --relax=true --state_recording=${TEST_STATE_RECORDING}
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --r=false --i=true --state_recording=${TEST_STATE_RECORDING}
add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --reload=true --state_recording=${TEST_STATE_RECORDING}
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})

set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "periodic boundary")
Expand Down
Loading
Loading