Skip to content

Commit

Permalink
Implement signature check for Travis and AppVeyor (telegramdesktop#3295)
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Auer <[email protected]>
  • Loading branch information
auchri authored Apr 19, 2017
1 parent 71e653d commit 6fa3122
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 6 deletions.
30 changes: 30 additions & 0 deletions .appveyor/check.bat
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions .appveyor/install.bat
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 25 additions & 0 deletions .travis/check.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 0 additions & 2 deletions .travis/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
}
Expand Down
3 changes: 3 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ matrix:
fast_finish: true

install:
- .\.appveyor\check.bat

before_build:
- .\.appveyor\install.bat

build:
Expand Down

0 comments on commit 6fa3122

Please sign in to comment.