Implement signature check for Travis and AppVeyor (#3295)

Signed-off-by: Christoph Auer <auer.chrisi@gmx.net>
This commit is contained in:
Christoph 2017-04-19 14:57:45 +02:00 committed by GitHub
parent 71e653db30
commit 6fa3122bb6
6 changed files with 64 additions and 6 deletions

30
.appveyor/check.bat Normal file
View File

@ -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

View File

@ -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

View File

@ -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

25
.travis/check.sh Executable file
View File

@ -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

View File

@ -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}"
}

View File

@ -15,6 +15,9 @@ matrix:
fast_finish: true
install:
- .\.appveyor\check.bat
before_build:
- .\.appveyor\install.bat
build: