Microsoft Azure Pipeline added

(mit unbegrenzten Minuten und mit bis zu 10 kostenlosen parallelen Jobs)

Signed-off-by: Paulchen-Panther <Paulchen-Panter@protonmail.com>
This commit is contained in:
Paulchen-Panther 2019-06-10 16:50:22 +02:00
parent 2ccdfeb9e1
commit 609a3054f6
No known key found for this signature in database
GPG Key ID: 84E3B692456B6840
9 changed files with 242 additions and 160 deletions

48
.azure.yml Normal file
View File

@ -0,0 +1,48 @@
jobs:
- job: Linux
pool:
vmImage: 'ubuntu-16.04'
strategy:
matrix:
AMD64 (x64):
dockerTag: 'amd64'
dockerName: 'Debian Stretch (AMD64)'
i386 (x86):
dockerTag: 'i386'
dockerName: 'Debian Stretch (i386)'
ARMv6hf (Raspberry Pi v1 & ZERO):
dockerTag: 'armv6hf'
dockerName: 'Debian Stretch (Raspberry Pi v1 & ZERO)'
platform: 'rpi'
ARMv7hf (Raspberry Pi 2 & 3):
dockerTag: 'armv7hf'
dockerName: 'Debian Stretch (Raspberry Pi 2 & 3)'
platform: 'rpi'
ARMv8 (Generic AARCH64):
dockerTag: 'aarch64'
dockerName: 'ARMv8 (Generic AARCH64)'
platform: 'amlogic'
steps:
- checkout: self
submodules: recursive
- bash: ./.ci/ci_build.sh
displayName: 'Build $(dockerName)'
env:
DOCKER_TAG: $(dockerTag)
DOCKER_NAME: $(dockerName)
PLATFORM: $(platform)
- bash: ./.ci/ci_deploy.sh
displayName: 'Upload $(dockerName)'
- job: macOS
pool:
vmImage: 'macOS-10.13'
steps:
- checkout: self
submodules: recursive
- bash: ./.ci/ci_install.sh
displayName: 'Install dependencies'
- bash: ./.ci/ci_build.sh
displayName: 'Build macOS 10.13'
- bash: ./.ci/ci_deploy.sh
displayName: 'Upload macOS 10.13'

80
.ci/ci_build.sh Executable file
View File

