Integration of code parts from #177 provided by @KangLin to fix CI

This commit is contained in:
Nikolaos Ftylitakis 2021-05-06 13:35:57 +03:00
parent d48a139d03
commit 3431715632
5 changed files with 301 additions and 131 deletions

View File

@ -1,7 +1,7 @@
#Author: KangLin(kl222@126.com)
#sudo: required
dist: xenial
dist: bionic
services:
- xvfb
@ -9,9 +9,9 @@ services:
language: cpp
cache:
- apt: true
- apt
- directories:
- Tools
- Package
compiler:
- g++
@ -24,17 +24,15 @@ addons:
env:
jobs:
- BUILD_TARGERT="linux" QT_VERSION_DIR=5.13 QT_VERSION=5.13.0
# - BUILD_TARGERT="android_armv7" QT_VERSION_DIR=5.13 QT_VERSION=5.13.0
- BUILD_TARGERT="linux" QT_VERSION_DIR=5.12 QT_VERSION=5.12.4
# - BUILD_TARGERT="android_armv7" QT_VERSION_DIR=5.12 QT_VERSION=5.12.4
- BUILD_TARGERT="linux" QT_VERSION_DIR=5.9 QT_VERSION=5.9.8
# - BUILD_TARGERT="android_armv7" QT_VERSION_DIR=5.9 QT_VERSION=5.9.8
- BUILD_TARGERT="unix" DOWNLOAD_QT=APT
- BUILD_TARGERT="unix" QT_VERSION_DIR=512 QT_VERSION=5.12.6 DOWNLOAD_QT=FALSE
- BUILD_TARGERT="unix" QT_VERSION_DIR=511 QT_VERSION=5.11.3 DOWNLOAD_QT=FALSE
before_install:
- echo "TRAVIS_OS_NAME=${TRAVIS_OS_NAME}"
- export DISPLAY=:99.0
- sudo apt-get install -y libgl1-mesa-glx libgl1-mesa-dev
- cmake --version
install:
- bash ${TRAVIS_BUILD_DIR}/ci/build-install-tools.sh #> /dev/null
@ -43,7 +41,15 @@ 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
# Test qmake
- mkdir ${TRAVIS_BUILD_DIR}/build_qamke
- cd ${TRAVIS_BUILD_DIR}/build_qamke
- ${QT_ROOT}/bin/qmake CONFIG+=Release PRFIEX=`pwd`/install ${TRAVIS_BUILD_DIR}/src
- make install
# Test cmake (deactivated for now)
# - mkdir ${TRAVIS_BUILD_DIR}/build_camke
# - cd ${TRAVIS_BUILD_DIR}/build_camke
# - cmake -DQt5_DIR=${QT_ROOT}/lib/cmake/Qt5 -DCMAKE_INSTALL_PREFIX=`pwd`/install ${TRAVIS_BUILD_DIR}/src
# - cmake --build . --config Release
# - cmake --build . --config Release --target install

View File

