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

CI: Windows on GH Actions (MSVC, Clang) #840

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,10 @@ before_build:

build_script:
- cmd: cmake --build . --config %CONFIGURATION%
- cmd: ctest -V -C %CONFIGURATION%
- cmd: cmake --build . --config %CONFIGURATION% --target install
# note: running ctest after install seems to fail...

test_script:
- cmd: ctest -V -C %CONFIGURATION%
- cmd: python -c "import openpmd_api; print(openpmd_api.__version__); print(openpmd_api.variants)"

56 changes: 56 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: windows

on: [push, pull_request]

jobs:
build_win_msvc:
name: MSVC w/o MPI
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Build & Test
run: |
$erroractionpreference = "stop"
md build
cd build
powershell.exe ..\share\openPMD\download_samples.ps1
cmake .. `
-DCMAKE_BUILD_TYPE=Debug `
-DCMAKE_VERBOSE_MAKEFILE=ON
ax3l marked this conversation as resolved.
Show resolved Hide resolved
cmake --build . --config Debug --parallel 2
if (-not $?) { throw "CMake build failed" }
ctest -V --output-on-failure --build-config Debug
if (-not $?) { throw "CTest failed" }
cmake --build . --config Debug --target install
if (-not $?) { throw "CMake install failed" }

build_win_clang:
name: Clang w/o MPI
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Build & Test
shell: cmd
run: |
md build
cd build
Powershell.exe -File ..\share\openPMD\download_samples.ps1
if errorlevel 1 exit 1
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\vc\Auxiliary\build\vcvarsall.bat" x64
cmake .. ^
-G "Ninja" ^
-DCMAKE_C_COMPILER=clang-cl ^
-DCMAKE_CXX_COMPILER=clang-cl ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_VERBOSE_MAKEFILE=ON
Copy link
Member Author

@ax3l ax3l Jan 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add Python_EXECUTABLE hint?

if errorlevel 1 exit 1
cmake --build . --config Release --parallel 2
if errorlevel 1 exit 1

dumpbin /dependents D:\a\openPMD-api\openPMD-api\build\lib\site-packages\openpmd_api\openpmd_api_cxx.cp39-win_amd64.pyd
Copy link
Member Author

@ax3l ax3l Jan 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-cl (broken for Python modules only):

Dump of file D:\a\openPMD-api\openPMD-api\build\lib\site-packages\openpmd_api\openpmd_api_cxx.cp39-win_amd64.pyd

File Type: DLL

  Image has the following dependencies:

    openPMD.dll
    python39.dll
    MSVCP140.dll
    KERNEL32.dll
    VCRUNTIME140.dll
    api-ms-win-crt-stdio-l1-1-0.dll
    api-ms-win-crt-math-l1-1-0.dll
    api-ms-win-crt-runtime-l1-1-0.dll
    api-ms-win-crt-string-l1-1-0.dll
    api-ms-win-crt-heap-l1-1-0.dll

  Summary

        1000 .00cfg
        6000 .data
        1000 .gehcont
        E000 .pdata
       49000 .rdata
        1000 .reloc
        1000 .rsrc
      146000 .text
        1000 .tls


ctest -V --output-on-failure --build-config Release
if errorlevel 1 exit 1
cmake --build . --config Release --target install
if errorlevel 1 exit 1
45 changes: 23 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -639,11 +639,14 @@ if(openPMD_HAVE_PYTHON)
set_target_properties(openPMD.py PROPERTIES
ARCHIVE_OUTPUT_NAME openpmd_api_cxx
LIBRARY_OUTPUT_NAME openpmd_api_cxx
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_PYTHON_OUTPUT_DIRECTORY}/openpmd_api
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_PYTHON_OUTPUT_DIRECTORY}/openpmd_api
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_PYTHON_OUTPUT_DIRECTORY}/openpmd_api
PDB_OUTPUT_DIRECTORY ${CMAKE_PYTHON_OUTPUT_DIRECTORY}/openpmd_api
COMPILE_PDB_OUTPUT_DIRECTORY ${CMAKE_PYTHON_OUTPUT_DIRECTORY}/openpmd_api
# note: we append an empty generator expression $<0:> to avoid a suffix
# of the config type on multi-config generators (VS and XCode)
# https://cmake.org/cmake/help/latest/prop_tgt/ARCHIVE_OUTPUT_DIRECTORY.html
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_PYTHON_OUTPUT_DIRECTORY}/openpmd_api$<0:>
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_PYTHON_OUTPUT_DIRECTORY}/openpmd_api$<0:>
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_PYTHON_OUTPUT_DIRECTORY}/openpmd_api$<0:>
PDB_OUTPUT_DIRECTORY ${CMAKE_PYTHON_OUTPUT_DIRECTORY}/openpmd_api$<0:>
COMPILE_PDB_OUTPUT_DIRECTORY ${CMAKE_PYTHON_OUTPUT_DIRECTORY}/openpmd_api$<0:>
)
add_custom_command(TARGET openPMD.py POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
Expand Down Expand Up @@ -949,6 +952,12 @@ if(openPMD_BUILD_TESTING)
${MPIEXEC_NUMPROC_FLAG} 2
)

