Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI and test infrastructure #241

Merged
merged 8 commits into from
Nov 24, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
build: add test build
  • Loading branch information
machinekoder committed Nov 22, 2017
commit 77dcf5c36abffc9c2f5abd90ae69cd63002c17ab
52 changes: 12 additions & 40 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,46 +10,18 @@ matrix:
# - env: "JOB=Android_armv7"
- env: "JOB=MacOSX"
include:
# 1st parallel build job - debug build on Ubuntu
# - env: "JOB=Tests"
# addons:
# apt:
# sources:
# - ubuntu-toolchain-r-test
# packages:
# - g++-4.9
# # not white listed - alsa
# - libsndfile1
# - wget
# - make
# - ant
# - curl
# - libasound2-dev
# - portaudio19-dev
# - libsndfile1-dev
# - zlib1g-dev
# - libfreetype6-dev
# - libfontconfig1-dev
# - lame
# - libmp3lame-dev
# - libegl1-mesa-dev
# - libegl1-mesa
# - ccache
# - libpulse-dev
# cache:
# directories:
# - $HOME/.ccache
# before_install:
# - "source build/travis/job1_Tests/environment.sh"
# install:
# - "./build/travis/job1_Tests/install.sh"
# before_script:
# - "./build/travis/job1_Tests/before_script.sh"
# script:
# - "./build/travis/job1_Tests/run_tests.sh"
# after_script:
# - ARTIFACTS_CACHE_CONTROL='public, max-age=315360000'
# - 'ARTIFACTS_PATHS="$(ls vtest/html | tr "\n" ":")" artifacts upload'
# 1st parallel build job - debug build and tests
- env: "JOB=Test_x64"
addons:
apt:
packages:
- bsdtar
- curl
# - zsync
services:
- docker
script:
- "./build/travis/job1_Test/build.sh --x86_64"

# 2nd parallel build job - portable Linux AppImage 64-bit x86 build on CentOS
- env: "JOB=AppImage_x64"
Expand Down
5 changes: 5 additions & 0 deletions apps/MachinekitClient/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,10 @@ Item {
{
connectionWindow.configurationFilePath = argument;
}
else if (option === '--test-deployment') {
if (argument === 'true') {
Qt.quit();
}
}
}
}
31 changes: 13 additions & 18 deletions build/Linux/android/Recipe
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
!/usr/bin/env bash
#!/usr/bin/env bash

# Build a portable AppImage starting from a clean system. Other examples at:
# https://github.com/probonopd/AppImages/blob/master/recipes/scribus/Recipe
Expand Down Expand Up @@ -37,29 +37,24 @@ fi
##########################################################################
# BUILD QTQUICKVCP
##########################################################################
export PATH="${PWD}/qt5/bin:$PATH"
export LD_LIBRARY_PATH="${PWD}/qt5/lib:$LD_LIBRARY_PATH"
export QT_PLUGIN_PATH="${PWD}/qt5/plugins"
export QML_IMPORT_PATH="${PWD}/qt5/qml"
export QML2_IMPORT_PATH="${PWD}/qt5/qml"
export QT_QPA_PLATFORM_PLUGIN_PATH="${PWD}/qt5/plugins/platforms"
export QT_INSTALL_PREFIX="${PWD}/qt5"

export ANDROID_NDK_ROOT="${PWD}/android-ndk"
export ANDROID_SDK_ROOT="${PWD}/android-sdk"
export ANDROID_HOME="${PWD}/android-sdk"

# If not building on Travis then might need to fetch QtQuickVcp
[ -d "QtQuickVcp" ] || git clone --depth 1 https://github.com/qtquickvcp/QtQuickVcp.git

cd QtQuickVcp
export PATH="/qt5/bin:$PATH"
export LD_LIBRARY_PATH="/qt5/lib:$LD_LIBRARY_PATH"
export QT_PLUGIN_PATH="/qt5/plugins"
export QML_IMPORT_PATH="/qt5/qml"
export QML2_IMPORT_PATH="/qt5/qml"
export QT_QPA_PLATFORM_PLUGIN_PATH="/qt5/plugins/platforms"
export QT_INSTALL_PREFIX="/qt5"

export ANDROID_NDK_ROOT="/android-ndk"
export ANDROID_SDK_ROOT="/android-sdk"
export ANDROID_HOME="/android-sdk"

mkdir -p build.release
cd build.release

# build QtQuickVcp
qmake -r ..
make
make -j$((`nproc` + 1))
make -C 3rdparty install
make -C src install
make INSTALL_ROOT=android-build install
Expand Down
32 changes: 15 additions & 17 deletions build/Linux/portable/Recipe
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ set -x # Be verbose
if [ "$(grep "Debian GNU/Linux 9 (stretch)" /etc/*release*)" ]; then
OS="Debian Stretch"
else
echo "${0}: Warning: Not running on Debian Jessie!" >&2
echo "${0}: Warning: Not running on Debian Stretch!" >&2
fi

##########################################################################
Expand All @@ -37,26 +37,21 @@ fi
##########################################################################
# BUILD QTQUICKVCP
##########################################################################
export PATH="${PWD}/qt5/bin:$PATH"
export LD_LIBRARY_PATH="${PWD}/qt5/lib:$LD_LIBRARY_PATH"
export QT_PLUGIN_PATH="${PWD}/qt5/plugins"
export QML_IMPORT_PATH="${PWD}/qt5/qml"
export QML2_IMPORT_PATH="${PWD}/qt5/qml"
export QT_QPA_PLATFORM_PLUGIN_PATH="${PWD}/qt5/plugins/platforms"
export QT_INSTALL_PREFIX="${PWD}/qt5"