@ -1,36 +1,30 @@
#original author: KangLin(kl222@126.com)
#original author: Kang Lin(kl222@126.com)
version: '3.0.a.5.{build}'
version: "3.0.a.5.{build}"
configuration:
- release
- debug
- Release
- Debug
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
QT_ROOT: C:/Qt/5.12/msvc2017_64
# - QT_ROOT: C:/Qt/5.12/msvc2015
# - QT_ROOT: C:/Qt/5.12/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
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
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
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
GENERATORS: "Visual Studio 14 2015"
QT_ROOT: C:/Qt/5.6/msvc2015
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
GENERATORS: "Visual Studio 14 2015 Win64"
QT_ROOT: C:/Qt/5.9/msvc2015_64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
GENERATORS: "Visual Studio 15 2017 Win64"
QT_ROOT: C:/Qt/5.12/msvc2017_64
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)
- 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"
@ -38,54 +32,62 @@ install:
- 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 (($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"
# Test qmake
- mkdir "%APPVEYOR_BUILD_FOLDER%/build_qmake"
- cd "%APPVEYOR_BUILD_FOLDER%/build_qmake"
- call "%QT_ROOT%/bin/qmake.exe" CONFIG+=%Configuration% PREFIX="%APPVEYOR_BUILD_FOLDER%/install_qmake" "%APPVEYOR_BUILD_FOLDER%/src"
- call %MAKE%
- call %MAKE% install
- call %MAKE% install
# Test cmake (deactivated for now)
# - mkdir "%APPVEYOR_BUILD_FOLDER%/build_cmake"
# - cd "%APPVEYOR_BUILD_FOLDER%/build_cmake"
# - cmake.exe -G"%GENERATORS%" -DCMAKE_INSTALL_PREFIX="%APPVEYOR_BUILD_FOLDER%/install_cmake" -DQt5_DIR="%QT_ROOT%/lib/cmake/Qt5" "%APPVEYOR_BUILD_FOLDER%/src"
# - cmake --build . --config %Configuration%
# - cmake --build . --config %Configuration% --target install
test_script:
artifacts:
- path: install
name: QZXing_$(QMAKE_XSPEC)$(TOOLCHAIN_VERSION)_$(CONFIGURATION)_$(BUILD_VERSION)
- path: install_qmake
name: QZXing_$(QMAKE_XSPEC)$(TOOLCHAIN_VERSION)_$(CONFIGURATION)_Qt$(QT_VERSION)_$(BUILD_VERSION)
type: zip
# whitelist branches to avoid testing feature branches twice (as branch and as pull request)
@ -97,6 +99,6 @@ deploy:
provider: GitHub
#token: https://github.com/settings/tokens encode token: https://ci.appveyor.com/tools/encrypt
auth_token:
secure: #TODO: set your token
secure: #TODO: set your token
on:
appveyor_repo_tag: true # deploy on tag push only
appveyor_repo_tag: true # deploy on tag push only

View File

@ -1,78 +1,194 @@
#!/bin/bash
#Author: KangLin(kl222@126.com)
#Author: Kang Lin(kl222@126.com)
set -e
SOURCE_DIR="`pwd`"
echo $SOURCE_DIR
TOOLS_DIR=${SOURCE_DIR}/Tools
echo ${TOOLS_DIR}
PACKAGE_DIR=${SOURCE_DIR}/Package
ThirdLibs_DIR=${TOOLS_DIR}/ThirdLibs
if [ ! -f "${TOOLS_DIR}" ]; then
mkdir -p ${TOOLS_DIR}
if [ ! -d "${TOOLS_DIR}" ]; then
mkdir ${TOOLS_DIR}
fi
if [ ! -d "$PACKAGE_DIR" ]; then
mkdir -p $PACKAGE_DIR
fi
function function_common()
{
cd ${TOOLS_DIR}
# Qt download and installhttps://github.com/benlau/qtci
if [ -n "${QT_VERSION}" ]; then
# See: https://github.com/benlau/qtci
cd ${TOOLS_DIR}
if [ "$DOWNLOAD_QT" = "TRUE" ]; then
QT_DIR=`pwd`/Qt/${QT_VERSION}
cd ${PACKAGE_DIR}
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
if [ "${QT_VERSION}" = "5.6.3" ]; then
if [ ! -f qt-opensource-linux-x64-android-${QT_VERSION}.run ]; then
wget -c --no-check-certificate -nv http://download.qt.io/official_releases/qt/${QT_VERSION_DIR}/${QT_VERSION}/qt-opensource-linux-x64-android-${QT_VERSION}.run
fi
bash ${SOURCE_DIR}/ci/qt-installer.sh qt-opensource-linux-x64-android-${QT_VERSION}.run ${QT_DIR}
#rm qt-opensource-linux-x64-android-${QT_VERSION}.run
else
if [ ! -f qt-opensource-linux-x64-${QT_VERSION}.run ]; 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
fi
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
fi
cd ${SOURCE_DIR}
}
function install_android()
{
if [ -n "$1" ]; then
NDK="ndk-bundle"
fi
cd ${TOOLS_DIR}
if [ ! -d "`pwd`/android-sdk" ]; then
cd ${PACKAGE_DIR}
ANDROID_STUDIO_VERSION=191.5900203
if [ ! -f android-studio-ide-${ANDROID_STUDIO_VERSION}-linux.tar.gz ]; then
wget -c -nv https://dl.google.com/dl/android/studio/ide-zips/3.5.1.0/android-studio-ide-${ANDROID_STUDIO_VERSION}-linux.tar.gz
fi
tar xzf android-studio-ide-${ANDROID_STUDIO_VERSION}-linux.tar.gz -C ${TOOLS_DIR}
cd ${TOOLS_DIR}
export JAVA_HOME=`pwd`/android-studio/jre
export PATH=${JAVA_HOME}/bin:$PATH
cd ${PACKAGE_DIR}
SDK_PACKAGE=sdk-tools-linux-4333796.zip
if [ ! -f ${SDK_PACKAGE} ]; then
wget -c -nv https://dl.google.com/android/repository/${SDK_PACKAGE}
fi
cd ${TOOLS_DIR}
mkdir android-sdk
cd android-sdk
unzip -q ${PACKAGE_DIR}/${SDK_PACKAGE} -d `pwd`
echo "Install sdk and ndk ......"
if [ -n "${ANDROID_API}" ]; then
PLATFORMS="platforms;${ANDROID_API}"
else
PLATFORMS="platforms"
fi
if [ -z "${BUILD_TOOS_VERSION}" ]; then
BUILD_TOOS_VERSION="28.0.3"
fi
(sleep 5 ; num=0 ; while [ $num -le 5 ] ; do sleep 1 ; num=$(($num+1)) ; printf 'y\r\n' ; done ) \
| ./tools/bin/sdkmanager "platform-tools" "build-tools;${BUILD_TOOS_VERSION}" "${PLATFORMS}" ${NDK}
if [ -n "${NDK}" ]; then
if [ ! -d ${TOOLS_DIR}/android-ndk ]; then
ln -s ${TOOLS_DIR}/android-sdk/ndk-bundle ${TOOLS_DIR}/android-ndk
fi
fi
fi
}
function install_android_sdk_and_ndk()
{
install_android
NDK_PACKAGE=android-ndk-r21-linux-x86_64.zip
cd ${PACKAGE_DIR}
if [ ! -f ${NDK_PACKAGE} ]; then
wget -c -nv https://dl.google.com/android/repository/${NDK_PACKAGE}
fi
unzip -q ${NDK_PACKAGE} -d ${TOOLS_DIR}
cd ${TOOLS_DIR}
mv android-ndk-r21 android-ndk
}
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
sudo apt-get update -y -qq
#sudo apt-get install -qq -y openjdk-11-jdk
# install oracle jdk
#sudo add-apt-repository ppa:linuxuprising/java -y
#sudo apt update
#(sleep 5 ; while true ; do sleep 1 ; printf '\r\n' ; done ) | sudo apt install oracle-java11-installer -qq -y
#sudo apt install oracle-java11-set-default -qq -y
#sudo apt-get install ant -qq -y
sudo apt-get install libicu-dev -qq -y
sudo apt-get install -qq -y libxkbcommon-x11-dev libglu1-mesa-dev
install_android_sdk_and_ndk
function_common
cd ${SOURCE_DIR}
}
function function_linux()
function function_unix()
{
if [ "$DOWNLOAD_QT" != "TRUE" -a "$DOWNLOAD_QT" != "APT" ]; then
#See: https://launchpad.net/~beineri
sudo add-apt-repository ppa:beineri/opt-qt-${QT_VERSION}-`lsb_release -c|awk '{print $2}'` -y
fi
sudo apt-get update -y -qq
sudo apt-get install debhelper fakeroot -y -qq
sudo apt-get install -y -qq libglu1-mesa-dev \
libxkbcommon-x11-dev \
libpulse-mainloop-glib0 \
libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev \
gstreamer1.0-pulseaudio \
libmysql-cil-dev libmysql-cil-dev libmysql-ocaml-dev \
libmysql++-dev libmysqld-dev libmysqlcppconn-dev \
libmysqlclient-dev \
libodbc1
if [ "$DOWNLOAD_QT" = "APT" ]; then
sudo apt-get install -y -qq qttools5-dev qttools5-dev-tools \
qtbase5-dev qtbase5-dev-tools \
qtmultimedia5-dev \
qtquickcontrols2-5-dev \
qtdeclarative5-dev \
libqt5svg5-dev
sudo ln -s /usr/lib/`uname -m`-linux-gnu/cmake /usr/lib/`uname -m`-linux-gnu/qt5/cmake
elif [ "$DOWNLOAD_QT" != "TRUE" ]; then
sudo apt-get install -y -qq qt${QT_VERSION_DIR}base \
qt${QT_VERSION_DIR}tools \
qt${QT_VERSION_DIR}multimedia \
qt${QT_VERSION_DIR}svg \
qt${QT_VERSION_DIR}quickcontrols2 \
qt${QT_VERSION_DIR}declarative
fi
function_common
cd ${SOURCE_DIR}
}
function function_mingw()
{
cd ${SOURCE_DIR}
if [ "true" == "$RABBITIM_BUILD_THIRDLIBRARY" ]; then
export RABBITIM_BUILD_CROSS_HOST=i686-w64-mingw32 #i586-mingw32msvc
fi
function_common
cd ${SOURCE_DIR}
}
case ${BUILD_TARGERT} in
android*)
android)
function_android
;;
linux)
function_linux
unix)
function_unix
;;
windows_mingw)
function_mingw
;;
*)
echo "There aren't ${BUILD_TARGERT}"
;;
esac
cd ${SOURCE_DIR}
cd ${SOURCE_DIR}

