Move travis scripts into travis subdirectory

This commit is contained in:
Ralph Lange
2019-10-24 16:01:48 +02:00
parent e6c3f6f016
commit fe7647545d
6 changed files with 88 additions and 48 deletions
+100
View File
@@ -0,0 +1,100 @@
# .travis.xml for use with EPICS Base ci-scripts
# (see: https://github.com/epics-base/ci-scripts)
language: cpp
compiler: gcc
dist: xenial
cache:
directories:
- $HOME/.cache
env:
global:
- SETUP_PATH=.ci-local:.ci
addons:
apt:
packages:
- libreadline6-dev
- libncurses5-dev
- perl
- clang
- g++-mingw-w64-i686
- qemu-system-x86
install:
- ./.ci/travis/prepare.sh
script:
- ./.ci/travis/build.sh
# If you need to do more during install and build,
# add a local directory to your module and do e.g.
# - ./.ci-local/travis/install-extras.sh
# Define build jobs
# Well-known variables to use
# BASE branch or release tag name of the EPICS Base to use
# EXTRA content will be added to make command line
# STATIC set to YES for static build (default: NO)
# TEST set to NO to skip running the tests (default: YES)
matrix:
include:
# Different configurations of default gcc and clang
- env: BASE=7.0
- env: BASE=7.0
compiler: clang
- env: BASE=7.0 EXTRA="CMD_CXXFLAGS=-std=c++11"
- env: BASE=7.0 EXTRA="CMD_CXXFLAGS=-std=c++11"
compiler: clang
# Trusty: compiler versions very close to RHEL 7
- env: BASE=7.0
dist: trusty
- env: BASE=7.0 EXTRA="CMD_CXXFLAGS=-std=c++11"
dist: trusty
# Cross-compilation to Windows using MinGW and WINE
- env: BASE=7.0 WINE=32 TEST=NO STATIC=YES
compiler: mingw
- env: BASE=7.0 WINE=64 TEST=NO STATIC=NO
compiler: mingw
# Cross-compilation to RTEMS
- env: BASE=7.0 RTEMS=4.10 TEST=NO
- env: BASE=7.0 RTEMS=4.9 TEST=NO
# Other gcc versions (adding as an extra package)
- env: BASE=7.0
compiler: gcc-6
addons: { apt: { packages: ["g++-6"], sources: ["ubuntu-toolchain-r-test"] } }
- env: BASE=7.0
compiler: gcc-7
addons: { apt: { packages: ["g++-7"], sources: ["ubuntu-toolchain-r-test"] } }
# MacOS build
- env: BASE=7.0
os: osx
compiler: clang
# All above jobs can be defined for other branches or releases of EPICS Base
# by setting BASE to the branch name or release tag name, e.g.
# BASE=3.15 (to use the 3.15 branch of Base)
# BASE=R7.0.3 (to use the 7.0.3 release of Base)
+28
View File
@@ -0,0 +1,28 @@
# .travis.xml for use with EPICS Base ci-scripts
# (see: https://github.com/epics-base/ci-scripts)
language: cpp
compiler: gcc
dist: xenial
# Minimal set of packages needed to compile EPICS Base
addons:
apt:
packages:
- libreadline6-dev
- libncurses5-dev
- perl
install:
- ./.ci/travis/prepare.sh
script:
- ./.ci/travis/build.sh
# Build using default gcc for Base branches 7.0 and 3.15
matrix:
include:
- env: BASE=7.0
- env: BASE=3.15
+35
View File
@@ -0,0 +1,35 @@
# Travis-CI Scripts for EPICS Modules
## Features
- Compile against different branches or releases of EPICS Base
- Use different versions of compilers (gcc, clang)
- Cross-compile for Windows 32bit using MinGW and WINE
- Cross-compile for RTEMS 4.9 and 4.10
- Compile on MacOS
## How to Use these Scripts
1. Get an account on [Travis-CI](https://travis-ci.org/), connect
it to your GitHub account and activate your support module's
repository. For more details, please refer to the
[Travis-CI Tutorial](https://docs.travis-ci.com/user/tutorial/).
Make sure to use `travis-ci.org` and not their `.com` site.
2. In your Support Module, add this respository as a Git Submodule
(name suggestion: `.ci`).
```
$ git submodule add https://github.com/epics-base/ci-scripts .ci
```
3. Create a Travis configuration by copying one of the examples into
the root directory of your module.
```
$ cp .ci/travis/.travis.yml.example-full .travis.yml
```
4. Edit the `.travis.yml` configuration to include the jobs you want
Travis to run.
5. Push your changes and check
[travis-ci.org](https://travis-ci.org/) for your build results.
+10
View File
@@ -0,0 +1,10 @@
#!/bin/sh
set -e -x
make -j2 $EXTRA
if [ "$TEST" != "NO" ]
then
make tapfiles
make -s test-results
fi
+188
View File
@@ -0,0 +1,188 @@
#!/bin/sh
set -e -x
SETUP_DIRS=$(echo $SETUP_PATH | tr ":" "\n")
source_set() {
SETFILE=$1
for set_dir in ${SETUP_DIRS}
do
if [ -e $set_dir/$SETFILE.set ]
then
source $set_dir/$SETFILE.set
fi
done
}
source_set defaults
CURDIR="$PWD"
CACHEDIR="$HOME/.cache"
SOURCEDIR="$HOME/.source"
# determine if BASE points to a release or a branch
git ls-remote --quiet --exit-code --tags "$BASE_REPO" "$BASE" && BASE_RELEASE=YES
git ls-remote --quiet --exit-code --heads "$BASE_REPO" "$BASE" && BASE_BRANCH=YES
if [ "$BASE_RELEASE" = "YES" ]
then
BASE_LOCATION=$CACHEDIR/epics-base
BASE_RECURSIVE="--recursive"
else
if [ "$BASE_BRANCH" = "YES" ]
then
BASE_LOCATION=$SOURCEDIR/epics-base
BASE_RECURSIVE=
else
echo $BASE is neither a tag nor a branch name for BASE
exit 1
fi
fi
cat << EOF > $CURDIR/configure/RELEASE.local
EPICS_BASE=$BASE_LOCATION
EOF
add_gh_flat() {
MODULE=$1
REPOOWNER=$2
REPONAME=$3
BRANCH=$4
MODULE_UC=$5
( git clone --quiet --depth 5 --branch $BRANCH https://github.com/$REPOOWNER/$REPONAME.git $MODULE && \
cd $MODULE && git log -n1 )
cat < $CURDIR/configure/RELEASE.local > $MODULE/configure/RELEASE.local
cat << EOF >> $CURDIR/configure/RELEASE.local
${MODULE_UC}=$HOME/.source/$MODULE
EOF
}
if [ "$BASE_RELEASE" = "YES" ]
then
mkdir -s "$CACHEDIR"
cd "$CACHEDIR"
BASE_MODULE=
else
mkdir -s "$SOURCEDIR"
cd "$SOURCEDIR"
BASE_MODULE=epics-base
fi
git clone --quiet --depth 5 $BASE_RECURSIVE --branch "$BASE" $BASE_REPO epics-base
(cd epics-base && git log -n1 )
mkdir -s "$SOURCEDIR"
cd "$SOURCEDIR"
for modrepo in ${MODULES}
do
module=${modrepo%CPP}
module_uc=$(echo $module | tr 'a-z' 'A-Z')
eval add_gh_flat $module \${REPO${module_uc}:-epics-base} $modrepo \${BR${module_uc}:-master} $module_uc
done
if [ -e $CURDIR/configure/RELEASE.local ]
then
cat $CURDIR/configure/RELEASE.local
fi
[ "$EPICS_HOST_ARCH" ] || EPICS_HOST_ARCH=`sh epics-base/startup/EpicsHostArch`
# requires wine and g++-mingw-w64-i686
if [ "$WINE" = "32" ]
then
echo "Cross mingw32"
sed -i -e '/CMPLR_PREFIX/d' epics-base/configure/os/CONFIG_SITE.linux-x86.win32-x86-mingw
cat << EOF >> epics-base/configure/os/CONFIG_SITE.linux-x86.win32-x86-mingw
CMPLR_PREFIX=i686-w64-mingw32-
EOF
cat << EOF >> epics-base/configure/CONFIG_SITE
CROSS_COMPILER_TARGET_ARCHS+=win32-x86-mingw
EOF
elif [ "$WINE" = "64" ]
then
echo "Cross mingw64"
sed -i -e '/CMPLR_PREFIX/d' epics-base/configure/os/CONFIG_SITE.linux-x86.windows-x64-mingw
cat << EOF >> epics-base/configure/os/CONFIG_SITE.linux-x86.windows-x64-mingw
CMPLR_PREFIX=x86_64-w64-mingw32-
EOF
cat << EOF >> epics-base/configure/CONFIG_SITE
CROSS_COMPILER_TARGET_ARCHS+=windows-x64-mingw
EOF
fi
if [ "$STATIC" = "YES" ]
then
echo "Build static libraries/executables"
cat << EOF >> epics-base/configure/CONFIG_SITE
SHARED_LIBRARIES=NO
STATIC_BUILD=YES
EOF
fi
HOST_CCMPLR_NAME=`echo "$TRAVIS_COMPILER" | sed -E 's/^([[:alpha:]][^-]*(-[[:alpha:]][^-]*)*)+(-[0-9\.]+)?$/\1/g'`
HOST_CMPLR_VER_SUFFIX=`echo "$TRAVIS_COMPILER" | sed -E 's/^([[:alpha:]][^-]*(-[[:alpha:]][^-]*)*)+(-[0-9\.]+)?$/\3/g'`
HOST_CMPLR_VER=`echo "$HOST_CMPLR_VER_SUFFIX" | cut -c 2-`
case "$HOST_CCMPLR_NAME" in
clang)
echo "Host compiler is clang"
HOST_CPPCMPLR_NAME=$(echo "$HOST_CCMPLR_NAME" | sed 's/clang/clang++/g')
cat << EOF >> epics-base/configure/os/CONFIG_SITE.Common.$EPICS_HOST_ARCH
GNU = NO
CMPLR_CLASS = clang
CC = ${HOST_CCMPLR_NAME}$HOST_CMPLR_VER_SUFFIX
CCC = ${HOST_CPPCMPLR_NAME}$HOST_CMPLR_VER_SUFFIX
EOF
# hack
sed -i -e 's/CMPLR_CLASS = gcc/CMPLR_CLASS = clang/' epics-base/configure/CONFIG.gnuCommon
${HOST_CCMPLR_NAME}$HOST_CMPLR_VER_SUFFIX --version
;;
gcc)
echo "Host compiler is GCC"
HOST_CPPCMPLR_NAME=$(echo "$HOST_CCMPLR_NAME" | sed 's/gcc/g++/g')
cat << EOF >> epics-base/configure/os/CONFIG_SITE.Common.$EPICS_HOST_ARCH
CC = ${HOST_CCMPLR_NAME}$HOST_CMPLR_VER_SUFFIX
CCC = ${HOST_CPPCMPLR_NAME}$HOST_CMPLR_VER_SUFFIX
EOF
${HOST_CCMPLR_NAME}$HOST_CMPLR_VER_SUFFIX --version
;;
*)
echo "Host compiler is default"
gcc --version
;;
esac
cat <<EOF >> epics-base/configure/CONFIG_SITE
USR_CPPFLAGS += $USR_CPPFLAGS
USR_CFLAGS += $USR_CFLAGS
USR_CXXFLAGS += $USR_CXXFLAGS
EOF
# set RTEMS to eg. "4.9" or "4.10"
# requires qemu, bison, flex, texinfo, install-info
if [ -n "$RTEMS" ]
then
echo "Cross RTEMS${RTEMS} for pc386"
curl -L "https://github.com/mdavidsaver/rsb/releases/download/20171203-${RTEMS}/i386-rtems${RTEMS}-trusty-20171203-${RTEMS}.tar.bz2" \
| tar -C / -xmj
sed -i -e '/^RTEMS_VERSION/d' -e '/^RTEMS_BASE/d' epics-base/configure/os/CONFIG_SITE.Common.RTEMS
cat << EOF >> epics-base/configure/os/CONFIG_SITE.Common.RTEMS
RTEMS_VERSION=$RTEMS
RTEMS_BASE=$HOME/.rtems
EOF
cat << EOF >> epics-base/configure/CONFIG_SITE
CROSS_COMPILER_TARGET_ARCHS += RTEMS-pc386-qemu
EOF
fi
for modrepo in ${BASE_MODULE} ${MODULES}
do
module=${modrepo%CPP}
make -j2 -C $module $EXTRA
done