diff --git a/ci/azure/pipelines.yml b/ci/azure/pipelines.yml index 5dbfe5a3389a10ecee9fed1972368f2a6487cdd1..fdf9d92d7d30d0125c3b3cb839612b450c937606 100644 --- a/ci/azure/pipelines.yml +++ b/ci/azure/pipelines.yml @@ -28,12 +28,20 @@ jobs: - job: BuildWindows pool: vmImage: 'windows-2019' + strategy: + matrix: + mingw64: + CHERE_INVOKING: yes + MSYSTEM: MINGW64 + SCRIPT: '%CD:~0,2%\msys64\usr\bin\bash -lc "bash ci/azure/windows_mingw_script"' + msvc: + SCRIPT: ci/azure/windows_msvc_script.bat timeoutInMinutes: 360 steps: - script: | - git clone https://github.com/lazka/msys2-ci-base.git %CD:~0,2%\msys64 + git clone https://github.com/msys2/msys2-ci-base.git %CD:~0,2%\msys64 %CD:~0,2%\msys64\usr\bin\rm -rf %CD:~0,2%\msys64\.git set PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem %CD:~0,2%\msys64\usr\bin\pacman --noconfirm -Syyuu @@ -41,7 +49,7 @@ jobs: - task: DownloadSecureFile@1 inputs: secureFile: s3cfg - - script: ci/azure/windows_script.bat + - script: $(SCRIPT) name: main displayName: 'Build and test' - job: OnMasterSuccess diff --git a/ci/azure/windows_install b/ci/azure/windows_install deleted file mode 100755 index ece3bbde114da94f1abe8ee5d1f90e30658a182f..0000000000000000000000000000000000000000 --- a/ci/azure/windows_install +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -set -x -set -e - -pacman -Su --needed --noconfirm -pacman -S --needed --noconfirm wget p7zip python3-pip -pip install s3cmd -wget -nv "https://ziglang.org/deps/llvm%2bclang%2blld-10.0.0-x86_64-windows-msvc-release-mt.tar.xz" -tar xf llvm+clang+lld-10.0.0-x86_64-windows-msvc-release-mt.tar.xz diff --git a/ci/azure/windows_mingw_script b/ci/azure/windows_mingw_script new file mode 100644 index 0000000000000000000000000000000000000000..78837664276a37520245bce0ef3e14ea91d9e29c --- /dev/null +++ b/ci/azure/windows_mingw_script @@ -0,0 +1,21 @@ +#!/bin/sh + +set -x +set -e + +pacman --noconfirm --needed -S git base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-clang mingw-w64-x86_64-lld mingw-w64-x86_64-llvm + +git config core.abbrev 9 + +ZIGBUILDDIR="$(pwd)/build" +PREFIX="$ZIGBUILDDIR/dist" +CMAKEFLAGS="-DCMAKE_COLOR_MAKEFILE=OFF -DCMAKE_INSTALL_PREFIX=$PREFIX -DZIG_STATIC=ON" + +mkdir $ZIGBUILDDIR +cd $ZIGBUILDDIR + +cmake .. -G 'MSYS Makefiles' -DCMAKE_BUILD_TYPE=RelWithDebInfo $CMAKEFLAGS -DCMAKE_EXE_LINKER_FLAGS='-fuse-ld=lld -Wl,/debug,/pdb:zig.pdb' + +make -j$(nproc) install + +./zig build test-behavior -Dskip-non-native -Dskip-release diff --git a/ci/azure/windows_msvc_install b/ci/azure/windows_msvc_install new file mode 100644 index 0000000000000000000000000000000000000000..ece3bbde114da94f1abe8ee5d1f90e30658a182f --- /dev/null +++ b/ci/azure/windows_msvc_install @@ -0,0 +1,10 @@ +#!/bin/sh + +set -x +set -e + +pacman -Su --needed --noconfirm +pacman -S --needed --noconfirm wget p7zip python3-pip +pip install s3cmd +wget -nv "https://ziglang.org/deps/llvm%2bclang%2blld-10.0.0-x86_64-windows-msvc-release-mt.tar.xz" +tar xf llvm+clang+lld-10.0.0-x86_64-windows-msvc-release-mt.tar.xz diff --git a/ci/azure/windows_msvc_script.bat b/ci/azure/windows_msvc_script.bat new file mode 100644 index 0000000000000000000000000000000000000000..b2063a8e5fa6e0af03b3d4a8780bc1914f738087 --- /dev/null +++ b/ci/azure/windows_msvc_script.bat @@ -0,0 +1,31 @@ +@echo on +SET "SRCROOT=%cd%" +SET "PREVPATH=%PATH%" +SET "PREVMSYSEM=%MSYSTEM%" + +set "PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem" +SET "MSYSTEM=MINGW64" +bash -lc "cd ${SRCROOT} && ci/azure/windows_msvc_install" || exit /b +SET "PATH=%PREVPATH%" +SET "MSYSTEM=%PREVMSYSTEM%" + +SET "ZIGBUILDDIR=%SRCROOT%\build" +SET "ZIGINSTALLDIR=%ZIGBUILDDIR%\dist" +SET "ZIGPREFIXPATH=%SRCROOT%\llvm+clang+lld-10.0.0-x86_64-windows-msvc-release-mt" + +call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 + +REM Make the `zig version` number consistent. +REM This will affect the cmake command below. +git.exe config core.abbrev 9 + +mkdir %ZIGBUILDDIR% +cd %ZIGBUILDDIR% +cmake.exe .. -Thost=x64 -G"Visual Studio 16 2019" -A x64 "-DCMAKE_INSTALL_PREFIX=%ZIGINSTALLDIR%" "-DCMAKE_PREFIX_PATH=%ZIGPREFIXPATH%" -DCMAKE_BUILD_TYPE=Release || exit /b +msbuild /maxcpucount /p:Configuration=Release INSTALL.vcxproj || exit /b + +"%ZIGINSTALLDIR%\bin\zig.exe" build test || exit /b + +set "PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem" +SET "MSYSTEM=MINGW64" +bash -lc "cd ${SRCROOT} && ci/azure/windows_upload" || exit /b diff --git a/ci/azure/windows_script.bat b/ci/azure/windows_script.bat deleted file mode 100644 index a8ae902de42293ddf6b372c63013f5b102b41cdc..0000000000000000000000000000000000000000 --- a/ci/azure/windows_script.bat +++ /dev/null @@ -1,31 +0,0 @@ -@echo on -SET "SRCROOT=%cd%" -SET "PREVPATH=%PATH%" -SET "PREVMSYSEM=%MSYSTEM%" - -set "PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem" -SET "MSYSTEM=MINGW64" -bash -lc "cd ${SRCROOT} && ci/azure/windows_install" || exit /b -SET "PATH=%PREVPATH%" -SET "MSYSTEM=%PREVMSYSTEM%" - -SET "ZIGBUILDDIR=%SRCROOT%\build" -SET "ZIGINSTALLDIR=%ZIGBUILDDIR%\dist" -SET "ZIGPREFIXPATH=%SRCROOT%\llvm+clang+lld-10.0.0-x86_64-windows-msvc-release-mt" - -call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 - -REM Make the `zig version` number consistent. -REM This will affect the cmake command below. -git.exe config core.abbrev 9 - -mkdir %ZIGBUILDDIR% -cd %ZIGBUILDDIR% -cmake.exe .. -Thost=x64 -G"Visual Studio 16 2019" -A x64 "-DCMAKE_INSTALL_PREFIX=%ZIGINSTALLDIR%" "-DCMAKE_PREFIX_PATH=%ZIGPREFIXPATH%" -DCMAKE_BUILD_TYPE=Release || exit /b -msbuild /maxcpucount /p:Configuration=Release INSTALL.vcxproj || exit /b - -"%ZIGINSTALLDIR%\bin\zig.exe" build test || exit /b - -set "PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem" -SET "MSYSTEM=MINGW64" -bash -lc "cd ${SRCROOT} && ci/azure/windows_upload" || exit /b