@ -0,0 +1,80 @@
#!/bin/bash
# detect CI
if [ -n "${TRAVIS-}" ]; then
# Travis-CI
CI_NAME="$(echo "$TRAVIS_OS_NAME" | tr '[:upper:]' '[:lower:]')"
CI_BUILD_DIR="$TRAVIS_BUILD_DIR"
elif [ "$SYSTEM_COLLECTIONID" != "" ]; then
# Azure Pipelines
CI_NAME="$(echo "$AGENT_OS" | tr '[:upper:]' '[:lower:]')"
CI_BUILD_DIR="$BUILD_SOURCESDIRECTORY"
else
# for executing in non ci environment
CI_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')"
fi
# set environment variables
BUILD_TYPE="Debug"
PACKAGES=""
[ -z "${PLATFORM}" ] && PLATFORM="x11"
# Detect number of processor cores
# default is 4 jobs
if [[ "$CI_NAME" == 'osx' || "$CI_NAME" == 'darwin' ]]; then
JOBS=$(sysctl -n hw.ncpu)
PLATFORM=osx
elif [[ "$CI_NAME" == 'linux' ]]; then
JOBS=$(nproc)
fi
echo "compile jobs: ${JOBS:=4}"
# Determine cmake build type; tag builds are Release, else Debug
if [ -n "${TRAVIS_TAG:-}" ] || [[ $BUILD_SOURCEBRANCH == *"refs/tags"* ]]; then
BUILD_TYPE=Release
fi
# Determine package creation; True for cron/schedule and tag builds
if [ "${TRAVIS_EVENT_TYPE:-}" == 'cron' ] || [ -n "${TRAVIS_TAG:-}" ] || [[ $BUILD_REASON == "Schedule" ]] || [[ $BUILD_SOURCEBRANCH == *"refs/tags"* ]]; then
PACKAGES="package"
fi
# Determie -dev appends to platform;
# Commented because tests are currently broken
# [ "${TRAVIS_EVENT_TYPE:-}" != 'cron' -a -z "${TRAVIS_TAG:-}" ] && PLATFORM=${PLATFORM}-dev
# Build the package on osx or docker for linux
if [[ "$CI_NAME" == 'osx' || "$CI_NAME" == 'darwin' ]]; then
# compile prepare
mkdir build || exit 1
mkdir ${CI_BUILD_DIR}/deploy || exit 1
cd build
cmake -DPLATFORM=$PLATFORM -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=/usr .. || exit 2
make -j ${JOBS} ${PACKAGES} || exit 3
echo "---> Copy binaries and packages to folder: ${CI_BUILD_DIR}/deploy"
cp -v ${CI_BUILD_DIR}/build/bin/h* ${CI_BUILD_DIR}/deploy/ 2>/dev/null || : &&
cp -v ${CI_BUILD_DIR}/build/Hyperion-* ${CI_BUILD_DIR}/deploy/ 2>/dev/null || : &&
exit 0;
elif [[ "$CI_NAME" == 'linux' ]]; then
echo "Compile Hyperion with DOCKER_TAG = ${DOCKER_TAG} and friendly name DOCKER_NAME = ${DOCKER_NAME}"
# take ownership of deploy dir
mkdir ${CI_BUILD_DIR}/deploy
# run docker
docker run --rm \
-v "${CI_BUILD_DIR}/deploy:/deploy" \
-v "${CI_BUILD_DIR}:/source:ro" \
hyperionproject/hyperion-ci:$DOCKER_TAG \
/bin/bash -c "mkdir build && cp -r source/. /build &&
cd /build && mkdir build && cd build &&
cmake -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} .. || exit 2 &&
make -j ${JOBS} ${PACKAGES} || exit 3 &&
echo '---> Copy binaries and packages to host folder: ${CI_BUILD_DIR}/deploy' &&
cp -v /build/build/bin/h* /deploy/ 2>/dev/null || : &&
cp -v /build/build/Hyperion-* /deploy/ 2>/dev/null || : &&
exit 0;
exit 1 " || { echo "---> Hyperion compilation failed! Abort"; exit 4; }
# overwrite file owner to current user
sudo chown -fR $(stat -c "%U:%G" ${CI_BUILD_DIR}/deploy) ${CI_BUILD_DIR}/deploy
fi

67
.ci/ci_deploy.sh Executable file
View File

@ -0,0 +1,67 @@
#!/bin/bash
# detect CI
if [ -n "${TRAVIS-}" ]; then
# Travis-CI
CI_NAME="$(echo "$TRAVIS_OS_NAME" | tr '[:upper:]' '[:lower:]')"
CI_BUILD_DIR="$TRAVIS_BUILD_DIR"
elif [ "$SYSTEM_COLLECTIONID" != "" ]; then
# Azure Pipelines
CI_NAME="$(echo "$AGENT_OS" | tr '[:upper:]' '[:lower:]')"
CI_BUILD_DIR="$BUILD_SOURCESDIRECTORY"
else
# for executing in non ci environment
CI_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')"
fi
# sf_upload <FILES> <sf_dir>
# {
# echo "Uploading following files: ${1} to dir /hyperion-project/${2}"
#
# }
# append current Date to filename (just packages no binaries)
appendDate()
{
D=$(date +%Y-%m-%d)
for F in $CI_BUILD_DIR/deploy/Hy*
do
mv "$F" "${F%.*}-$D.${F##*.}"
done
}
# append friendly name (just packages no binaries)
appendName()
{
for F in $CI_BUILD_DIR/deploy/Hy*
do
mv "$F" "${F%.*}-($DOCKER_NAME).${F##*.}"
done
}
# get all files to deploy (just packages no binaries)
getFiles()
{
FILES=""
for f in $CI_BUILD_DIR/deploy/Hy*;
do FILES+="${f} ";
done;
}
if [[ $CI_NAME == 'linux' || "$CI_NAME" == 'osx' || "$CI_NAME" == 'darwin' ]]; then
if [[ -n $TRAVIS_TAG ]] || [[ $BUILD_SOURCEBRANCH == *"refs/tags"* ]]; then
echo "tag upload"
appendName
appendDate
getFiles
# sf_upload $FILES release
elif [[ $TRAVIS_EVENT_TYPE == 'cron' ]] || [[ $BUILD_REASON == "Schedule" ]]; then
echo "cron/schedule upload"
appendName
appendDate
getFiles
# sf_upload $FILES dev/alpha
else
echo "Direct pushed no upload, PRs not possible"
fi
fi