View File

@ -1,4 +1,4 @@
#Author: KangLin(kl222@126.com)
#Author: Kang Lin(kl222@126.com)
SOURCE_DIR="`pwd`"
echo $SOURCE_DIR
@ -7,11 +7,20 @@ 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
unix)
if [ "$DOWNLOAD_QT" = "APT" ]; then
export QT_ROOT=/usr/lib/`uname -m`-linux-gnu/qt5
elif [ "$DOWNLOAD_QT" = "TRUE" ]; then
QT_DIR=${TOOLS_DIR}/Qt/${QT_VERSION}
export QT_ROOT=${QT_DIR}/${QT_VERSION}/gcc_64
else
#source /opt/qt${QT_VERSION_DIR}/bin/qt${QT_VERSION_DIR}-env.sh
export QT_ROOT=/opt/qt${QT_VERSION_DIR}
fi
export PATH=$QT_ROOT/bin:$PATH
export LD_LIBRARY_PATH=$QT_ROOT/lib/i386-linux-gnu:$QT_ROOT/lib:$LD_LIBRARY_PATH
;;
android*)
android)
export ANDROID_NDK_ROOT=`pwd`/android-ndk
export ANDROID_NDK=$ANDROID_NDK_ROOT
@ -21,4 +30,4 @@ case "${BUILD_TARGERT}" in
QT_DIR=`pwd`/Qt/${QT_VERSION}
export QT_ROOT=${QT_DIR}/${QT_VERSION}/android_armv7
;;
esac
esac

