diff options
author | Davide Beatrici <git@davidebeatrici.dev> | 2020-07-18 01:18:25 +0300 |
---|---|---|
committer | Davide Beatrici <git@davidebeatrici.dev> | 2020-07-18 01:18:25 +0300 |
commit | c182bc6db05736dd0f801187e8998cb7da2756f8 (patch) | |
tree | 2c168f3ce4f7c7a70bd7f7b4f84bb26aab6ed54b /.ci/azure-pipelines | |
parent | 530426961f47dea45fd54c1d872559d9f10d8eb1 (diff) |
REFAC(ci): move scripts to dedicated ".ci" folder
The "scripts" folder is quite cluttered, let's make it a bit better.
Diffstat (limited to '.ci/azure-pipelines')
-rwxr-xr-x | .ci/azure-pipelines/assertNoTranslationChanges.sh | 35 | ||||
-rwxr-xr-x | .ci/azure-pipelines/build_linux.bash | 38 | ||||
-rwxr-xr-x | .ci/azure-pipelines/build_macos.bash | 26 | ||||
-rw-r--r-- | .ci/azure-pipelines/build_windows.bat | 73 | ||||
-rwxr-xr-x | .ci/azure-pipelines/install-environment_linux.bash | 17 | ||||
-rwxr-xr-x | .ci/azure-pipelines/install-environment_linux_translations.bash | 13 | ||||
-rwxr-xr-x | .ci/azure-pipelines/install-environment_macos.bash | 28 | ||||
-rw-r--r-- | .ci/azure-pipelines/install-environment_windows.ps1 | 88 |
8 files changed, 318 insertions, 0 deletions
diff --git a/.ci/azure-pipelines/assertNoTranslationChanges.sh b/.ci/azure-pipelines/assertNoTranslationChanges.sh new file mode 100755 index 000000000..61aee535c --- /dev/null +++ b/.ci/azure-pipelines/assertNoTranslationChanges.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +# +# Copyright 2020 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>. + +set -e + +# Get path to the updatetranslations script +updateScript="$BUILD_SOURCESDIRECTORY/scripts/updatetranslations.sh" + +# Get current commit hash +oldHash=`git rev-parse HEAD` + +# In order for any commits to be possible, we'll have to set up a dummy user +git config user.name "CI" +git config user.email "ci@mumble.info" + +# Execute updatetranslations that'll commit any translation changes +$updateScript > /dev/null +echo + +# Ger new commit hash +newHash=`git rev-parse HEAD` + +# Check if the commit hash has changed (aka whether a commit has been made). +# If so that means that there are unprocessed translation changes. +if [[ "$oldHash" = "$newHash" ]]; then + echo "No translations have changed" + exit 0 +else + echo "[ERROR]: There are unprocessed translation changes!" + exit 1 +fi diff --git a/.ci/azure-pipelines/build_linux.bash b/.ci/azure-pipelines/build_linux.bash new file mode 100755 index 000000000..dc0e72bac --- /dev/null +++ b/.ci/azure-pipelines/build_linux.bash @@ -0,0 +1,38 @@ +#!/bin/bash -ex +# +# Copyright 2019-2020 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>. +# +# Below is a list of configuration variables used from environment. +# +# 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. +# + +VER=$(python scripts/mumble-version.py) + +cd $BUILD_BINARIESDIRECTORY + +# QSslDiffieHellmanParameters was introduced in Qt 5.8, Ubuntu 16.04 has 5.5. +cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=appdir/usr -DBUILD_TESTING=ON -Dversion=$VER -Dsymbols=ON -Dqssldiffiehellmanparameters=OFF $BUILD_SOURCESDIRECTORY +cmake --build . +ctest +cmake --install . + +wget -c -nv "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" +chmod a+x linuxdeployqt-continuous-x86_64.AppImage +ARCH=x86_64 ./linuxdeployqt-continuous-x86_64.AppImage $(find $HOME -type d -name 'appdir'| head -n 1)/usr/share/applications/*.desktop -appimage -extra-plugins=sqldrivers/libqsqlite.so + +for f in Mumble*.AppImage; do + # Embed update information into AppImage + echo -n "zsync|https://dl.mumble.info/nightly/latest-x86_64.AppImage.zsync" | dd of=$f seek=175720 conv=notrunc oflag=seek_bytes + + # Generate zsync file for AppImage + zsyncmake $f +done + +mv Mumble*.AppImage* $BUILD_ARTIFACTSTAGINGDIRECTORY diff --git a/.ci/azure-pipelines/build_macos.bash b/.ci/azure-pipelines/build_macos.bash new file mode 100755 index 000000000..f05256837 --- /dev/null +++ b/.ci/azure-pipelines/build_macos.bash @@ -0,0 +1,26 @@ +#!/bin/bash -ex +# +# Copyright 2019-2020 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>. +# +# Below is a list of configuration variables used from environment. +# +# 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. +# + +VER=$(python scripts/mumble-version.py) + +cd $BUILD_BINARIESDIRECTORY + +cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=$MUMBLE_ENVIRONMENT_TOOLCHAIN -DIce_HOME="$MUMBLE_ENVIRONMENT_PATH/installed/x64-osx" -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -Dversion=$VER -Dstatic=ON -Dsymbols=ON $BUILD_SOURCESDIRECTORY +cmake --build . +ctest + +$BUILD_SOURCESDIRECTORY/macx/scripts/osxdist.py --version=$VER --source-dir=$BUILD_SOURCESDIRECTORY --binary-dir=. + +mv *.dmg $BUILD_ARTIFACTSTAGINGDIRECTORY diff --git a/.ci/azure-pipelines/build_windows.bat b/.ci/azure-pipelines/build_windows.bat new file mode 100644 index 000000000..d9e2eb03a --- /dev/null +++ b/.ci/azure-pipelines/build_windows.bat @@ -0,0 +1,73 @@ +:: Copyright 2020 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>. +:: +:: Builds Mumble using the specified build script. +:: The path to the script is relative to the build environment's root. +:: The configuration we build with is adjusted to be close to +:: our release builds. +:: +:: 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 our build environment there, in the +:: folder specified by MUMBLE_ENVIRONMENT_DIR. +:: +:: Defined in .azure-pipelines.yml: +:: +:: MUMBLE_ENVIRONMENT_STORE - Path to the folder the build environment is stored in. +:: MUMBLE_ENVIRONMENT_SOURCE - Build environment web source folder URL +:: MUMBLE_ENVIRONMENT_VERSION - Full build environment version +:: Must match archive and extracted folder name. +:: MUMBLE_ENVIRONMENT_TOOLCHAIN - Path to the vcpkg CMake toolchain, used for CMake. +:: + +@echo on + +for /f "tokens=* USEBACKQ" %%g in (`python "scripts/mumble-version.py"`) do (SET "VER=%%g") + +cd /d %BUILD_BINARIESDIRECTORY% + +call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" + +:: 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 + +cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE="%MUMBLE_ENVIRONMENT_TOOLCHAIN%" -DVCPKG_TARGET_TRIPLET=x64-windows-static-md -DIce_HOME="%MUMBLE_ENVIRONMENT_PATH%\installed\x64-windows-static-md" -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -Dversion=%VER% -Dpackaging=ON -Dstatic=ON -Dsymbols=ON -Dasio=ON -Dg15=ON "%BUILD_SOURCESDIRECTORY%" + +if errorlevel 1 ( + exit /b %errorlevel% +) + +cmake --build . + +if errorlevel 1 ( + exit /b %errorlevel% +) + +ctest + +if errorlevel 1 ( + exit /b %errorlevel% +) + +cmake --install . + +if errorlevel 1 ( + exit /b %errorlevel% +) diff --git a/.ci/azure-pipelines/install-environment_linux.bash b/.ci/azure-pipelines/install-environment_linux.bash new file mode 100755 index 000000000..05fc4c6c5 --- /dev/null +++ b/.ci/azure-pipelines/install-environment_linux.bash @@ -0,0 +1,17 @@ +#!/bin/bash -ex +# +# Copyright 2019-2020 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>. + +sudo apt-get update + +sudo apt-get -y install build-essential g++-multilib ninja-build pkg-config \ + qt5-default qttools5-dev qttools5-dev-tools libqt5svg5-dev \ + libboost-dev libssl-dev libprotobuf-dev protobuf-compiler \ + libcap-dev libxi-dev \ + libasound2-dev libpulse-dev \ + libogg-dev libsndfile1-dev libspeechd-dev \ + libavahi-compat-libdnssd-dev libzeroc-ice-dev \ + zsync diff --git a/.ci/azure-pipelines/install-environment_linux_translations.bash b/.ci/azure-pipelines/install-environment_linux_translations.bash new file mode 100755 index 000000000..bcd162cb5 --- /dev/null +++ b/.ci/azure-pipelines/install-environment_linux_translations.bash @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# +# Copyright 2020 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>. + +set -e +set -x + +sudo apt-get update + +sudo apt-get -y install qttools5-dev-tools qt5-qmake diff --git a/.ci/azure-pipelines/install-environment_macos.bash b/.ci/azure-pipelines/install-environment_macos.bash new file mode 100755 index 000000000..944e8da2e --- /dev/null +++ b/.ci/azure-pipelines/install-environment_macos.bash @@ -0,0 +1,28 @@ +#!/bin/bash -ex +# +# Copyright 2019-2020 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>. + +cd $AGENT_TEMPDIRECTORY + +brew install ninja + +if [ -d $MUMBLE_ENVIRONMENT_PATH ]; then + exit 0 +fi + +echo "Environment not cached. Downloading..." + +wget "$MUMBLE_ENVIRONMENT_SOURCE/$MUMBLE_ENVIRONMENT_VERSION.tar.xz" + +echo "Extracting build environment to $MUMBLE_ENVIRONMENT_STORE..." + +mkdir -p $MUMBLE_ENVIRONMENT_STORE + +tar xf "$MUMBLE_ENVIRONMENT_VERSION.tar.xz" -C $MUMBLE_ENVIRONMENT_STORE + +chmod +x "$MUMBLE_ENVIRONMENT_PATH/installed/x64-osx/tools/Ice/slice2cpp" + +ls -l $MUMBLE_ENVIRONMENT_STORE diff --git a/.ci/azure-pipelines/install-environment_windows.ps1 b/.ci/azure-pipelines/install-environment_windows.ps1 new file mode 100644 index 000000000..0cd923849 --- /dev/null +++ b/.ci/azure-pipelines/install-environment_windows.ps1 @@ -0,0 +1,88 @@ +# Copyright 2019-2020 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. +# +# 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 our build environment there, in the +# folder specified by MUMBLE_ENVIRONMENT_DIR. +# +# 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_SOURCE - Build environment web source folder URL +# (e.g. https://somehost/folder). +# MUMBLE_ENVIRONMENT_VERSION - Full build environment version +# (e.g. win64-static-1.4.x-2020-05-27-ecb3c64-1151). +# Must match .7z and extracted folder name. +# + +Set-Location -Path $env:AGENT_TEMPDIRECTORY + +$SOURCE_DIR = $env:BUILD_SOURCESDIRECTORY + +$MUMBLE_ENVIRONMENT_STORE = $env:MUMBLE_ENVIRONMENT_STORE +$MUMBLE_ENVIRONMENT_VERSION = $env:MUMBLE_ENVIRONMENT_VERSION + +if (-Not (Test-Path $MUMBLE_ENVIRONMENT_STORE)) { + New-Item $MUMBLE_ENVIRONMENT_STORE -ItemType Directory | Out-Null +} + +if (-Not (Test-Path (Join-Path $MUMBLE_ENVIRONMENT_STORE $MUMBLE_ENVIRONMENT_VERSION))) { + Write-Host "Environment not cached. Downloading..." + + $env_url = "$env:MUMBLE_ENVIRONMENT_SOURCE/$MUMBLE_ENVIRONMENT_VERSION.7z" + $env_7z = Join-Path $MUMBLE_ENVIRONMENT_STORE "$MUMBLE_ENVIRONMENT_VERSION.7z"; + try { + # According to https://github.com/PowerShell/PowerShell/issues/2138 disabling the + # progress bar can significantly increase the speed of Invoke-Web-Request. + $ProgressPreference = 'SilentlyContinue' + + Invoke-WebRequest -Uri $env_url -OutFile $env_7z + + # Reset progress bar + $ProgressPreference = 'Continue' + } catch { + Write-Host "Failed to download build-environment: $PSItem" + exit 1 + } + + Write-Host "Extracting build environment to $MUMBLE_ENVIRONMENT_STORE..." + 7z x $env_7z -o"$MUMBLE_ENVIRONMENT_STORE" +} + +Write-Host "Downloading ASIO SDK..." + +try { + Invoke-WebRequest -Uri "https://dl.mumble.info/build/extra/asio_sdk.zip" -OutFile "asio_sdk.zip" + 7z x "asio_sdk.zip" + Move-Item -Path "asiosdk_2.3.3_2019-06-14" -Destination "$SOURCE_DIR/3rdparty/asio" +} catch { + Write-Host "Failed to download ASIO SDK: $PSItem" + exit 1 +} + +Write-Host "Downloading G15 SDK..." + +try { + Invoke-WebRequest -Uri "https://dl.mumble.info/build/extra/g15_sdk.zip" -OutFile "g15_sdk.zip" + 7z x "g15_sdk.zip" + Move-Item -Path "G15SDK/LCDSDK" -Destination "$SOURCE_DIR/3rdparty/g15" +} catch { + Write-Host "Failed to download G15 SDK: $PSItem" + exit 1 +} |