42
.ci/ci_install.sh Executable file
View File

@ -0,0 +1,42 @@
#!/bin/bash
# detect CI
if [ -n "${TRAVIS-}" ]; then
# Travis-CI
CI_NAME="$(echo "$TRAVIS_OS_NAME" | tr '[:upper:]' '[:lower:]')"
elif [ "$SYSTEM_COLLECTIONID" != "" ]; then
# Azure Pipelines
CI_NAME="$(echo "$AGENT_OS" | tr '[:upper:]' '[:lower:]')"
else
# for executing in non ci environment
CI_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')"
fi
function installAndUpgrade()
{
arr=("$@")
for i in "${arr[@]}";
do
list_output=`brew list | grep $i`
outdated_output=`brew outdated | grep $i`
if [[ ! -z "$list_output" ]]; then
if [[ ! -z "$outdated_output" ]]; then
brew upgrade $i
fi
else
brew install $i
fi
done
}
# install osx deps for hyperion compile
if [[ $CI_NAME == 'osx' || $CI_NAME == 'darwin' ]]; then
echo "Install dependencies"
brew update
dependencies=("qt5" "python" "libusb" "cmake" "doxygen")
installAndUpgrade "${dependencies[@]}"
elif [[ $CI_NAME != 'linux' ]]; then
echo "Unsupported platform: $CI_NAME"
exit 5
fi

View File

@ -15,7 +15,7 @@ notifications:
language: cpp
before_install:
- ./.travis/travis_install.sh
- ./.ci/ci_install.sh
jobs:
include:
@ -54,7 +54,7 @@ jobs:
- HOMEBREW_CACHE=$HOME/brew-cache
script:
- ./.travis/travis_build.sh
- ./.ci/ci_build.sh
after_success:
- ./.travis/travis_deploy.sh
- ./.ci/ci_deploy.sh

View File

@ -1,67 +0,0 @@
#!/bin/bash
# for executing in non travis environment
[ -z "$TRAVIS_OS_NAME" ] && TRAVIS_OS_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')"
if [ -z "${PLATFORM}" ]; then
PLATFORM=x86
fi
BUILD_TYPE=Debug
PACKAGES=""
# Detect number of processor cores
# default is 4 jobs
if [[ "$TRAVIS_OS_NAME" == 'osx' || "$TRAVIS_OS_NAME" == 'darwin' ]]
then
JOBS=$(sysctl -n hw.ncpu)
PLATFORM=osx
elif [[ "$TRAVIS_OS_NAME" == 'linux' ]]
then
JOBS=$(nproc)
fi
echo "compile jobs: ${JOBS:=4}"
# Determine cmake build type; tag builds are Release, else Debug
[ -n "${TRAVIS_TAG:-}" ] && BUILD_TYPE=Release
# Determine package creation; True for cron and tag builds
# Commented because tests are currently broken
# [ "${TRAVIS_EVENT_TYPE:-}" == 'cron' ] || [ -n "${TRAVIS_TAG:-}" ] && PACKAGES=package
# Determie -dev appends to platform;
# [ "${TRAVIS_EVENT_TYPE:-}" != 'cron' -a -z "${TRAVIS_TAG:-}" ] && PLATFORM=${PLATFORM}-dev
# Build the package on osx
if [[ "$TRAVIS_OS_NAME" == 'osx' || "$TRAVIS_OS_NAME" == 'darwin' ]]
then
# compile prepare
mkdir build || exit 1
cd build
cmake -DPLATFORM=$PLATFORM -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=/usr .. || exit 2
make -j ${JOBS} || exit 3
fi
# Build the package with docker
if [[ $TRAVIS_OS_NAME == 'linux' ]]
then
echo "Compile Hyperion with DOCKER_TAG = ${DOCKER_TAG} and friendly name DOCKER_NAME = ${DOCKER_NAME}"
# take ownership of deploy dir
mkdir $TRAVIS_BUILD_DIR/deploy
# run docker
docker run --rm \
-v "${TRAVIS_BUILD_DIR}/deploy:/deploy" \
-v "${TRAVIS_BUILD_DIR}:/source:ro" \
hyperionproject/hyperion-ci:$DOCKER_TAG \
/bin/bash -c "mkdir build && cp -r /source/. /build &&
cd /build && mkdir build && cd build &&
cmake -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} .. || exit 2 &&
make -j $(nproc) ${PACKAGES} || exit 3 &&
echo '---> Copy binaries and packages to host folder: ${TRAVIS_BUILD_DIR}/deploy' &&
cp -v /build/build/bin/h* /deploy/ 2>/dev/null || : &&
cp -v /build/build/Hyperion-* /deploy/ 2>/dev/null || : &&
exit 0;
exit 1 " || { echo "---> Hyperion compilation failed! Abort"; exit 4; }
# overwrite file owner to current user
sudo chown -fR $(stat -c "%U:%G" $TRAVIS_BUILD_DIR/deploy) $TRAVIS_BUILD_DIR/deploy
fi

