Merge pull request #93 from KangLin/master

Add ci
This commit is contained in:
Nikolaos Ftylitakis 2018-11-14 19:30:33 +02:00 committed by GitHub
commit 678240100c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 397 additions and 0 deletions

49
.travis.yml Normal file
View File

@ -0,0 +1,49 @@
#Author: KangLin(kl222@126.com)
sudo: required
dist: trusty
language: cpp
cache:
- apt: true
- directories:
- Tools
compiler:
- g++
jdk: oraclejdk7
os:
- unix
addons:
ssh_known_hosts:
- github.com
env:
matrix:
- BUILD_TARGERT="linux" QT_VERSION_DIR=5.11 QT_VERSION=5.11.2
- BUILD_TARGERT="android_armv7" QT_VERSION_DIR=5.11 QT_VERSION=5.11.2
- BUILD_TARGERT="linux" QT_VERSION_DIR=5.10 QT_VERSION=5.10.1
- BUILD_TARGERT="android_armv7" QT_VERSION_DIR=5.10 QT_VERSION=5.10.1
- BUILD_TARGERT="linux" QT_VERSION_DIR=5.9 QT_VERSION=5.9.7
- BUILD_TARGERT="android_armv7" QT_VERSION_DIR=5.9 QT_VERSION=5.9.7
before_install:
- echo "TRAVIS_OS_NAME=${TRAVIS_OS_NAME}"
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
install:
- bash ${TRAVIS_BUILD_DIR}/ci/build-install-tools.sh #> /dev/null
before_script:
- source ${TRAVIS_BUILD_DIR}/ci/build_env.sh
script:
- mkdir ${TRAVIS_BUILD_DIR}/build
- cd ${TRAVIS_BUILD_DIR}/build
- ${QT_ROOT}/bin/qmake -o Makefile CONFIG+=Release ${TRAVIS_BUILD_DIR}/src/QZXing.pro
- make -f Makefile

113
appveyor.yml Normal file
View File

@ -0,0 +1,113 @@
#Author: KangLin(kl222@126.com)
version: '0.1.1.{build}'
image: Visual Studio 2015
configuration:
- release
- debug
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
QT_ROOT: C:/Qt/5.11/msvc2017_64
- QT_ROOT: C:/Qt/5.11/msvc2015
- QT_ROOT: C:/Qt/5.11/mingw53_32
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
QT_ROOT: C:/Qt/5.10/msvc2017_64
- QT_ROOT: C:/Qt/5.10/msvc2015_64
- QT_ROOT: C:/Qt/5.10/msvc2015
- QT_ROOT: C:/Qt/5.10/msvc2013_64
- QT_ROOT: C:/Qt/5.10/mingw53_32
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
QT_ROOT: C:/Qt/5.9/msvc2017_64
- QT_ROOT: C:/Qt/5.9/msvc2015_64
- QT_ROOT: C:/Qt/5.9/msvc2015
- QT_ROOT: C:/Qt/5.9/msvc2013_64
- QT_ROOT: C:/Qt/5.9/mingw53_32
- QT_ROOT: C:/Qt/5.7.0/msvc2015
- QT_ROOT: C:/Qt/5.7.0/mingw53_32
- QT_ROOT: C:/Qt/5.6/msvc2015_64
- QT_ROOT: C:/Qt/5.6/msvc2015
- QT_ROOT: C:/Qt/5.6/msvc2013_64
- QT_ROOT: C:/Qt/5.6/msvc2013
init:
install:
- for /f "delims=" %%i in ('git describe --tags') do (set BUILD_VERSION=%%i)
- if "%BUILD_VERSION%" == "" for /f "delims=" %%i in ('git rev-parse HEAD') do (set BUILD_VERSION=%%i)
- echo BUILD_VERSION=%BUILD_VERSION%
- if NOT "%QT_ROOT%" == "NO" for /f "delims=" %%i in ('%QT_ROOT%/bin/qmake -query QT_VERSION') do (set QT_VERSION=%%i)
- echo "QT_VERSION:%QT_VERSION"
- if NOT "%QT_ROOT%" == "NO" for /f "delims=" %%i in ('%QT_ROOT%/bin/qmake -query QMAKE_XSPEC') do (set QMAKE_XSPEC=%%i)
- echo "QMAKE_XSPEC=%QMAKE_XSPEC%"
- set TOOLCHAIN_VERSION=""
- ps: >-
if (($env:QMAKE_XSPEC).Contains("msvc"))
{
$env:MAKE="nmake"
if (($env:QT_ROOT).Contains("_64"))
{
$env:varch="amd64"
}
else
{
$env:varch="x86"
}
if (($env:QT_ROOT).Contains("2017"))
{
$env:TOOLCHAIN_VERSION="15"
}
else
{
if (($env:QT_ROOT).Contains("2015"))
{
$env:TOOLCHAIN_VERSION="14"
}elseif (($env:QT_ROOT).Contains("2013"))
{
$env:TOOLCHAIN_VERSION="12"
}
}
}
else
{
$env:MAKE="mingw32-make"
$env:PATH="C:\Qt\Tools\mingw530_32;$env:PATH"
}
- if NOT "%TOOLCHAIN_VERSION%"=="" if %TOOLCHAIN_VERSION% LSS 15 (call "C:/Program Files (x86)/Microsoft Visual Studio %TOOLCHAIN_VERSION%.0/VC/vcvarsall.bat" %varch%) else (call "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Auxiliary/Build/vcvarsall.bat" %varch%)
- echo "cl "
- cl
build_script:
- mkdir "%APPVEYOR_BUILD_FOLDER%/build"
- cd "%APPVEYOR_BUILD_FOLDER%/build"
- call "%QT_ROOT%/bin/qmake.exe" CONFIG+=%Configuration% PREFIX="%APPVEYOR_BUILD_FOLDER%/install" "%APPVEYOR_BUILD_FOLDER%/src/QZXing.pro"
- call %MAKE%
- call %MAKE% install
test_script:
artifacts:
- path: install
name: QZXing_$(QMAKE_XSPEC)$(TOOLCHAIN_VERSION)_$(CONFIGURATION)_$(BUILD_VERSION)
type: zip
# whitelist branches to avoid testing feature branches twice (as branch and as pull request)
branches:
only:
- master
deploy:
provider: GitHub
#token: https://github.com/settings/tokens encode token: https://ci.appveyor.com/tools/encrypt
auth_token:
secure: #TODO: set your token
on:
appveyor_repo_tag: true # deploy on tag push only