# preserve Windows environment for runtime tests
if(WIN32)
string(REPLACE ";" "\\;" WIN_PATH "$ENV{PATH}")
string(REPLACE ";" "\\;" WIN_PYTHONPATH "$ENV{PYTHONPATH}")
endif()

# do we have openPMD-example-datasets?
if(EXISTS "${openPMD_BINARY_DIR}/samples/git-sample/")
set(EXAMPLE_DATA_FOUND ON)
Expand Down Expand Up @@ -1011,19 +1020,15 @@ if(openPMD_BUILD_TESTING)
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)
if(WIN32)
string(REGEX REPLACE "/" "\\\\" WIN_BUILD_BASEDIR ${openPMD_BINARY_DIR})
string(REGEX REPLACE "/" "\\\\" WIN_BUILD_BINDIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
string(REPLACE ";" "\\;" WIN_PATH "$ENV{PATH}")
string(REPLACE ";" "\\;" WIN_PYTHONPATH "$ENV{PYTHONPATH}")
set_property(TEST Unittest.py
PROPERTY ENVIRONMENT
"PATH=${WIN_BUILD_BINDIR}\\${CMAKE_BUILD_TYPE}\;${WIN_PATH}\n"
"PYTHONPATH=${WIN_BUILD_BASEDIR}\\${CMAKE_INSTALL_PYTHONDIR}\\${CMAKE_BUILD_TYPE}\;${WIN_PYTHONPATH}"
"PATH=$<SHELL_PATH:$<TARGET_FILE_DIR:openPMD>>\;${WIN_PATH}\n"
"PYTHONPATH=$<SHELL_PATH:${CMAKE_PYTHON_OUTPUT_DIRECTORY}>\;${WIN_PYTHONPATH}"
)
else()
set_tests_properties(Unittest.py
PROPERTIES ENVIRONMENT
"PYTHONPATH=${openPMD_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}:$ENV{PYTHONPATH}"
"PYTHONPATH=${CMAKE_PYTHON_OUTPUT_DIRECTORY}:$ENV{PYTHONPATH}"
)
endif()
endif()
Expand Down Expand Up @@ -1091,13 +1096,13 @@ if(openPMD_BUILD_TESTING)
if(WIN32)
set_property(TEST CLI.py.help.${pymodulename}
PROPERTY ENVIRONMENT
"PATH=${WIN_BUILD_BINDIR}\\${CMAKE_BUILD_TYPE}\;${WIN_PATH}\n"
"PYTHONPATH=${WIN_BUILD_BASEDIR}\\${CMAKE_INSTALL_PYTHONDIR}\\${CMAKE_BUILD_TYPE}\;${WIN_PYTHONPATH}"
"PATH=$<SHELL_PATH:$<TARGET_FILE_DIR:openPMD>>\;${WIN_PATH}\n"
"PYTHONPATH=$<SHELL_PATH:${CMAKE_PYTHON_OUTPUT_DIRECTORY}>\;${WIN_PYTHONPATH}"
)
else()
set_tests_properties(CLI.py.help.${pymodulename}
PROPERTIES ENVIRONMENT
"PYTHONPATH=${openPMD_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}:$ENV{PYTHONPATH}"
"PYTHONPATH=${CMAKE_PYTHON_OUTPUT_DIRECTORY}:$ENV{PYTHONPATH}"
)
endif()
endforeach()
Expand Down Expand Up @@ -1134,19 +1139,15 @@ if(openPMD_BUILD_TESTING)
)
endif()
if(WIN32)
string(REGEX REPLACE "/" "\\\\" WIN_BUILD_BASEDIR ${openPMD_BINARY_DIR})
string(REGEX REPLACE "/" "\\\\" WIN_BUILD_BINDIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
string(REPLACE ";" "\\;" WIN_PATH "$ENV{PATH}")
string(REPLACE ";" "\\;" WIN_PYTHONPATH "$ENV{PYTHONPATH}")
set_property(TEST Example.py.${examplename}
PROPERTY ENVIRONMENT
"PATH=${WIN_BUILD_BINDIR}\\${CMAKE_BUILD_TYPE}\;${WIN_PATH}\n"
"PYTHONPATH=${WIN_BUILD_BASEDIR}\\${CMAKE_INSTALL_PYTHONDIR}\\${CMAKE_BUILD_TYPE}\;${WIN_PYTHONPATH}"
"PATH=$<SHELL_PATH:$<TARGET_FILE_DIR:openPMD>>\;${WIN_PATH}\n"
"PYTHONPATH=$<SHELL_PATH:${CMAKE_PYTHON_OUTPUT_DIRECTORY}>\;${WIN_PYTHONPATH}"
)
else()
set_tests_properties(Example.py.${examplename}
PROPERTIES ENVIRONMENT
"PYTHONPATH=${openPMD_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}:$ENV{PYTHONPATH}"
"PYTHONPATH=${CMAKE_PYTHON_OUTPUT_DIRECTORY}:$ENV{PYTHONPATH}"
)
endif()
endif()
Expand Down