diff options
author | Davide Beatrici <git@davidebeatrici.dev> | 2021-04-29 09:39:20 +0300 |
---|---|---|
committer | Davide Beatrici <git@davidebeatrici.dev> | 2021-04-29 09:39:20 +0300 |
commit | fba63c731ef20f79b8bba49d301c613a7a748bef (patch) | |
tree | e1b0d7540f0b9e55ef04181a4f1f3665919938bf /.ci | |
parent | 35766199577cc3ab0f9b038df3a784b8aced4963 (diff) |
MAINT(ci): Move Windows scripts outside of the "azure-pipelines" folder
This commit also ensures we only use variables defined in the configuration file(s).
WixSharp is updated to the latest version.
Diffstat (limited to '.ci')
-rw-r--r-- | .ci/azure-pipelines/main-pr.yml | 3 | ||||
-rw-r--r-- | .ci/azure-pipelines/main.yml | 3 | ||||
-rw-r--r-- | .ci/azure-pipelines/steps_windows.yml | 4 | ||||
-rw-r--r-- | .ci/build_windows.bat (renamed from .ci/azure-pipelines/build_windows.bat) | 45 | ||||
-rw-r--r-- | .ci/install-environment_windows.ps1 (renamed from .ci/azure-pipelines/install-environment_windows.ps1) | 40 |
5 files changed, 36 insertions, 59 deletions
diff --git a/.ci/azure-pipelines/main-pr.yml b/.ci/azure-pipelines/main-pr.yml index 229af1654..51cc89561 100644 --- a/.ci/azure-pipelines/main-pr.yml +++ b/.ci/azure-pipelines/main-pr.yml @@ -8,6 +8,9 @@ variables: MUMBLE_ENVIRONMENT_SOURCE: 'https://dl.mumble.info/build/vcpkg' MUMBLE_ENVIRONMENT_PATH: '$(MUMBLE_ENVIRONMENT_STORE)/$(MUMBLE_ENVIRONMENT_VERSION)' MUMBLE_ENVIRONMENT_TOOLCHAIN: '$(MUMBLE_ENVIRONMENT_PATH)/scripts/buildsystems/vcpkg.cmake' + MUMBLE_SOURCE_COMMIT: '$(Build.SourceVersion)' + MUMBLE_SOURCE_REPOSITORY: '$(Build.SourcesDirectory)' + MUMBLE_BUILD_DIRECTORY: '$(Build.BinariesDirectory)' # We set this to an empty String explicitly as the variable is not set for PR builds but it is required # to be an empty String in that case. That's why we have to set it here. For Nightly builds the # variable is set on Azure itself. diff --git a/.ci/azure-pipelines/main.yml b/.ci/azure-pipelines/main.yml index 5d1058a7d..0a79cb023 100644 --- a/.ci/azure-pipelines/main.yml +++ b/.ci/azure-pipelines/main.yml @@ -8,6 +8,9 @@ variables: MUMBLE_ENVIRONMENT_SOURCE: 'https://dl.mumble.info/build/vcpkg' MUMBLE_ENVIRONMENT_PATH: '$(MUMBLE_ENVIRONMENT_STORE)/$(MUMBLE_ENVIRONMENT_VERSION)' MUMBLE_ENVIRONMENT_TOOLCHAIN: '$(MUMBLE_ENVIRONMENT_PATH)/scripts/buildsystems/vcpkg.cmake' + MUMBLE_SOURCE_COMMIT: '$(Build.SourceVersion)' + MUMBLE_SOURCE_REPOSITORY: '$(Build.SourcesDirectory)' + MUMBLE_BUILD_DIRECTORY: '$(Build.BinariesDirectory)' # On Azure we have a secret variable called BUILD_NUMBER_TOKEN that will be referenced in the following # YAML files. As it is set there though, we don't have to specify it here. diff --git a/.ci/azure-pipelines/steps_windows.yml b/.ci/azure-pipelines/steps_windows.yml index 6b4fdfefa..549e52e56 100644 --- a/.ci/azure-pipelines/steps_windows.yml +++ b/.ci/azure-pipelines/steps_windows.yml @@ -6,9 +6,9 @@ steps: - script: git submodule --quiet update --init --recursive displayName: 'Fetch submodules' - - powershell: .ci/azure-pipelines/install-environment_windows.ps1 + - powershell: .ci/install-environment_windows.ps1 displayName: 'Install build environment' - - script: .ci/azure-pipelines/build_windows.bat + - script: .ci/build_windows.bat env: MUMBLE_BUILD_NUMBER_TOKEN: $(BUILD_NUMBER_TOKEN) displayName: 'Build' diff --git a/.ci/azure-pipelines/build_windows.bat b/.ci/build_windows.bat index 525e8517f..fd65e8996 100644 --- a/.ci/azure-pipelines/build_windows.bat +++ b/.ci/build_windows.bat @@ -1,4 +1,4 @@ -:: Copyright 2020-2021 The Mumble Developers. All rights reserved. +:: Copyright 2021 The Mumble Developers. All rights reserved. :: Use of this source code is governed by a BSD-style license :: that can be found in the LICENSE file at the root of the :: Mumble source tree or at <https://www.mumble.info/LICENSE>. @@ -10,28 +10,15 @@ :: :: Below is a list of configuration variables used from environment. :: -:: Predefined variables: -:: -:: BUILD_BINARIESDIRECTORY - The local path on the agent that can be used -:: as an output folder for compiled binaries. -:: BUILD_SOURCESDIRECTORY - The local path on the agent where the -:: repository is downloaded. -:: AGENT_TOOLSDIRECTORY - The directory used by tasks such as -:: Node Tool Installer and Use Python Version -:: to switch between multiple versions of a tool. -:: We store Wix# there, in "WixSharp". -:: -:: Defined in .azure-pipelines.yml: -:: +:: MUMBLE_BUILD_DIRECTORY - Output directory. +:: MUMBLE_BUILD_NUMBER_TOKEN - Access token for the build number page on our server. :: MUMBLE_ENVIRONMENT_PATH - Path to the environment's root directory. :: MUMBLE_ENVIRONMENT_TOOLCHAIN - Path to the vcpkg CMake toolchain, used for CMake. :: MUMBLE_ENVIRONMENT_TRIPLET - vcpkg triplet. +:: MUMBLE_SOURCE_COMMIT - Hash of the Git commit that is being built. +:: MUMBLE_SOURCE_REPOSITORY - Path to the cloned repository. :: VCVARS_PATH - Path to the Visual Studio environment initialization script. :: -:: Defined on Azure Pipelines: -:: -:: MUMBLE_BUILD_NUMBER_TOKEN - Access token for the build number page on our server. -:: @echo on @@ -43,7 +30,7 @@ for /f "tokens=* USEBACKQ" %%g in (`python "scripts\mumble-version.py" --format :: in that case the variable substitution of that variable in the expression below fails (is replaced with empty string) :: Also we can't anything else inside the if body as this will cause the curl command to always be executed. if defined MUMBLE_BUILD_NUMBER_TOKEN ( - for /f "tokens=* USEBACKQ" %%g in (`curl "https://mumble.info/get-build-number?commit=%BUILD_SOURCEVERSION%&version=%VERSION%&token=%MUMBLE_BUILD_NUMBER_TOKEN%"`) do (set "BUILD_NUMBER=%%g") + for /f "tokens=* USEBACKQ" %%g in (`curl "https://mumble.info/get-build-number?commit=%MUMBLE_SOURCE_COMMIT%&version=%VERSION%&token=%MUMBLE_BUILD_NUMBER_TOKEN%"`) do (set "BUILD_NUMBER=%%g") ) else ( echo Build number token not set - defaulting to 0 set BUILD_NUMBER=0 @@ -51,26 +38,21 @@ if defined MUMBLE_BUILD_NUMBER_TOKEN ( for /f "tokens=* USEBACKQ" %%g in (`python "scripts\mumble-version.py"`) do (set "RELEASE_ID=%%g") -cd /d %BUILD_BINARIESDIRECTORY% +:: Create build directory if it doesn't exist. +if not exist "%MUMBLE_BUILD_DIRECTORY%" mkdir "%MUMBLE_BUILD_DIRECTORY% -call "%VCVARS_PATH%" +cd "%MUMBLE_BUILD_DIRECTORY%" -set PATH=%PATH%;%AGENT_TOOLSDIRECTORY%\WixSharp +call "%VCVARS_PATH%" -:: Delete MinGW, otherwise CMake picks it over MSVC. -:: We don't delete the (Chocolatey) packages because it takes ~10 minutes... -del C:\ProgramData\chocolatey\bin\gcc.exe -del C:\ProgramData\chocolatey\bin\g++.exe -del C:\ProgramData\chocolatey\bin\c++.exe -del C:\Strawberry\c\bin\gcc.exe -del C:\Strawberry\c\bin\g++.exe -del C:\Strawberry\c\bin\c++.exe +set PATH=%PATH%;C:\WixSharp cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE="%MUMBLE_ENVIRONMENT_TOOLCHAIN%" -DVCPKG_TARGET_TRIPLET=%MUMBLE_ENVIRONMENT_TRIPLET% ^ -DIce_HOME="%MUMBLE_ENVIRONMENT_PATH%\installed\%MUMBLE_ENVIRONMENT_TRIPLET%" ^ + -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe ^ -DCMAKE_BUILD_TYPE=Release -DCMAKE_UNITY_BUILD=ON -DRELEASE_ID=%RELEASE_ID% -DBUILD_NUMBER=%BUILD_NUMBER% ^ -Dpackaging=ON -Dtests=ON -Dstatic=ON -Dsymbols=ON -Dgrpc=ON -Dasio=ON -Dg15=ON ^ - -Ddisplay-install-paths=ON "%BUILD_SOURCESDIRECTORY%" + -Ddisplay-install-paths=ON %MUMBLE_SOURCE_REPOSITORY% if errorlevel 1 ( exit /b %errorlevel% @@ -81,4 +63,3 @@ cmake --build . if errorlevel 1 ( exit /b %errorlevel% ) - diff --git a/.ci/azure-pipelines/install-environment_windows.ps1 b/.ci/install-environment_windows.ps1 index b1b8dea6d..937e19463 100644 --- a/.ci/azure-pipelines/install-environment_windows.ps1 +++ b/.ci/install-environment_windows.ps1 @@ -1,33 +1,22 @@ -# Copyright 2020-2021 The Mumble Developers. All rights reserved. +# Copyright 2021 The Mumble Developers. All rights reserved. # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file at the root of the # Mumble source tree or at <https://www.mumble.info/LICENSE>. # -# Ensures we have downloaded and extracted a build environment -# into our Azure Pipelines VM before we attempt to build. If the -# environment archive is already present, this script will just extract it. +# Ensures we have downloaded and extracted a build environment into our AppVeyor +# VM before we attempt to build. If the environment archive is already present, +# this script will just extract it. # # Below is a list of configuration variables used from environment. # -# Predefined variables: -# -# AGENT_TEMPDIRECTORY - A temporary folder that is cleaned after each pipeline job. -# This directory is used by tasks such as .NET Core CLI task -# to hold temporary items like test results before they are published. -# AGENT_TOOLSDIRECTORY - The directory used by tasks such as -# Node Tool Installer and Use Python Version -# to switch between multiple versions of a tool. -# We store Wix# there, in "WixSharp". -# -# Defined in .azure-pipelines.yml: -# -# MUMBLE_ENVIRONMENT_STORE - Path to the folder the build environment is stored in. -# (e.g. c:\hostedtoolcache\windows\MumbleBuild). +# MUMBLE_ENVIRONMENT_STORE - Path to the folder the build environment is stored in +# (e.g. C:/MumbleBuild). # MUMBLE_ENVIRONMENT_SOURCE - Build environment web source folder URL -# (e.g. https://somehost/folder). +# (e.g. https://dl.mumble.info/build/vcpkg/windows-static-1.4.x~2021-04-26~7da4529f.x64.7z). # MUMBLE_ENVIRONMENT_VERSION - Full build environment version -# (e.g. win64-static-1.4.x-2020-05-27-ecb3c64-1151). +# (e.g. windows-static-1.4.x~2021-04-26~7da4529f.x64). # Must match .7z and extracted folder name. +# MUMBLE_SOURCE_REPOSITORY - Path to the cloned repository. # # Always quit on encountered errors @@ -92,9 +81,10 @@ function Download { } -Set-Location -Path $env:AGENT_TEMPDIRECTORY +$TEMP_DIR = [System.IO.Path]::GetTempPath() +Set-Location -Path $TEMP_DIR -$SOURCE_DIR = $env:BUILD_SOURCESDIRECTORY +$SOURCE_DIR = $env:MUMBLE_SOURCE_REPOSITORY $MUMBLE_ENVIRONMENT_STORE = $env:MUMBLE_ENVIRONMENT_STORE $MUMBLE_ENVIRONMENT_VERSION = $env:MUMBLE_ENVIRONMENT_VERSION @@ -131,9 +121,9 @@ Move-Item -Path "G15SDK/LCDSDK" -Destination "$SOURCE_DIR/3rdparty/g15" Write-Host "Downloading WixSharp..." -Download -source "https://github.com/oleg-shilo/wixsharp/releases/download/v1.15.0.0/WixSharp.1.15.0.0.7z" -destination "WixSharp.1.15.0.0.7z" -Write-Host "Exracting WixSharp to $env:AGENT_TOOLSDIRECTORY/WixSharp..." -Invoke-Command 7z x "WixSharp.1.15.0.0.7z" "-o$env:AGENT_TOOLSDIRECTORY/WixSharp" +Download -source "https://github.com/oleg-shilo/wixsharp/releases/download/v1.16.2.0/WixSharp.1.16.2.0.7z" -destination "WixSharp.7z" +Write-Host "Exracting WixSharp to C:/WixSharp..." +Invoke-Command 7z x "WixSharp.7z" "-oC:/WixSharp" Write-Host "Build environment successfully installed" |