78
ci/build-install-tools.sh Normal file
View File

@ -0,0 +1,78 @@
#!/bin/bash
#Author: KangLin(kl222@126.com)
set -e
SOURCE_DIR="`pwd`"
echo $SOURCE_DIR
TOOLS_DIR=${SOURCE_DIR}/Tools
echo ${TOOLS_DIR}
if [ ! -f "${TOOLS_DIR}" ]; then
mkdir -p ${TOOLS_DIR}
fi
function function_common()
{
cd ${TOOLS_DIR}
# Qt download and installhttps://github.com/benlau/qtci
if [ -n "${QT_VERSION}" ]; then
QT_DIR=`pwd`/Qt/${QT_VERSION}
if [ ! -d "${QT_DIR}" ]; then
wget -c --no-check-certificate -nv http://download.qt.io/official_releases/qt/${QT_VERSION_DIR}/${QT_VERSION}/qt-opensource-linux-x64-${QT_VERSION}.run
bash ${SOURCE_DIR}/ci/qt-installer.sh qt-opensource-linux-x64-${QT_VERSION}.run ${QT_DIR}
rm qt-opensource-linux-x64-${QT_VERSION}.run
fi
fi
}
function function_android()
{
cd ${TOOLS_DIR}
#Download android ndk
if [ ! -d "`pwd`/android-ndk" ]; then
wget -c -nv http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin
chmod u+x android-ndk-r10e-linux-x86_64.bin
./android-ndk-r10e-linux-x86_64.bin > /dev/null
mv android-ndk-r10e android-ndk
rm android-ndk-r10e-linux-x86_64.bin
fi
cd ${TOOLS_DIR}
#Download android sdk
if [ ! -d "`pwd`/android-sdk" ]; then
wget -c -nv https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
tar xf android-sdk_r24.4.1-linux.tgz
mv android-sdk-linux android-sdk
rm android-sdk_r24.4.1-linux.tgz
(sleep 5 ; while true ; do sleep 1 ; printf 'y\r\n' ; done ) \
| android-sdk/tools/android update sdk -u -t tool,android-18,android-24,extra,platform,platform-tools,build-tools-25
fi
function_common
cd ${SOURCE_DIR}
}
function function_linux()
{
function_common
cd ${SOURCE_DIR}
}
case ${BUILD_TARGERT} in
android*)
function_android
;;
linux)
function_linux
;;
*)
echo "There aren't ${BUILD_TARGERT}"
;;
esac
cd ${SOURCE_DIR}

24
ci/build_env.sh Normal file
View File

