diff --git a/.github/workflows/osrm-backend.yml b/.github/workflows/osrm-backend.yml index c5a36712659..9ab5780654a 100644 --- a/.github/workflows/osrm-backend.yml +++ b/.github/workflows/osrm-backend.yml @@ -20,6 +20,27 @@ env: ENABLE_NODE_BINDINGS: "ON" jobs: + windows: + needs: format-taginfo-docs + runs-on: windows-2022 + continue-on-error: false + steps: + - uses: actions/checkout@v3 + - run: pip install conan==1.50.0 + - run: conan --version + - run: cmake --version + - uses: actions/setup-node@v3 + with: + node-version: 16 + - run: node --version + - run: npm --version + - run: npm install --ignore-scripts + - run: npm link --ignore-scripts + - uses: microsoft/setup-msbuild@v1.1 + - name: Build + run: | + .\scripts\ci\windows-build.bat + format-taginfo-docs: runs-on: ubuntu-20.04 steps: @@ -642,6 +663,6 @@ jobs: ci-complete: runs-on: ubuntu-18.04 - needs: build-test-publish + needs: [build-test-publish, docker-image, windows] steps: - run: echo "CI complete" diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a2b8508aa2..0a639194e61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - FIXED: Fix bug with reading Set values from Lua scripts. [#6285](https://github.com/Project-OSRM/osrm-backend/pull/6285) - FIXED: Bug in bicycle profile that caused exceptions if there is a highway=bicycle in the data. [#6296](https://github.com/Project-OSRM/osrm-backend/pull/6296) - Build: + - CHANGED: Migrate Windows CI to GitHub Actions. [#6312](https://github.com/Project-OSRM/osrm-backend/pull/6312) - ADDED: Add smoke test for Docker image. [#6313](https://github.com/Project-OSRM/osrm-backend/pull/6313) - CHANGED: Update libosmium to version 2.18.0. [#6303](https://github.com/Project-OSRM/osrm-backend/pull/6303) - CHANGED: Remove EXACT from find_package if using Conan. [#6299](https://github.com/Project-OSRM/osrm-backend/pull/6299) diff --git a/CMakeLists.txt b/CMakeLists.txt index f611794fa87..5bf19bbaca6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -356,7 +356,6 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-intel -wd10237 -Wall -ipo -fPIC") elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") # using Visual Studio C++ - set(BOOST_COMPONENTS ${BOOST_COMPONENTS} zlib) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") # avoid compiler error C1128 from scripting_environment_lua.cpp set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DWIN32_LEAN_AND_MEAN") # avoid compiler error C2011 from dual #include of winsock.h and winsock2.h add_dependency_defines(-DBOOST_LIB_DIAGNOSTIC) @@ -446,6 +445,11 @@ add_subdirectory(${FLATBUFFERS_SRC_DIR} ${CMAKE_CURRENT_BINARY_DIR}/flatbuffers-build EXCLUDE_FROM_ALL) +# see https://stackoverflow.com/questions/70898030/boost-link-error-using-conan-find-package +if (MSVC) + add_definitions(-DBOOST_ALL_NO_LIB) +endif() + if(ENABLE_CONAN) message(STATUS "Installing dependencies via Conan") @@ -462,6 +466,16 @@ if(ENABLE_CONAN) set(CONAN_TBB_VERSION 2020.3) set(CONAN_SYSTEM_INCLUDES ON) + + # TODO: + # if we link TBB dynamically osrm-extract.exe finishes on the first access to any TBB symbol + # with exit code = -1073741515, which means that program cannot load required DLL. + if (MSVC) + set(TBB_SHARED False) + else() + set(TBB_SHARED True) + endif() + conan_cmake_run( REQUIRES boost/${CONAN_BOOST_VERSION} @@ -475,6 +489,7 @@ if(ENABLE_CONAN) KEEP_RPATHS NO_OUTPUT_DIRS OPTIONS boost:filesystem_version=3 # https://stackoverflow.com/questions/73392648/error-with-boost-filesystem-version-in-cmake + tbb:shared=${TBB_SHARED} ) add_dependency_includes(${CONAN_INCLUDE_DIRS_BOOST}) diff --git a/appveyor-build.bat b/appveyor-build.bat deleted file mode 100644 index 37cfd8f07f1..00000000000 --- a/appveyor-build.bat +++ /dev/null @@ -1,194 +0,0 @@ -@ECHO OFF -SETLOCAL -SET EL=0 - -ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -SET PROJECT_DIR=%CD% -ECHO PROJECT_DIR^: %PROJECT_DIR% -ECHO NUMBER_OF_PROCESSORS^: %NUMBER_OF_PROCESSORS% - - -:: Check CMake version -SET CMAKE_VERSION=3.16.3 -SET PATH=%PROJECT_DIR%\cmake-%CMAKE_VERSION%-win32-x86\bin;%PATH% -ECHO cmake^: && cmake --version -IF %ERRORLEVEL% NEQ 0 ECHO CMAKE not found && GOTO CMAKE_NOT_OK - -cmake --version | findstr /C:%CMAKE_VERSION% && GOTO CMAKE_OK - -:CMAKE_NOT_OK -ECHO CMAKE NOT OK - downloading new CMake %CMAKE_VERSION% -powershell Invoke-WebRequest https://cmake.org/files/v3.16/cmake-%CMAKE_VERSION%-win32-x86.zip -OutFile $env:PROJECT_DIR\cm.zip -IF %ERRORLEVEL% NEQ 0 GOTO ERROR -IF NOT EXIST cmake-%CMAKE_VERSION%-win32-x86 7z -y x cm.zip | %windir%\system32\FIND "ing archive" -IF %ERRORLEVEL% NEQ 0 GOTO ERROR - -:CMAKE_OK -ECHO CMAKE_OK -cmake --version - -ECHO activating VS command prompt ... -SET PATH=C:\Program Files (x86)\MSBuild\15.0\Bin;%PATH% -CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" - -ECHO platform^: %platform% - -ECHO cl.exe version -cl -ECHO msbuild version -msbuild /version - -:: HARDCODE "x64" as it is uppercase on AppVeyor and download from S3 is case sensitive -SET DEPSPKG=osrm-deps-win-x64-14.2-2019.01.7z - -:: local development -ECHO. -ECHO LOCAL_DEV^: %LOCAL_DEV% -IF NOT DEFINED LOCAL_DEV SET LOCAL_DEV=0 -IF DEFINED LOCAL_DEV IF %LOCAL_DEV% EQU 1 IF EXIST %DEPSPKG% ECHO skipping deps download && GOTO SKIPDL - -IF EXIST %DEPSPKG% DEL %DEPSPKG% -IF %ERRORLEVEL% NEQ 0 GOTO ERROR - -ECHO downloading %DEPSPKG% -powershell Invoke-WebRequest http://project-osrm.wolt.com/windows-build-deps/$env:DEPSPKG -OutFile $env:PROJECT_DIR\$env:DEPSPKG -IF %ERRORLEVEL% NEQ 0 GOTO ERROR - -:SKIPDL - -IF EXIST osrm-deps ECHO deleting osrm-deps... && RD /S /Q osrm-deps -IF %ERRORLEVEL% NEQ 0 GOTO ERROR -IF EXIST build ECHO deleting build dir... && RD /S /Q build -IF %ERRORLEVEL% NEQ 0 GOTO ERROR - -7z -y x %DEPSPKG% | %windir%\system32\FIND "ing archive" -IF %ERRORLEVEL% NEQ 0 GOTO ERROR - -::tree osrm-deps - -MKDIR build -IF %ERRORLEVEL% NEQ 0 GOTO ERROR -cd build -IF %ERRORLEVEL% NEQ 0 GOTO ERROR - -SET OSRMDEPSDIR=%PROJECT_DIR%/osrm-deps -set PREFIX=%OSRMDEPSDIR%/libs -set BOOST_ROOT=%OSRMDEPSDIR% -set BOOST_LIBRARYDIR=%BOOST_ROOT%/lib -set TBB_INSTALL_DIR=%OSRMDEPSDIR% -REM set TBB_ARCH_PLATFORM=intel64/vc17 - -ECHO OSRMDEPSDIR ^: %OSRMDEPSDIR% -ECHO PREFIX ^: %PREFIX% -ECHO BOOST_ROOT ^: %BOOST_ROOT% -ECHO BOOST_LIBRARYDIR ^: %BOOST_LIBRARYDIR% -ECHO TBB_INSTALL_DIR ^: %TBB_INSTALL_DIR% -REM ECHO TBB_ARCH_PLATFORM ^: %TBB_ARCH_PLATFORM% - - -ECHO calling cmake .... -cmake .. ^ --G "Visual Studio 16 2019" ^ --DBOOST_ROOT=%BOOST_ROOT% ^ --DBOOST_LIBRARYDIR=%BOOST_LIBRARYDIR% ^ --DBoost_ADDITIONAL_VERSIONS=1.73.0 ^ --DBoost_USE_MULTITHREADED=ON ^ --DBoost_USE_STATIC_LIBS=ON ^ --DEXPAT_INCLUDE_DIR=%OSRMDEPSDIR% ^ --DEXPAT_LIBRARY=%OSRMDEPSDIR%/lib/libexpat.lib ^ --DBZIP2_INCLUDE_DIR=%OSRMDEPSDIR% ^ --DBZIP2_LIBRARIES=%OSRMDEPSDIR%/lib/libbz2.lib ^ --DLUA_INCLUDE_DIR=%OSRMDEPSDIR% ^ --DLUA_LIBRARIES=%OSRMDEPSDIR%/lib/lua5.3.5.lib ^ --DZLIB_INCLUDE_DIR=%OSRMDEPSDIR% ^ --DZLIB_LIBRARY=%OSRMDEPSDIR%/lib/libz.lib ^ --DCMAKE_BUILD_TYPE=%CONFIGURATION% ^ --DCMAKE_INSTALL_PREFIX=%PREFIX% -IF %ERRORLEVEL% NEQ 0 GOTO ERROR - -ECHO building ... -msbuild OSRM.sln ^ -/p:Configuration=%Configuration% ^ -/p:Platform=x64 ^ -/t:rebuild ^ -/p:BuildInParallel=true ^ -/m:%NUMBER_OF_PROCESSORS% ^ -/toolsversion:Current ^ -/p:PlatformToolset=v142 ^ -/clp:Verbosity=normal ^ -/nologo ^ -/flp1:logfile=build_errors.txt;errorsonly ^ -/flp2:logfile=build_warnings.txt;warningsonly -IF %ERRORLEVEL% EQU 1 GOTO ERROR - -CD %PROJECT_DIR%\build -IF %ERRORLEVEL% EQU 1 GOTO ERROR - -SET PATH=%PROJECT_DIR%\osrm-deps\lib;%PATH% - -ECHO running extractor-tests.exe ... -unit_tests\%Configuration%\extractor-tests.exe -IF %ERRORLEVEL% EQU 1 GOTO ERROR - -ECHO running contractor-tests.exe ... -unit_tests\%Configuration%\contractor-tests.exe -IF %ERRORLEVEL% EQU 1 GOTO ERROR - -ECHO running engine-tests.exe ... -unit_tests\%Configuration%\engine-tests.exe -IF %ERRORLEVEL% EQU 1 GOTO ERROR - -ECHO running util-tests.exe ... -unit_tests\%Configuration%\util-tests.exe -IF %ERRORLEVEL% EQU 1 GOTO ERROR - -ECHO running server-tests.exe ... -unit_tests\%Configuration%\server-tests.exe -IF %ERRORLEVEL% EQU 1 GOTO ERROR - -ECHO running partitioner-tests.exe ... -unit_tests\%Configuration%\partitioner-tests.exe -IF %ERRORLEVEL% EQU 1 GOTO ERROR - -ECHO running customizer-tests.exe ... -unit_tests\%Configuration%\customizer-tests.exe -IF %ERRORLEVEL% EQU 1 GOTO ERROR - -ECHO running library-tests.exe ... -SET test_region=monaco -SET test_region_ch=ch\monaco -SET test_region_corech=corech\monaco -SET test_region_mld=mld\monaco -SET test_osm=%test_region%.osm.pbf -IF NOT EXIST %test_osm% powershell Invoke-WebRequest http://project-osrm.wolt.com/testing/monaco.osm.pbf -OutFile %test_osm% -ECHO running %Configuration%\osrm-extract.exe -p ../profiles/car.lua %test_osm% -%Configuration%\osrm-extract.exe -%Configuration%\osrm-extract.exe -p ../profiles/car.lua %test_osm% -MKDIR ch -XCOPY %test_region%.osrm.* ch\ -XCOPY %test_region%.osrm ch\ -MKDIR corech -XCOPY %test_region%.osrm.* corech\ -XCOPY %test_region%.osrm corech\ -MKDIR mld -XCOPY %test_region%.osrm.* mld\ -XCOPY %test_region%.osrm mld\ -%Configuration%\osrm-contract.exe %test_region_ch%.osrm -%Configuration%\osrm-contract.exe --core 0.8 %test_region_corech%.osrm -%Configuration%\osrm-partition.exe %test_region_mld%.osrm -%Configuration%\osrm-customize.exe %test_region_mld%.osrm -XCOPY /Y ch\*.* ..\test\data\ch\ -XCOPY /Y corech\*.* ..\test\data\corech\ -XCOPY /Y mld\*.* ..\test\data\mld\ -unit_tests\%Configuration%\library-tests.exe - -:ERROR -ECHO ~~~~~~~~~~~~~~~~~~~~~~ ERROR %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -ECHO ERRORLEVEL^: %ERRORLEVEL% -SET EL=%ERRORLEVEL% - -:DONE -ECHO ~~~~~~~~~~~~~~~~~~~~~~ DONE %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -EXIT /b %EL% diff --git a/appveyor.yml b/appveyor.yml index 3fbf89cb6bd..a1849a9e7e2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,15 +1,3 @@ -environment: - matrix: - - configuration: Release -# - configuration: Debug - -install: - - ps: Install-Product node 6 - -# scripts that are called at very beginning, before repo cloning -init: - - git config --global core.autocrlf input - os: Visual Studio 2019 # clone directory @@ -17,20 +5,11 @@ clone_folder: c:\projects\osrm platform: x64 +# no-op for the time being until someone with access to GitHub checks settings will remove integration with AppVeyor +# https://github.com/Project-OSRM/osrm-backend/pull/6312#issuecomment-1217237055 build_script: - - CALL appveyor-build.bat - -before_test: - - node --version - - npm --version - - npm install --ignore-scripts - - npm link --ignore-scripts - - SET PATH=%CD%\osrm-deps\lib;%PATH% - - SET OSRM_BUILD_DIR=build\%Configuration% -# TODO tests fail with "JavaScript heap out of memory", need a better host? -# - npm test + - EXIT 0 branches: only: - master - diff --git a/scripts/ci/windows-build.bat b/scripts/ci/windows-build.bat new file mode 100644 index 00000000000..19eb8c7b48b --- /dev/null +++ b/scripts/ci/windows-build.bat @@ -0,0 +1,99 @@ +@ECHO OFF +SETLOCAL +SET EL=0 + +ECHO NUMBER_OF_PROCESSORS^: %NUMBER_OF_PROCESSORS% + +SET PROJECT_DIR=%CD% +SET CONFIGURATION=Release + +mkdir build +IF %ERRORLEVEL% NEQ 0 GOTO ERROR +cd build +IF %ERRORLEVEL% NEQ 0 GOTO ERROR +cmake -DENABLE_CONAN=ON -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DBUILD_TOOLS=ON -G "Visual Studio 17 2022" .. +IF %ERRORLEVEL% NEQ 0 GOTO ERROR + +msbuild OSRM.sln ^ +/p:Configuration=%CONFIGURATION% ^ +/p:Platform=x64 ^ +/t:rebuild ^ +/p:BuildInParallel=true ^ +/m:%NUMBER_OF_PROCESSORS% ^ +/toolsversion:Current ^ +/clp:Verbosity=normal ^ +/nologo +IF %ERRORLEVEL% NEQ 0 GOTO ERROR + +dir C:\Users\runneradmin\.conan\ +dir C:\Users\runneradmin\.conan\data\tbb\2020.3\_\_\package\e9a552ebe8f994398de9ceee972f0ad207df0658\lib\ +SET PATH=C:\Users\runneradmin\.conan\data\tbb\2020.3\_\_\package\e9a552ebe8f994398de9ceee972f0ad207df0658\lib\;%PATH% + +CD %PROJECT_DIR%\build +IF %ERRORLEVEL% NEQ 0 GOTO ERROR + +ECHO running extractor-tests.exe ... +unit_tests\%CONFIGURATION%\extractor-tests.exe +IF %ERRORLEVEL% NEQ 0 GOTO ERROR + +ECHO running contractor-tests.exe ... +unit_tests\%CONFIGURATION%\contractor-tests.exe +IF %ERRORLEVEL% NEQ 0 GOTO ERROR + +ECHO running engine-tests.exe ... +unit_tests\%CONFIGURATION%\engine-tests.exe +IF %ERRORLEVEL% NEQ 0 GOTO ERROR + +ECHO running util-tests.exe ... +unit_tests\%CONFIGURATION%\util-tests.exe +IF %ERRORLEVEL% NEQ 0 GOTO ERROR + +ECHO running server-tests.exe ... +unit_tests\%CONFIGURATION%\server-tests.exe +IF %ERRORLEVEL% NEQ 0 GOTO ERROR + +ECHO running partitioner-tests.exe ... +unit_tests\%CONFIGURATION%\partitioner-tests.exe +IF %ERRORLEVEL% NEQ 0 GOTO ERROR + +ECHO running customizer-tests.exe ... +unit_tests\%CONFIGURATION%\customizer-tests.exe +IF %ERRORLEVEL% NEQ 0 GOTO ERROR + +SET test_region=monaco +SET test_region_ch=ch\monaco +SET test_region_corech=corech\monaco +SET test_region_mld=mld\monaco +SET test_osm=%test_region%.osm.pbf +COPY %PROJECT_DIR%\test\data\%test_region%.osm.pbf %test_osm% +%CONFIGURATION%\osrm-extract.exe -p %PROJECT_DIR%\profiles\car.lua %test_osm% +IF %ERRORLEVEL% NEQ 0 GOTO ERROR + +MKDIR ch +XCOPY %test_region%.osrm.* ch\ +XCOPY %test_region%.osrm ch\ +MKDIR corech +XCOPY %test_region%.osrm.* corech\ +XCOPY %test_region%.osrm corech\ +MKDIR mld +XCOPY %test_region%.osrm.* mld\ +XCOPY %test_region%.osrm mld\ +%CONFIGURATION%\osrm-contract.exe %test_region_ch%.osrm +%CONFIGURATION%\osrm-contract.exe --core 0.8 %test_region_corech%.osrm +%CONFIGURATION%\osrm-partition.exe %test_region_mld%.osrm +%CONFIGURATION%\osrm-customize.exe %test_region_mld%.osrm +XCOPY /Y ch\*.* ..\test\data\ch\ +XCOPY /Y corech\*.* ..\test\data\corech\ +XCOPY /Y mld\*.* ..\test\data\mld\ +unit_tests\%CONFIGURATION%\library-tests.exe +IF %ERRORLEVEL% NEQ 0 GOTO ERROR + +:ERROR +ECHO ~~~~~~~~~~~~~~~~~~~~~~ ERROR %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +ECHO ERRORLEVEL^: %ERRORLEVEL% +SET EL=%ERRORLEVEL% + +:DONE +ECHO ~~~~~~~~~~~~~~~~~~~~~~ DONE %~f0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +EXIT /b %EL%