View File

@ -1,8 +1,11 @@
#!/bin/bash
#Author: Kang Lin(kl222@126.com)
#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/rabits/dockerfiles
# https://github.com/mjscosta/qt-silent-installer
set -e #quit on error
@ -13,23 +16,47 @@ then
exit -1
fi
function version_gt() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; }
function version_le() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" == "$1"; }
function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" != "$1"; }
function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; }
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)
case $BUILD_ARCH in
unix)
SELECTEDPACKAGES=gcc_64
;;
*)
echo "Aach[$RABBIT_ARCH] don't suppoert"
arm*|x86*)
if version_ge $QT_VERSION_DIR 5.14 ; then
SELECTEDPACKAGES=android
else
case $BUILD_ARCH in
arm)
SELECTEDPACKAGES=android_armv7
;;
arm64)
SELECTEDPACKAGES=android_arm64_v8a
;;
x86)
SELECTEDPACKAGES=android_x86
;;
x86_64)
SELECTEDPACKAGES=android_x86_64
;;
*)
echo "Aach[$BUILD_ARCH] don't suppoert"
;;
esac
fi
;;
*)
echo "Aach[$BUILD_ARCH] don't suppoert"
;;
esac
cat <<EOF > $SCRIPT
@ -47,10 +74,19 @@ function log() {
}
Controller.prototype.WelcomePageCallback = function() {
gui.clickButton(buttons.NextButton, 5000);
gui.clickButton(buttons.NextButton, 3000);
}
Controller.prototype.CredentialsPageCallback = function() {
var login = installer.environmentVariable("QT_USER");
var password = installer.environmentVariable("QT_PASSWORD");
if( login === "" || password === "" ) {
console.log("No credentials provided - could stuck here forever");
gui.clickButton(buttons.CommitButton);
}
var widget = gui.currentPageWidget();
widget.loginWidget.EmailLineEdit.setText(login);
widget.loginWidget.PasswordLineEdit.setText(password);
gui.clickButton(buttons.CommitButton);
}
@ -128,6 +164,7 @@ Controller.prototype.FinishedPageCallback = function() {
EOF
chmod u+x $1
#显示log
$1 -v --script $SCRIPT
#不显示log
#$1 --script $SCRIPT