@ -0,0 +1,24 @@
#Author: KangLin(kl222@126.com)
SOURCE_DIR="`pwd`"
echo $SOURCE_DIR
TOOLS_DIR=${SOURCE_DIR}/Tools
cd ${TOOLS_DIR}
case "${BUILD_TARGERT}" in
linux)
QT_DIR=`pwd`/Qt/${QT_VERSION}
export QT_ROOT=${QT_DIR}/${QT_VERSION}/gcc_64
;;
android*)
export ANDROID_NDK_ROOT=`pwd`/android-ndk
export ANDROID_NDK=$ANDROID_NDK_ROOT
export ANDROID_SDK_ROOT=`pwd`/android-sdk
export ANDROID_SDK=$ANDROID_SDK_ROOT
QT_DIR=`pwd`/Qt/${QT_VERSION}
export QT_ROOT=${QT_DIR}/${QT_VERSION}/android_armv7
;;
esac

133
ci/qt-installer.sh Normal file
View File

@ -0,0 +1,133 @@
#!/bin/bash
#http://stackoverflow.com/questions/25105269/silent-install-qt-run-installer-on-ubuntu-server
#http://doc.qt.io/qtinstallerframework/noninteractive.html
#参考https://github.com/benlau/qtci
# https://github.com/mjscosta/qt-silent-installer
set -e #quit on error
if [ $# -lt 2 ];
then
echo qt-installer.sh qt-installer-file output_path
exit -1
fi
export PATH=$PATH:$PWD
export WORKDIR=$PWD
INSTALLER=$1
OUTPUT=$2
SCRIPT="$(mktemp /tmp/tmp.XXXXXXXXX)"
case $BUILD_TARGERT in
android_arm*)
SELECTEDPACKAGES=android_armv7
;;
android_x86)
SELECTEDPACKAGES=android_x86
;;
linux)
SELECTEDPACKAGES=gcc_64
;;
*)
echo "Aach[$RABBIT_ARCH] don't suppoert"
esac
cat <<EOF > $SCRIPT
function Controller() {
installer.autoRejectMessageBoxes();
installer.installationFinished.connect(function() {
gui.clickButton(buttons.NextButton);
});
}
function log() {
var msg = ["QTCI: "].concat([].slice.call(arguments));
console.log(msg.join(" "));
}
Controller.prototype.WelcomePageCallback = function() {
gui.clickButton(buttons.NextButton, 5000);
}
Controller.prototype.CredentialsPageCallback = function() {
gui.clickButton(buttons.CommitButton);
}
Controller.prototype.ComponentSelectionPageCallback = function() {
var components = installer.components();
log("Available components: " + components.length);
for (var i = 0 ; i < components.length ;i++) {
log(components[i].name);
}
log("Select components");
function trim(str) {
return str.replace(/^ +/,"").replace(/ *$/,"");
}
var widget = gui.currentPageWidget();
widget.deselectAll();
var packages = trim("$SELECTEDPACKAGES").split(",");
if (packages.length > 0 && packages[0] !== "") {
for (var i in packages) {
var pkg = trim(packages[i]);
for (var i = 0 ; i < components.length ;i++) {
if(components[i].name.indexOf(pkg) != -1)
{
log("Select " + components[i].name);
widget.selectComponent(trim(components[i].name));
}
}
}
} else {
log("Use default component list");
}
gui.clickButton(buttons.NextButton);
}
Controller.prototype.IntroductionPageCallback = function() {
gui.clickButton(buttons.NextButton);
}
Controller.prototype.TargetDirectoryPageCallback = function() {
var widget = gui.currentPageWidget();
if (widget != null) {
widget.TargetDirectoryLineEdit.setText("$OUTPUT");
}
gui.clickButton(buttons.NextButton);
}
Controller.prototype.LicenseAgreementPageCallback = function() {
var widget = gui.currentPageWidget();
if (widget != null) {
widget.AcceptLicenseRadioButton.setChecked(true);
}
gui.clickButton(buttons.NextButton);
}
Controller.prototype.StartMenuDirectoryPageCallback = function() {
gui.clickButton(buttons.CommitButton);
}
Controller.prototype.ReadyForInstallationPageCallback = function() {
gui.clickButton(buttons.CommitButton);
}
Controller.prototype.FinishedPageCallback = function() {
var widget = gui.currentPageWidget();
widget.LaunchQtCreatorCheckBoxForm.launchQtCreatorCheckBox.setChecked(false);
gui.clickButton(buttons.FinishButton);
}
EOF
chmod u+x $1
$1 -v --script $SCRIPT