View File

@ -1,64 +0,0 @@
#!/bin/bash
# sf_upload <FILES> <sf_dir>
sf_upload()
{
echo "Uploading following files: ${1}
to dir /hyperion-project/${2}"
/usr/bin/expect <<-EOD
spawn scp $1hyperionsf37@frs.sourceforge.net:/home/frs/project/hyperion-project/$2
expect "*(yes/no)*"
send "yes\r"
expect "*password:*"
send "$SFPW\r"
expect eof
EOD
}
# append current Date to filename (just packages no binaries)
appendDate()
{
D=$(date +%Y-%m-%d)
for F in $TRAVIS_BUILD_DIR/deploy/Hy*
do
mv "$F" "${F%.*}-$D.${F##*.}"
done
}
# append friendly name (just packages no binaries)
appendName()
{
for F in $TRAVIS_BUILD_DIR/deploy/Hy*
do
mv "$F" "${F%.*}-($DOCKER_NAME).${F##*.}"
done
}
# get all files to deploy (just packages no binaries)
getFiles()
{
FILES=""
for f in $TRAVIS_BUILD_DIR/deploy/Hy*;
do FILES+="${f} ";
done;
}
if [[ $TRAVIS_OS_NAME == 'linux' ]]; then
if [[ -n $TRAVIS_TAG ]]; then
echo "tag upload"
appendName
appendDate
getFiles
sf_upload $FILES release
elif [[ $TRAVIS_EVENT_TYPE == 'cron' ]]; then
echo "cron upload"
appendName
appendDate
getFiles
sf_upload $FILES dev/alpha
else
echo "Direct pushed no upload, PRs not possible"
#sf_upload $FILES pr
fi
fi

View File

@ -1,26 +0,0 @@
#!/bin/bash
# for executing in non travis environment
[ -z "$TRAVIS_OS_NAME" ] && TRAVIS_OS_NAME="$( uname -s | tr '[:upper:]' '[:lower:]' )"
# install osx deps for hyperion compile
if [[ $TRAVIS_OS_NAME == 'osx' || $TRAVIS_OS_NAME == 'darwin' ]]
then
echo "Install OSX deps"
brew update
brew install qt5 || true
brew upgrade python3 || true
brew upgrade libusb || true
brew upgrade cmake || true
brew install doxygen || true
# install linux deps for hyperion compile
elif [[ $TRAVIS_OS_NAME == 'linux' ]]
then
echo "Install linux deps"
#sudo apt-get -qq update
#sudo apt-get install -qq -y qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python3-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev doxygen expect
else
echo "Unsupported platform: $TRAVIS_OS_NAME"
exit 5
fi

View File

@ -9,6 +9,8 @@
<img src="https://img.shields.io/github/contributors/hyperion-project/hyperion.ng.svg" /></a>
<a href="https://github.com/hyperion-project/hyperion.ng/tree/master/dependencies/external" alt="Dependencies">
<img src="https://img.shields.io/librariesio/github/hyperion-project/hyperion.ng.svg" /></a>
<a href="https://dev.azure.com/Hyperion-Project/Hyperion.NG/_build/latest?definitionId=1&branchName=master" alt="Azure-Pipeline">
<img src="https://dev.azure.com/Hyperion-Project/Hyperion.NG/_apis/build/status/Hyperion-Project.Hyperion.NG?branchName=master" /></a>
<a href="https://travis-ci.org/hyperion-project/hyperion.ng" alt="Travis-CI">
<img src="https://travis-ci.org/hyperion-project/hyperion.ng.svg?branch=master" /></a>
<a href="https://lgtm.com/projects/g/hyperion-project/hyperion.ng/alerts/">