# If not building on Travis then might need to fetch QtQuickVcp
[ -d "QtQuickVcp" ] || git clone --depth 1 https://github.com/qtquickvcp/QtQuickVcp.git

cd QtQuickVcp
export PATH="/qt5/bin:$PATH"
export LD_LIBRARY_PATH="/qt5/lib:$LD_LIBRARY_PATH"
export QT_PLUGIN_PATH="/qt5/plugins"
export QML_IMPORT_PATH="/qt5/qml"
export QML2_IMPORT_PATH="/qt5/qml"
export QT_QPA_PLATFORM_PLUGIN_PATH="/qt5/plugins/platforms"
export QT_INSTALL_PREFIX="/qt5"

mkdir -p build.release
cd build.release

qmake -r ..
make
make -j$((`nproc` + 1))
# make docs
make install
sudo make install
# make install_docs

# compress QtQuick module
Expand Down Expand Up @@ -88,13 +83,16 @@ appdir=${PWD}/MachinekitClient.AppDir/
appimage=${PWD}/MachinekitClient.AppImage

# back to home folder
cd ../../
cd ../

# cleanup plugins.qmltypes files here, since they have been created with sudo
sudo chown -R `whoami` ./build.release

##########################################################################
# PACKAGE INTO APPIMAGE WITH APPIMAGEKIT
##########################################################################

cd AppImageKit/AppImageAssistant.AppDir
cd /AppImageKit/AppImageAssistant.AppDir
./package "$appdir" "$appimage"

# allow access to AppImage from outside the chroot
Expand Down
66 changes: 66 additions & 0 deletions build/Linux/test/Recipe
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/usr/bin/env bash

# Run tests in a clean environment

# NOTES:
#
# 1) IT IS NOT SAFE TO RUN THIS RECIPE ON A PERSISTENT FILESYSTEM! Use either:
# * A chroot into a Live ISO, squashfs or Docker Image.
# * Or, a virtual machine on a dedicated build server (e.g. Travis CI)
# DO NOT RUN THE RECIPE ON A NORMAL COMPUTER OUTSIDE OF A TEMPORARY CHROOT!
#

set -e # Halt on errors
set -x # Be verbose

##########################################################################
# CHECK SYSTEM
##########################################################################

if [ "$(grep "Debian GNU/Linux 9 (stretch)" /etc/*release*)" ]; then
OS="Debian Stretch"
else
echo "${0}: Error: Not running on Debian Stretch!" >&2
exit 1
fi

##########################################################################
# BUILD APPLICATION
##########################################################################
export PATH="/qt5/bin:$PATH"
export LD_LIBRARY_PATH="/qt5/lib:$LD_LIBRARY_PATH"
export QT_PLUGIN_PATH="/qt5/plugins"
export QML_IMPORT_PATH="/qt5/qml"
export QML2_IMPORT_PATH="/qt5/qml"
export QT_QPA_PLATFORM_PLUGIN_PATH="/qt5/plugins/platforms"
export QT_INSTALL_PREFIX="/qt5"

# build and run unit tests
mkdir -p build.debug
cd build.debug
qmake -r CONFIG+=debug ..
make -j$((`nproc` + 1))
sudo make install

cd tests

#export QT_DEBUG_PLUGINS=1
# run all tests
for D in *; do
if [ -d "${D}" ]; then
cd $D
xvfb-run --server-args "-screen 0 1920x1080x24" ./$D
cd ..
fi
done

cd ..

# build and run MachinekitClient
# to see if deployment works
cd apps/MachinekitClient

xvfb-run --server-args "-screen 0 1920x1080x24" ./machinekit-client --test-deployment true

# back to home folder
cd ../../
18 changes: 18 additions & 0 deletions build/travis/job1_Test/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
# Run this script from QtQuickVcp's root directory

# QtQuickVcp Test build

set -e # exit on error
set -x # echo commands

# Run tests depending on arch specified in $1 if cross-compiling, else default build x86_64
case "$1" in
* )
[ "$1" == "--x86_64" ] && shift || true
# Build QtQuickVcp AppImage inside native (64-bit x86) Docker image
docker run -i -v "${PWD}:/QtQuickVcp" machinekoder/qtquickvcp-docker-linux-x64:latest \
/bin/bash -c "cd QtQuickVcp; ./build/Linux/test/Recipe"
platform="x64"
;;
esac
2 changes: 1 addition & 1 deletion build/travis/job2_AppImage/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ case "$1" in
[ "$1" == "--x86_64" ] && shift || true
# Build QtQuickVcp AppImage inside native (64-bit x86) Docker image
docker run -i -v "${PWD}:/QtQuickVcp" machinekoder/qtquickvcp-docker-linux-x64:latest \
/bin/bash -c "/QtQuickVcp/build/Linux/portable/Recipe"
/bin/bash -c "cd QtQuickVcp; ./build/Linux/portable/Recipe"
platform="x64"
;;
esac
Expand Down
2 changes: 1 addition & 1 deletion tests/halremotetests/halremotetests.pro
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ QT += network testlib

QT -= gui

TARGET = tst_halpintest
TARGET = halremotetests
CONFIG += console
CONFIG -= app_bundle
CONFIG += c++14
Expand Down
2 changes: 1 addition & 1 deletion tests/qmltests/qmltests.pro
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
TEMPLATE = app
TARGET = tst_qml
TARGET = qmltests
CONFIG += warn_on qmltestcase
CONFIG -= app_bundle
SOURCES += tst_qml.cpp
Expand Down