From 1e6f1ef89408630a45253da79548c6bfc6d2473b Mon Sep 17 00:00:00 2001 From: Jay Zhuang Date: Fri, 28 Oct 2022 09:14:47 -0700 Subject: [PATCH] Upgrade CircleCI Windows Build (#10090) Summary: * Upgrade CircleCI orb from 2.4 to 5.0 * Setup vs2022 build * Use image build-in vs2019 and vs2022 * Remove vs2017 * Remove CMAKE_CXX_STANDARD=20 Pull Request resolved: https://github.com/facebook/rocksdb/pull/10090 Reviewed By: ajkr Differential Revision: D40787942 Pulled By: jay-zhuang fbshipit-source-id: cc74c02a9f28dd784a0ba5502c4bfc9ff1a26d3e --- .circleci/config.yml | 140 +++++++++++++++-------------------- .circleci/vs2015_install.ps1 | 24 ------ .circleci/vs2017_install.ps1 | 35 --------- 3 files changed, 61 insertions(+), 138 deletions(-) delete mode 100644 .circleci/vs2015_install.ps1 delete mode 100644 .circleci/vs2017_install.ps1 diff --git a/.circleci/config.yml b/.circleci/config.yml index 6cf1407cf..bba65c8aa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2.1 orbs: - win: circleci/windows@2.4.0 + win: circleci/windows@5.0.0 commands: install-cmake-on-macos: @@ -45,6 +45,38 @@ commands: echo "export LZ4_DOWNLOAD_BASE=https://rocksdb-deps.s3.us-west-2.amazonaws.com/pkgs/lz4" >> $BASH_ENV echo "export ZSTD_DOWNLOAD_BASE=https://rocksdb-deps.s3.us-west-2.amazonaws.com/pkgs/zstd" >> $BASH_ENV + windows-build-steps: + steps: + - checkout + - run: + name: "Install thirdparty dependencies" + command: | + echo "Installing CMake..." + choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y + mkdir $Env:THIRDPARTY_HOME + cd $Env:THIRDPARTY_HOME + echo "Building Snappy dependency..." + curl https://github.com/google/snappy/archive/refs/tags/1.1.8.zip -O snappy-1.1.8.zip + unzip -q snappy-1.1.8.zip + cd snappy-1.1.8 + mkdir build + cd build + & $Env:CMAKE_BIN -G "$Env:CMAKE_GENERATOR" .. + msbuild.exe Snappy.sln -maxCpuCount -property:Configuration=Debug -property:Platform=x64 + - run: + name: "Build RocksDB" + command: | + mkdir build + cd build + & $Env:CMAKE_BIN -G "$Env:CMAKE_GENERATOR" -DCMAKE_BUILD_TYPE=Debug -DOPTDBG=1 -DPORTABLE=1 -DSNAPPY=1 -DJNI=1 .. + cd .. + echo "Building with VS version: $Env:CMAKE_GENERATOR" + msbuild.exe build/rocksdb.sln -maxCpuCount -property:Configuration=Debug -property:Platform=x64 + - run: + name: "Test RocksDB" + shell: powershell.exe + command: | + build_tools\run_ci_db_test.ps1 -SuiteRun arena_test,db_basic_test,db_test,db_test2,db_merge_operand_test,bloom_test,c_test,coding_test,crc32c_test,dynamic_bloom_test,env_basic_test,env_test,hash_test,random_test -Concurrency 16 pre-steps-macos: steps: - pre-steps @@ -154,11 +186,6 @@ commands: true executors: - windows-2xlarge: - machine: - image: 'windows-server-2019-vs2019:stable' - resource_class: windows.2xlarge - shell: bash.exe linux-docker: docker: # The image configuration is build_tools/ubuntu20_image/Dockerfile @@ -518,73 +545,35 @@ jobs: no_output_timeout: 100m - post-steps - build-windows: - executor: windows-2xlarge - parameters: - extra_cmake_opt: - default: "" - type: string - vs_year: - default: "2019" - type: string - cmake_generator: - default: "Visual Studio 16 2019" - type: string + build-windows-vs2022: + executor: + name: win/server-2022 + size: 2xlarge + environment: + THIRDPARTY_HOME: C:/Users/circleci/thirdparty + CMAKE_HOME: C:/Program Files/CMake + CMAKE_BIN: C:/Program Files/CMake/bin/cmake.exe + SNAPPY_HOME: C:/Users/circleci/thirdparty/snappy-1.1.8 + SNAPPY_INCLUDE: C:/Users/circleci/thirdparty/snappy-1.1.8;C:/Users/circleci/thirdparty/snappy-1.1.8/build + SNAPPY_LIB_DEBUG: C:/Users/circleci/thirdparty/snappy-1.1.8/build/Debug/snappy.lib + CMAKE_GENERATOR: Visual Studio 17 2022 + steps: + - windows-build-steps + + build-windows-vs2019: + executor: + name: win/server-2019 + size: 2xlarge environment: THIRDPARTY_HOME: C:/Users/circleci/thirdparty - CMAKE_HOME: C:/Users/circleci/thirdparty/cmake-3.16.4-win64-x64 - CMAKE_BIN: C:/Users/circleci/thirdparty/cmake-3.16.4-win64-x64/bin/cmake.exe - SNAPPY_HOME: C:/Users/circleci/thirdparty/snappy-1.1.7 - SNAPPY_INCLUDE: C:/Users/circleci/thirdparty/snappy-1.1.7;C:/Users/circleci/thirdparty/snappy-1.1.7/build - SNAPPY_LIB_DEBUG: C:/Users/circleci/thirdparty/snappy-1.1.7/build/Debug/snappy.lib - VS_YEAR: <> - CMAKE_GENERATOR: <> + CMAKE_HOME: C:/Program Files/CMake + CMAKE_BIN: C:/Program Files/CMake/bin/cmake.exe + SNAPPY_HOME: C:/Users/circleci/thirdparty/snappy-1.1.8 + SNAPPY_INCLUDE: C:/Users/circleci/thirdparty/snappy-1.1.8;C:/Users/circleci/thirdparty/snappy-1.1.8/build + SNAPPY_LIB_DEBUG: C:/Users/circleci/thirdparty/snappy-1.1.8/build/Debug/snappy.lib + CMAKE_GENERATOR: Visual Studio 16 2019 steps: - - checkout - - run: - name: "Setup VS" - command: | - if [[ "${VS_YEAR}" == "2019" ]]; then - echo "VS2019 already present." - elif [[ "${VS_YEAR}" == "2017" ]]; then - echo "Installing VS2017..." - powershell .circleci/vs2017_install.ps1 - elif [[ "${VS_YEAR}" == "2015" ]]; then - echo "Installing VS2015..." - powershell .circleci/vs2015_install.ps1 - fi - - store_artifacts: - path: \Users\circleci\AppData\Local\Temp\vslogs.zip - - run: - name: "Install thirdparty dependencies" - command: | - mkdir ${THIRDPARTY_HOME} - cd ${THIRDPARTY_HOME} - echo "Installing CMake..." - curl --fail --silent --show-error --output cmake-3.16.4-win64-x64.zip --location https://github.com/Kitware/CMake/releases/download/v3.16.4/cmake-3.16.4-win64-x64.zip - unzip -q cmake-3.16.4-win64-x64.zip - echo "Building Snappy dependency..." - curl --fail --silent --show-error --output snappy-1.1.7.zip --location https://github.com/google/snappy/archive/1.1.7.zip - unzip -q snappy-1.1.7.zip - cd snappy-1.1.7 - mkdir build - cd build - ${CMAKE_BIN} -G "${CMAKE_GENERATOR}" .. - msbuild.exe Snappy.sln -maxCpuCount -property:Configuration=Debug -property:Platform=x64 - - run: - name: "Build RocksDB" - command: | - mkdir build - cd build - ${CMAKE_BIN} -G "${CMAKE_GENERATOR}" -DCMAKE_BUILD_TYPE=Debug -DOPTDBG=1 -DPORTABLE=1 -DSNAPPY=1 -DJNI=1 << parameters.extra_cmake_opt >> .. - cd .. - echo "Building with VS version: ${CMAKE_GENERATOR}" - msbuild.exe build/rocksdb.sln -maxCpuCount -property:Configuration=Debug -property:Platform=x64 - - run: - name: "Test RocksDB" - shell: powershell.exe - command: | - build_tools\run_ci_db_test.ps1 -SuiteRun arena_test,db_basic_test,db_test,db_test2,db_merge_operand_test,bloom_test,c_test,coding_test,crc32c_test,dynamic_bloom_test,env_basic_test,env_test,hash_test,random_test -Concurrency 16 + - windows-build-steps build-linux-java: executor: linux-docker @@ -859,15 +848,8 @@ workflows: - build-linux-mini-crashtest jobs-windows: jobs: - - build-windows: - name: "build-windows-vs2019" - - build-windows: - name: "build-windows-vs2019-cxx20" - extra_cmake_opt: -DCMAKE_CXX_STANDARD=20 - - build-windows: - name: "build-windows-vs2017" - vs_year: "2017" - cmake_generator: "Visual Studio 15 Win64" + - build-windows-vs2022 + - build-windows-vs2019 - build-cmake-mingw jobs-java: jobs: diff --git a/.circleci/vs2015_install.ps1 b/.circleci/vs2015_install.ps1 deleted file mode 100644 index 754af0e57..000000000 --- a/.circleci/vs2015_install.ps1 +++ /dev/null @@ -1,24 +0,0 @@ -$VS_DOWNLOAD_LINK = "https://go.microsoft.com/fwlink/?LinkId=691126" -$COLLECT_DOWNLOAD_LINK = "https://aka.ms/vscollect.exe" -curl.exe --retry 3 -kL $VS_DOWNLOAD_LINK --output vs_installer.exe -if ($LASTEXITCODE -ne 0) { - echo "Download of the VS 2015 installer failed" - exit 1 -} -$VS_INSTALL_ARGS = @("/Quiet", "/NoRestart") -$process = Start-Process "${PWD}\vs_installer.exe" -ArgumentList $VS_INSTALL_ARGS -NoNewWindow -Wait -PassThru -Remove-Item -Path vs_installer.exe -Force -$exitCode = $process.ExitCode -if (($exitCode -ne 0) -and ($exitCode -ne 3010)) { - echo "VS 2015 installer exited with code $exitCode, which should be one of [0, 3010]." - curl.exe --retry 3 -kL $COLLECT_DOWNLOAD_LINK --output Collect.exe - if ($LASTEXITCODE -ne 0) { - echo "Download of the VS Collect tool failed." - exit 1 - } - Start-Process "${PWD}\Collect.exe" -NoNewWindow -Wait -PassThru - New-Item -Path "C:\w\build-results" -ItemType "directory" -Force - Copy-Item -Path "C:\Users\circleci\AppData\Local\Temp\vslogs.zip" -Destination "C:\w\build-results\" - exit 1 -} -echo "VS 2015 installed." diff --git a/.circleci/vs2017_install.ps1 b/.circleci/vs2017_install.ps1 deleted file mode 100644 index 93975fff4..000000000 --- a/.circleci/vs2017_install.ps1 +++ /dev/null @@ -1,35 +0,0 @@ -$VS_DOWNLOAD_LINK = "https://aka.ms/vs/15/release/vs_buildtools.exe" -$COLLECT_DOWNLOAD_LINK = "https://aka.ms/vscollect.exe" -$VS_INSTALL_ARGS = @("--nocache","--quiet","--wait", "--add Microsoft.VisualStudio.Workload.VCTools", - "--add Microsoft.VisualStudio.Component.VC.Tools.14.13", - "--add Microsoft.Component.MSBuild", - "--add Microsoft.VisualStudio.Component.Roslyn.Compiler", - "--add Microsoft.VisualStudio.Component.TextTemplating", - "--add Microsoft.VisualStudio.Component.VC.CoreIde", - "--add Microsoft.VisualStudio.Component.VC.Redist.14.Latest", - "--add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core", - "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64", - "--add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Win81") - -curl.exe --retry 3 -kL $VS_DOWNLOAD_LINK --output vs_installer.exe -if ($LASTEXITCODE -ne 0) { - echo "Download of the VS 2017 installer failed" - exit 1 -} - -$process = Start-Process "${PWD}\vs_installer.exe" -ArgumentList $VS_INSTALL_ARGS -NoNewWindow -Wait -PassThru -Remove-Item -Path vs_installer.exe -Force -$exitCode = $process.ExitCode -if (($exitCode -ne 0) -and ($exitCode -ne 3010)) { - echo "VS 2017 installer exited with code $exitCode, which should be one of [0, 3010]." - curl.exe --retry 3 -kL $COLLECT_DOWNLOAD_LINK --output Collect.exe - if ($LASTEXITCODE -ne 0) { - echo "Download of the VS Collect tool failed." - exit 1 - } - Start-Process "${PWD}\Collect.exe" -NoNewWindow -Wait -PassThru - New-Item -Path "C:\w\build-results" -ItemType "directory" -Force - Copy-Item -Path "C:\Users\circleci\AppData\Local\Temp\vslogs.zip" -Destination "C:\w\build-results\" - exit 1 -} -echo "VS 2017 installed."