14 Commits

Author SHA1 Message Date
Ralph Lange
7de5a7edc3 travis: pre-install homebrew packages (in global addons)
(closes #13)
2019-12-18 17:24:19 +01:00
Ralph Lange
80ab30469e travis: avoid spawning 'tr' by using bash builtins 2019-12-18 17:22:11 +01:00
4dfd098545 travis: consistently use SETUP_PATH user variable 2019-12-18 17:00:46 +01:00
3929851deb travis: implement die() in utils.sh 2019-12-18 16:58:31 +01:00
e6f722914c travis: fix error message formats 2019-12-18 16:57:09 +01:00
d4ab170b3c avoid 'tr' calls to improve performance a bit 2019-12-16 14:37:32 +01:00
487d8eb287 refer to user variable, not internal variable in error message 2019-12-13 14:58:57 +01:00
c7aca7cd73 implement die function 2019-12-13 14:39:53 +01:00
bdcb2f3173 fix error message formats 2019-12-13 14:03:27 +01:00
Ralph Lange
e81ec3aa0c Merge pull request #12 from dirk-zimoch/formatfix
travis: fix formats for folders and colors
2019-12-13 11:45:20 +01:00
64e382b46e enable line feed after fold_start message 2019-12-12 10:44:51 +01:00
add7bbcf88 enable escape codes for color 2019-12-12 10:43:26 +01:00
Ralph Lange
377bd2a915 Readme: update, add version badge, mention License 2019-12-11 16:42:52 +01:00
Ralph Lange
7782f928c2 Add LICENSE 2019-12-11 16:40:37 +01:00
7 changed files with 132 additions and 43 deletions

View File

@@ -27,6 +27,11 @@ addons:
- g++-mingw-w64-i686 - g++-mingw-w64-i686
- g++-mingw-w64-x86-64 - g++-mingw-w64-x86-64
- qemu-system-x86 - qemu-system-x86
homebrew:
packages:
- re2c
- bash
update: true
install: install:
- ./travis/prepare.sh - ./travis/prepare.sh
@@ -126,7 +131,6 @@ jobs:
- env: SET=test01 SNCSEQ=master - env: SET=test01 SNCSEQ=master
os: osx os: osx
compiler: clang compiler: clang
addons: { homebrew: { packages: ["re2c"], update: true } }
# Base 3.15 builds # Base 3.15 builds
# ================ # ================
@@ -155,7 +159,6 @@ jobs:
- env: BASE=R3.15.7 SET=test01 SNCSEQ=master - env: BASE=R3.15.7 SET=test01 SNCSEQ=master
os: osx os: osx
compiler: clang compiler: clang
addons: { homebrew: { packages: ["re2c"], update: true } }
# Base 3.14 builds # Base 3.14 builds
# ================ # ================
@@ -175,4 +178,3 @@ jobs:
- env: BASE=R3.14.12.8 SET=test01 SNCSEQ=master - env: BASE=R3.14.12.8 SET=test01 SNCSEQ=master
os: osx os: osx
compiler: clang compiler: clang
addons: { homebrew: { packages: ["re2c"], update: true } }

65
LICENSE Normal file
View File

@@ -0,0 +1,65 @@
Copyright (c) 2019 EPICS. All rights reserved.
EPICS CI-Scripts are distributed subject to the following
license conditions:
SOFTWARE LICENSE AGREEMENT
Software: EPICS CI-Scripts
1. The "Software", below, refers to EPICS CI-Scripts (in
either source code, or binary form and accompanying documentation).
Each licensee is addressed as "you" or "Licensee."
2. The copyright holders shown above and their third-party licensors
hereby grant Licensee a royalty-free nonexclusive license, subject to
the limitations stated herein and U.S. Government license rights.
3. You may modify and make a copy or copies of the Software for use
within your organization, if you meet the following conditions:
a. Copies in source code must include the copyright notice and this
Software License Agreement.
b. Copies in binary form must include the copyright notice and this
Software License Agreement in the documentation and/or other
materials provided with the copy.
4. You may modify a copy or copies of the Software or any portion of it,
thus forming a work based on the Software, and distribute copies of
such work outside your organization, if you meet all of the following
conditions:
a. Copies in source code must include the copyright notice and this
Software License Agreement;
b. Copies in binary form must include the copyright notice and this
Software License Agreement in the documentation and/or other
materials provided with the copy;
c. Modified copies and works based on the Software must carry
prominent notices stating that you changed specified portions of
the Software.
5. Portions of the Software resulted from work developed under a U.S.
Government contract and are subject to the following license: the
Government is granted for itself and others acting on its behalf a
paid-up, nonexclusive, irrevocable worldwide license in this computer
software to reproduce, prepare derivative works, and perform publicly
and display publicly.
6. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" WITHOUT WARRANTY
OF ANY KIND. THE COPYRIGHT HOLDERS, THEIR THIRD PARTY LICENSORS, THE
UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND THEIR
EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE, TITLE OR NON-INFRINGEMENT, (2) DO NOT ASSUME
ANY LEGAL LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS,
OR USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF THE
SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4) DO NOT WARRANT
THAT THE SOFTWARE WILL FUNCTION UNINTERRUPTED, THAT IT IS ERROR-FREE
OR THAT ANY ERRORS WILL BE CORRECTED.
7. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT HOLDERS, THEIR
THIRD PARTY LICENSORS, THE UNITED STATES, THE UNITED STATES DEPARTMENT
OF ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF ANY KIND OR NATURE,
INCLUDING BUT NOT LIMITED TO LOSS OF PROFITS OR LOSS OF DATA, FOR ANY
REASON WHATSOEVER, WHETHER SUCH LIABILITY IS ASSERTED ON THE BASIS OF
CONTRACT, TORT (INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR
OTHERWISE, EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE
POSSIBILITY OF SUCH LOSS OR DAMAGES.

View File

@@ -1,3 +1,5 @@
<a target="_blank" href="http://semver.org">![Version][badge.version]</a>
# Continuous Integration Scripts for EPICS Modules # Continuous Integration Scripts for EPICS Modules
The scripts inside this repository are intended to provide a common, The scripts inside this repository are intended to provide a common,
@@ -119,7 +121,7 @@ empty. That way any settings can be overridden by settings in `.travis.yml`.
Empty lines or lines starting with `#` are ignored. Empty lines or lines starting with `#` are ignored.
`MODULES="<list of names>"` should list the dependencies (software modules) `MODULES=<list of names>` should list the dependencies (software modules)
by using their well-known slugs, separated by spaces. by using their well-known slugs, separated by spaces.
EPICS Base (slug: `base`) will always be a dependency and will be added and EPICS Base (slug: `base`) will always be a dependency and will be added and
compiled first. The other dependencies are added and compiled in the order compiled first. The other dependencies are added and compiled in the order
@@ -133,9 +135,7 @@ For any module mentioned as `foo` in the `MODULES` setting (and for `BASE`),
the following settings can be configured: the following settings can be configured:
`FOO=<version>` Set version of the module that should be used. Must either `FOO=<version>` Set version of the module that should be used. Must either
be a *tag* name (in that case the module is checked out into Travis' cache be a *tag* name or a *branch* name. [default: `master`]
system) or a *branch* name (in that case the module is always checked out
and recompiled as part of the job). [default: `master`]
`FOO_REPONAME=<name>` Set the name of the remote repository as `<name>.git`. `FOO_REPONAME=<name>` Set the name of the remote repository as `<name>.git`.
[default is the slug in lower case: `foo`] [default is the slug in lower case: `foo`]
@@ -143,7 +143,8 @@ and recompiled as part of the job). [default: `master`]
`FOO_REPOOWNER=<name>` Set the name of the GitHub owner (or organization) `FOO_REPOOWNER=<name>` Set the name of the GitHub owner (or organization)
that the module repository can be found under. that the module repository can be found under.
`FOO_REPOURL="<url>"` Set the complete URL of the remote repository. `FOO_REPOURL="<url>"` Set the complete URL of the remote repository. Useful
for dependencies that are not hosted on GitHub.
The default URL for the repository is pointing to GitHub, under The default URL for the repository is pointing to GitHub, under
`$FOO_REPOOWNER` else `$REPOOWNER` else `epics-modules`, `$FOO_REPOOWNER` else `$REPOOWNER` else `epics-modules`,
@@ -180,6 +181,8 @@ executed and switching the dependency builds to higher verbosity.
## Release Numbering of this Module ## Release Numbering of this Module
The module uses [Semantic Versioning](https://semver.org/).
Major release numbers refer to the API, which is more or less defined Major release numbers refer to the API, which is more or less defined
by the full configuration examples in the service specific by the full configuration examples in the service specific
subdirectories. subdirectories.
@@ -187,8 +190,8 @@ If one of these files has to be changed for the existing configuration
options or important new options are being added, a new major release options or important new options are being added, a new major release
is created. is created.
Minor release numbers refer to bugfixes that should not require the Minor release numbers refer to additions and enhancements that do not
configuration inside a user module to be changed. require the configuration inside an existing user module to be changed.
Again: using the git submodule mechanism to include these scripts means Again: using the git submodule mechanism to include these scripts means
that user modules always work with a fixed, frozen version. that user modules always work with a fixed, frozen version.
@@ -196,3 +199,11 @@ I.e., developments in the ci-scripts repository will never break an\
existing application. existing application.
These release numbering considerations are just a hint to assess the These release numbering considerations are just a hint to assess the
risks when updating the submodule. risks when updating the submodule.
## License
This module is distributed subject to a Software License Agreement found
in file LICENSE that is included with this distribution.
<!-- Links -->
[badge.version]: https://badge.fury.io/gh/epics-base%2Fci-scripts.png

View File

@@ -27,7 +27,7 @@ fn_exists() {
repo_exists() { repo_exists() {
DEP=$1 DEP=$1
dep_lc=$(echo $DEP | tr 'A-Z' 'a-z') dep_lc=${DEP,,}
eval dirname=\${${DEP}_DIRNAME:=${dep_lc}} eval dirname=\${${DEP}_DIRNAME:=${dep_lc}}
eval reponame=\${${DEP}_REPONAME:=${dep_lc}} eval reponame=\${${DEP}_REPONAME:=${dep_lc}}
eval repourl=\${${DEP}_REPOURL:="https://github.com/\${${DEP}_REPOOWNER:=${REPOOWNER:-epics-modules}}/${reponame}.git"} eval repourl=\${${DEP}_REPOURL:="https://github.com/\${${DEP}_REPOOWNER:=${REPOOWNER:-epics-modules}}/${reponame}.git"}
@@ -35,7 +35,7 @@ repo_exists() {
git ls-remote --quiet --heads --exit-code $repourl > /dev/null 2>&1 git ls-remote --quiet --heads --exit-code $repourl > /dev/null 2>&1
} }
SETUP_DIRS=$(echo $SETUP_PATH | tr ":" "\n") SETUP_DIRS=${SETUP_PATH//:/ }
SCRIPTDIR=$(dirname $(readlinkf $0))/travis SCRIPTDIR=$(dirname $(readlinkf $0))/travis
CURDIR="$PWD" CURDIR="$PWD"

View File

@@ -29,6 +29,13 @@ addons:
- g++-mingw-w64-x86-64 - g++-mingw-w64-x86-64
# for RTEMS cross builds # for RTEMS cross builds
- qemu-system-x86 - qemu-system-x86
homebrew:
packages:
# for all EPICS builds
- bash
# for the sequencer
- re2c
update: true
install: install:
- ./.ci/travis/prepare.sh - ./.ci/travis/prepare.sh
@@ -108,4 +115,3 @@ jobs:
- env: BASE=7.0 - env: BASE=7.0
os: osx os: osx
compiler: clang compiler: clang
addons: { homebrew: { packages: ["re2c"], update: true } }

View File

@@ -1,14 +1,24 @@
#!/bin/bash #!/bin/bash
set -e set -e
# The following if clause can be removed for ci-scripts major version 3
if [ "$TRAVIS_OS_NAME" == osx -a "$BASH_VERSINFO" -lt 4 ]
then
brew install bash
if [ $(/usr/local/bin/bash -c 'echo $BASH_VERSINFO') -lt 4 ]
then
echo "Failed to install a recent bash" >&2
exit 1
fi
exec /usr/local/bin/bash $0 "$@"
fi
# Set VV in .travis.yml to make scripts verbose # Set VV in .travis.yml to make scripts verbose
[ "$VV" ] && set -x [ "$VV" ] && set -x
# Perl version of "readlink -f" (which MacOS does not provide) # Perl version of "readlink -f" (which MacOS does not provide)
readlinkf() { perl -MCwd -e 'print Cwd::abs_path shift' "$1"; } readlinkf() { perl -MCwd -e 'print Cwd::abs_path shift' "$1"; }
SETUP_DIRS=$(echo $SETUP_PATH | tr ":" "\n")
SCRIPTDIR=$(dirname $(readlinkf $0)) SCRIPTDIR=$(dirname $(readlinkf $0))
CURDIR="$PWD" CURDIR="$PWD"
CACHEDIR="$HOME/.cache" CACHEDIR="$HOME/.cache"
@@ -16,6 +26,8 @@ CACHEDIR="$HOME/.cache"
# source functions # source functions
. $SCRIPTDIR/utils.sh . $SCRIPTDIR/utils.sh
echo -e "${ANSI_YELLOW}Using bash version $BASH_VERSION${ANSI_RESET}"
# Load settings # Load settings
# ------------- # -------------
@@ -36,7 +48,7 @@ fold_start check.out.dependencies "Checking/cloning dependencies"
for mod in BASE $MODULES for mod in BASE $MODULES
do do
mod_uc=$(echo $mod | tr 'a-z' 'A-Z') mod_uc=${mod^^}
eval add_dependency $mod_uc \${${mod_uc}:=master} eval add_dependency $mod_uc \${${mod_uc}:=master}
done done
[ -e ./configure ] && cp ${CACHEDIR}/RELEASE.local ./configure/RELEASE.local [ -e ./configure ] && cp ${CACHEDIR}/RELEASE.local ./configure/RELEASE.local
@@ -151,7 +163,7 @@ EOF
fi fi
else else
echo "${ANSI_GREEN}EPICS build system already set up (Base was loaded from cache)${ANSI_RESET}" echo -e "${ANSI_GREEN}EPICS build system already set up (Base was loaded from cache)${ANSI_RESET}"
fi fi
# Download RTEMS cross compiler # Download RTEMS cross compiler
@@ -174,7 +186,7 @@ fold_start build.dependencies "Build missing/outdated dependencies"
[ "$VV" ] && silent="-s" || silent= [ "$VV" ] && silent="-s" || silent=
[ -z "$modules_to_compile" ] && echo "${ANSI_GREEN}All dependency modules are up-to-date (nothing to do)${ANSI_RESET}" [ -z "$modules_to_compile" ] && echo -e "${ANSI_GREEN}All dependency modules are up-to-date (nothing to do)${ANSI_RESET}"
for module in ${modules_to_compile} for module in ${modules_to_compile}
do do
@@ -186,13 +198,13 @@ done
fold_end build.dependencies fold_end build.dependencies
echo "${ANSI_BLUE}Dependency module information${ANSI_RESET}" echo -e "${ANSI_BLUE}Dependency module information${ANSI_RESET}"
echo "Module Tag Binaries Commit" echo "Module Tag Binaries Commit"
echo "-----------------------------------------------------------------------------------" echo "-----------------------------------------------------------------------------------"
for mod in base $MODULES for mod in base $MODULES
do do
mod_uc=$(echo $mod | tr 'a-z' 'A-Z') mod_uc=${mod^^}
eval tag=\${${mod_uc}} eval tag=\${${mod_uc}}
eval dir=${CACHEDIR}/\${${mod_uc}_DIRNAME}-$tag eval dir=${CACHEDIR}/\${${mod_uc}_DIRNAME}-$tag
echo "$modules_to_compile" | grep -q "$dir" && stat="rebuilt" || stat="from cache" echo "$modules_to_compile" | grep -q "$dir" && stat="rebuilt" || stat="from cache"
@@ -200,5 +212,5 @@ do
printf "%-10s %-12s %-11s %s\n" "$mod" "$tag" "$stat" "$commit" printf "%-10s %-12s %-11s %s\n" "$mod" "$tag" "$stat" "$commit"
done done
echo "${ANSI_BLUE}Contents of RELEASE.local${ANSI_RESET}" echo -e "${ANSI_BLUE}Contents of RELEASE.local${ANSI_RESET}"
cat ${CACHEDIR}/RELEASE.local cat ${CACHEDIR}/RELEASE.local

View File

@@ -22,28 +22,29 @@ export ANSI_CLEAR="\033[0K"
# from https://github.com/travis-ci/travis-rubies/blob/build/build.sh # from https://github.com/travis-ci/travis-rubies/blob/build/build.sh
fold_start() { fold_start() {
echo -en "travis_fold:start:$1\\r${ANSI_YELLOW}$2${ANSI_RESET}" echo -e "travis_fold:start:$1\\r${ANSI_YELLOW}$2${ANSI_RESET}"
} }
fold_end() { fold_end() {
echo -en "travis_fold:end:$1\\r" echo -en "travis_fold:end:$1\\r"
} }
die() {
echo -e "${ANSI_RED}$1${ANSI_RESET}"
[ "$UTILS_UNITTEST" ] || exit 1
}
# source_set(settings) # source_set(settings)
# #
# Source a settings file (extension .set) found in the SETUP_DIRS path # Source a settings file (extension .set) found in SETUP_PATH
# May be called recursively (from within a settings file) # May be called recursively (from within a settings file)
declare -a SEEN_SETUPS declare -a SEEN_SETUPS
source_set() { source_set() {
local set_file=${1//[$'\r']} local set_file=${1//[$'\r']}
local set_dir local set_dir
local found=0 local found=0
if [ -z "${SETUP_DIRS}" ] [ "${SETUP_PATH}" ] || die "Search path for setup files (SETUP_PATH) is empty"
then for set_dir in ${SETUP_PATH//:/ }
echo "${ANSI_RED}Search path for setup files (SETUP_PATH) is empty${ANSI_RESET}"
[ "$UTILS_UNITTEST" ] || exit 1
fi
for set_dir in ${SETUP_DIRS}
do do
if [ -e $set_dir/$set_file.set ] if [ -e $set_dir/$set_file.set ]
then then
@@ -75,11 +76,7 @@ source_set() {
break break
fi fi
done done
if [ $found -eq 0 ] [ $found -ne 0 ] || die "Setup file $set_file.set does not exist in SETUP_PATH search path ($SETUP_PATH)"
then
echo "${ANSI_RED}Setup file $set_file.set does not exist in SETUP_DIRS search path ($SETUP_DIRS)${ANSI_RESET}"
[ "$UTILS_UNITTEST" ] || exit 1
fi
} }
# update_release_local(varname, place) # update_release_local(varname, place)
@@ -135,21 +132,18 @@ add_dependency() {
curdir="$PWD" curdir="$PWD"
DEP=$1 DEP=$1
TAG=$2 TAG=$2
dep_lc=$(echo $DEP | tr 'A-Z' 'a-z') dep_lc=${DEP,,}
eval dirname=\${${DEP}_DIRNAME:=${dep_lc}} eval dirname=\${${DEP}_DIRNAME:=${dep_lc}}
eval reponame=\${${DEP}_REPONAME:=${dep_lc}} eval reponame=\${${DEP}_REPONAME:=${dep_lc}}
eval repourl=\${${DEP}_REPOURL:="https://github.com/\${${DEP}_REPOOWNER:=${REPOOWNER:-epics-modules}}/${reponame}.git"} eval repourl=\${${DEP}_REPOURL:="https://github.com/\${${DEP}_REPOOWNER:=${REPOOWNER:-epics-modules}}/${reponame}.git"}
eval varname=\${${DEP}_VARNAME:=${DEP}} eval varname=\${${DEP}_VARNAME:=${DEP}}
eval recursive=\${${DEP}_RECURSIVE:=1} eval recursive=\${${DEP}_RECURSIVE:=1}
recursive=$(echo $recursive | tr 'A-Z' 'a-z') recursive=${recursive,,}
[ "$recursive" != "0" -a "$recursive" != "no" ] && recurse="--recursive" [ "$recursive" != "0" -a "$recursive" != "no" ] && recurse="--recursive"
# determine if $DEP points to a valid release or branch # determine if $DEP points to a valid release or branch
if ! git ls-remote --quiet --exit-code --refs $repourl "$TAG" > /dev/null 2>&1 git ls-remote --quiet --exit-code --refs $repourl "$TAG" > /dev/null 2>&1 ||
then die "$TAG is neither a tag nor a branch name for $DEP ($repourl)"
echo "${ANSI_RED}$TAG is neither a tag nor a branch name for $DEP ($repourl)${ANSI_RESET}"
[ "$UTILS_UNITTEST" ] || exit 1
fi
if [ -e $CACHEDIR/$dirname-$TAG ] if [ -e $CACHEDIR/$dirname-$TAG ]
then then
@@ -191,8 +185,7 @@ add_dependency() {
echo "Running hook $hook in $CACHEDIR/$dirname-$TAG" echo "Running hook $hook in $CACHEDIR/$dirname-$TAG"
( cd $CACHEDIR/$dirname-$TAG; "$curdir/$hook" ) ( cd $CACHEDIR/$dirname-$TAG; "$curdir/$hook" )
else else
echo "${ANSI_RED}Hook script $hook is not executable or does not exist.${ANSI_RESET}" die "Hook script $hook is not executable or does not exist."
exit 1
fi fi
fi fi
HEAD=$(cd "$CACHEDIR/$dirname-$TAG" && git log -n1 --pretty=format:%H) HEAD=$(cd "$CACHEDIR/$dirname-$TAG" && git log -n1 --pretty=format:%H)