diff --git a/.appveyor/check.bat b/.appveyor/check.bat new file mode 100644 index 0000000000..54c1d3df70 --- /dev/null +++ b/.appveyor/check.bat @@ -0,0 +1,30 @@ +@echo off + +call:checkCommitMessage +GOTO:EOF + +:checkCommitMessage + call:logInfo "Commit message: %APPVEYOR_REPO_COMMIT_MESSAGE%" + call:logInfo "Is pull request: %APPVEYOR_PULL_REQUEST_NUMBER%" + + if not "%APPVEYOR_PULL_REQUEST_NUMBER%" == "" ( + ECHO "%APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDED%" | FINDSTR /C:"Signed-off-by: " >nul & IF ERRORLEVEL 1 ( + call:logError "The commit message does not contain the signature!" + call:logError "More information: https://github.com/telegramdesktop/tdesktop/blob/master/.github/CONTRIBUTING.md#sign-your-work" + exit 1 + ) else ( + call:logInfo "Commit message contains signature" + + :: Reset error level + verify >nul + ) + ) +GOTO:EOF + +:logInfo + echo [INFO] %~1 +GOTO:EOF + +:logError + echo [ERROR] %~1 +GOTO:EOF diff --git a/.appveyor/install.bat b/.appveyor/install.bat index d1317deb68..1e2e5e0b8c 100644 --- a/.appveyor/install.bat +++ b/.appveyor/install.bat @@ -1,14 +1,14 @@ @echo off SET BUILD_DIR=C:\TBuild -set LIB_DIR=%BUILD_DIR%\Libraries -set SRC_DIR=%BUILD_DIR%\tdesktop +SET LIB_DIR=%BUILD_DIR%\Libraries +SET SRC_DIR=%BUILD_DIR%\tdesktop SET QT_VERSION=5_6_2 -cd %BUILD_DIR% - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 +cd %BUILD_DIR% + call:configureBuild call:getDependencies call:setupGYP diff --git a/.travis.yml b/.travis.yml index fd5fa69556..48e2659e38 100644 --- a/.travis.yml +++ b/.travis.yml @@ -60,6 +60,8 @@ addons: - yasm before_install: + - "export TRAVIS_COMMIT_MSG=\"$(git log --format=%B --no-merges -n 1)\"" + - .travis/check.sh - export CXX="g++-6" CC="gcc-6" - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6 - sudo update-alternatives --config gcc diff --git a/.travis/check.sh b/.travis/check.sh new file mode 100755 index 0000000000..3985ac22e5 --- /dev/null +++ b/.travis/check.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Checks if the commit message contains the signature + +run() { + checkCommitMessage +} + +checkCommitMessage() { + info_msg "Commit message: ${TRAVIS_COMMIT_MSG}"; + info_msg "Is pull request: ${TRAVIS_PULL_REQUEST}"; + + if [[ $TRAVIS_PULL_REQUEST != "false" ]];then + if [[ $TRAVIS_COMMIT_MSG != *"Signed-off-by: "* ]];then + error_msg "The commit message does not contain the signature!" + error_msg "More information: https://github.com/telegramdesktop/tdesktop/blob/master/.github/CONTRIBUTING.md#sign-your-work" + exit 1 + else + success_msg "Commit message contains signature" + fi + fi +} + +source ./.travis/common.sh + +run diff --git a/.travis/common.sh b/.travis/common.sh index 2e7293b386..d9061ab51c 100755 --- a/.travis/common.sh +++ b/.travis/common.sh @@ -12,8 +12,6 @@ Pur='\e[0;35m'; BPur='\e[1;35m'; UPur='\e[4;35m'; IPur='\e[0;95m'; Cya='\e[0;36m'; BCya='\e[1;36m'; UCya='\e[4;36m'; ICya='\e[0;96m'; BICya='\e[1;96m'; On_Cya='\e[46m'; On_ICya='\e[0;106m'; Whi='\e[0;37m'; BWhi='\e[1;37m'; UWhi='\e[4;37m'; IWhi='\e[0;97m'; BIWhi='\e[1;97m'; On_Whi='\e[47m'; On_IWhi='\e[0;107m'; - - start_msg() { echo -e "\n${Gre}$*${RCol}" } diff --git a/appveyor.yml b/appveyor.yml index 67397c0a7e..37834f46f4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -15,6 +15,9 @@ matrix: fast_finish: true install: + - .\.appveyor\check.bat + +before_build: - .\.appveyor\install.bat build: