Skip to content

Commit

Permalink
CI: Windows Install & Test Install (AMReX-Codes#3803)
Browse files Browse the repository at this point in the history
## Summary

Execute the `install` and `test_install` targets in Windows CI, too.

## Additional background

Increase coverage, e.g., for issues such as AMReX-Codes#3798 AMReX-Codes#3802

## Checklist

The proposed changes:
- [ ] fix a bug or incorrect behavior in AMReX
- [x] add new capabilities to AMReX
- [ ] changes answers in the test suite to more than roundoff level
- [ ] are likely to significantly affect the results of downstream AMReX
users
- [ ] include documentation in the code and/or rst files, if appropriate
  • Loading branch information
ax3l authored Mar 16, 2024
1 parent 3fe7aad commit 7d7b999
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 9 deletions.
22 changes: 16 additions & 6 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: seanmiddleditch/gha-setup-ninja@master
#- name: Set Up Cache
# uses: actions/cache@v3
# with:
Expand All @@ -38,7 +37,6 @@ jobs:
#ccache -z
cmake -S . -B build `
-DCMAKE_BUILD_TYPE=Debug `
-DBUILD_SHARED_LIBS=ON `
-DCMAKE_VERBOSE_MAKEFILE=ON `
-DAMReX_EB=OFF `
Expand All @@ -48,6 +46,11 @@ jobs:
#-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build build --config Debug -j 4
cmake --build build --config Debug --target install
$Env:PATH += ";D:\\a\amrex\amrex\installdir\bin"
cmake --build build --config Debug --target test_install
#ccache -s
# Build libamrex and all test (static)
Expand All @@ -56,7 +59,6 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: seanmiddleditch/gha-setup-ninja@master
#- name: Set Up Cache
# uses: actions/cache@v3
# with:
Expand All @@ -80,7 +82,6 @@ jobs:
#ccache -z
cmake -S . -B build `
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
-DCMAKE_VERBOSE_MAKEFILE=ON `
-DAMReX_EB=ON `
-DAMReX_ENABLE_TESTS=ON `
Expand All @@ -89,6 +90,9 @@ jobs:
#-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build build --config RelWithDebInfo -j 4
cmake --build build --config RelWithDebInfo --target install
cmake --build build --config RelWithDebInfo --target test_install
#ccache -s
# Build libamrex and all tests
Expand All @@ -100,11 +104,12 @@ jobs:
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Build & Install
shell: cmd
env:
CMAKE_GENERATOR_TOOLSET: "ClangCl"
CMAKE_GENERATOR: "Visual Studio 17 2022"
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\vc\Auxiliary\build\vcvarsall.bat" x64
cmake -S . -B build ^
-T "ClangCl" ^
-DCMAKE_BUILD_TYPE=Release ^
-DBUILD_SHARED_LIBS=ON ^
-DCMAKE_VERBOSE_MAKEFILE=ON ^
-DAMReX_EB=ON ^
Expand All @@ -114,6 +119,11 @@ jobs:
-DAMReX_OMP=ON
cmake --build build --config Release -j 4
cmake --build build --config Release --target install
set "PATH=%PATH%;D:\\a\amrex\amrex\installdir\bin"
cmake --build build --config Release --target test_install
# If we add ccache back, don't forget to update cleanup-cache.yml
#save_pr_number:
# if: github.event_name == 'pull_request'
Expand Down
5 changes: 4 additions & 1 deletion Tests/CMakeTestInstall/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,14 @@ foreach(D IN LISTS AMReX_SPACEDIM)
${_input_dir}/Prob.H
)

file(TO_NATIVE_PATH "${_input_dir}/inputs" inputs_path)

add_custom_command(
TARGET install_test_${D}d
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo "Running test project"
COMMAND ${PROJECT_BINARY_DIR}/install_test_${D}d ${_input_dir}/inputs max_step=1 > out_${D}d.txt
COMMAND ${CMAKE_COMMAND} -E echo "Command: $<TARGET_FILE:install_test_${D}d> ${inputs_path} max_step=1 > out_${D}d.txt"
COMMAND $<TARGET_FILE:install_test_${D}d> ${inputs_path} max_step=1 > out_${D}d.txt
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)
endforeach()
19 changes: 17 additions & 2 deletions Tools/CMake/AMReXInstallHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,28 @@ endfunction ()
# _amrex_root is the amrex installation dir
#
macro( add_test_install_target _dir _amrex_root )
# Multi-Config generators such as Visual Studio or Ninja Multi-Config
# select the build type at build time. Others (GNUmake, Ninja, ...) select
# the build type at configure time.
get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
set(_select_config)
set(_select_bldtype)
if(isMultiConfig)
set(_select_config "--config $<CONFIG>")
else()
set(_select_bldtype "-DCMAKE_BUILD_TYPE=$<CONFIG>")
endif()

# Fortran compiler used?
get_filename_component( _dirname ${_dir} NAME )
set(_builddir ${CMAKE_CURRENT_BINARY_DIR}/${_dirname})
set(_enable_fortran)
if(AMReX_FORTRAN)
set(_enable_fortran -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER})
endif()

# Configure and Build
# A registered POST_BUILD target in Tests/CMakeTestInstall will then also run the test.
add_custom_target(test_install
COMMAND ${CMAKE_COMMAND} -E echo ""
COMMAND ${CMAKE_COMMAND} -E echo "------------------------------------"
Expand All @@ -150,9 +165,9 @@ macro( add_test_install_target _dir _amrex_root )
COMMAND ${CMAKE_COMMAND} -E echo ""
COMMAND ${CMAKE_COMMAND} -E make_directory ${_builddir}
COMMAND ${CMAKE_COMMAND} -E echo "Configuring test project"
COMMAND ${CMAKE_COMMAND} -S ${_dir} -B ${_builddir} -DAMReX_ROOT=${_amrex_root} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} ${_enable_fortran}
COMMAND ${CMAKE_COMMAND} -S ${_dir} -B ${_builddir} ${_select_bldtype} -DAMReX_ROOT=${_amrex_root} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} ${_enable_fortran}
COMMAND ${CMAKE_COMMAND} -E echo "Building test project"
COMMAND ${CMAKE_COMMAND} --build ${_builddir}
COMMAND ${CMAKE_COMMAND} --build ${_builddir} ${_select_config}
COMMAND ${CMAKE_COMMAND} -E echo ""
COMMAND ${CMAKE_COMMAND} -E echo "------------------------------------"
COMMAND ${CMAKE_COMMAND} -E echo " AMReX is installed correctly"
Expand Down

0 comments on commit 7d7b999

Please sign in to comment.