-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Jenkins-CI scripts under revision control
- Loading branch information
1 parent
06935d9
commit 2678ad7
Showing
4 changed files
with
341 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
These scripts are intended to be used with the Jenkins CI Platform available at Inria. | ||
|
||
They can be called from a Jenkins Task / Build / Execute script, as follows: | ||
|
||
/bin/bash -xv gatb-${TOOL_NAME}/scripts/jenkins/xxx.sh | ||
|
104 changes: 104 additions & 0 deletions
104
scripts/jenkins/tool-dsk-build-debian7-64bits-gcc-4.7.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
#!/bin/bash | ||
#--------------------------------------------------------------# | ||
# Continuous integration script for Jenkins # | ||
#--------------------------------------------------------------# | ||
# | ||
# Default mode : | ||
# This script will exit with error (exit code 1) if any of its steps fails. | ||
# To change this behaviour, choose DO_NOT_STOP_AT_ERROR in Jenkins (see below). | ||
#--------------------------------------------------------------# | ||
set +xv | ||
|
||
echo " | ||
----------------------------------------- | ||
Miscellaneous information | ||
----------------------------------------- | ||
date : `date` | ||
hostname : `hostname` | ||
pwd : `pwd` | ||
----------------------------------------- | ||
Jenkins build parameters (user defined) | ||
----------------------------------------- | ||
BRANCH_TO_BUILD : ${BRANCH_TO_BUILD} | ||
INRIA_FORGE_LOGIN : ${INRIA_FORGE_LOGIN} | ||
DO_NOT_STOP_AT_ERROR : ${DO_NOT_STOP_AT_ERROR} | ||
----------------------------------------- | ||
Jenkins build parameters (built in) | ||
----------------------------------------- | ||
BUILD_NUMBER : ${BUILD_NUMBER} | ||
" | ||
|
||
error_code () { [ "$DO_NOT_STOP_AT_ERROR" = "true" ] && { return 0 ; } } | ||
|
||
[ "$DO_NOT_STOP_AT_ERROR" != "true" ] && { set -e ; } || { echo "(!) DEBUG mode, the script will NOT stop..." ; echo; } | ||
set -xv | ||
|
||
# quick look at resources | ||
#----------------------------------------------- | ||
free -h | ||
#----------------------------------------------- | ||
lstopo | ||
#----------------------------------------------- | ||
df -kh | ||
#----------------------------------------------- | ||
|
||
|
||
################################################################ | ||
# COMPILATION # | ||
################################################################ | ||
|
||
gcc --version | ||
g++ --version | ||
|
||
[ `gcc -dumpversion` = 4.7 ] && { echo "GCC 4.7"; } || { echo "GCC version is not 4.7, we exit"; exit 1; } | ||
|
||
JENKINS_TASK=tool-${TOOL_NAME}-build-debian7-64bits-gcc-4.7 | ||
GIT_DIR=/scratchdir/builds/workspace/gatb-${TOOL_NAME} | ||
BUILD_DIR=/scratchdir/$JENKINS_TASK/gatb-${TOOL_NAME}/build | ||
|
||
rm -rf $BUILD_DIR | ||
mkdir -p $BUILD_DIR | ||
|
||
#----------------------------------------------- | ||
# we need gatb-core submodule to be initialized | ||
cd $GIT_DIR | ||
git submodule init | ||
git submodule update | ||
|
||
#----------------------------------------------- | ||
cd $BUILD_DIR | ||
|
||
#----------------------------------------------- | ||
cmake -Wno-dev -DJENKINS_TAG=${BRANCH_TO_BUILD} $GIT_DIR | ||
|
||
#----------------------------------------------- | ||
make -j 2 || error_code | ||
|
||
################################################################ | ||
# TEST # | ||
################################################################ | ||
# prepare data and scripts | ||
cp -R $GIT_DIR/scripts/ .. | ||
cp -R $GIT_DIR/test/ .. | ||
# run tests | ||
cd ../scripts | ||
./simple_test.sh || error_code | ||
# cleanup disk space | ||
cd .. | ||
rm -rf scripts test | ||
# go bask to build for packaging step | ||
cd build | ||
|
||
################################################################ | ||
# PACKAGING # | ||
################################################################ | ||
|
||
# Upload bin bundle to the forge | ||
if [ $? -eq 0 ] && [ "$INRIA_FORGE_LOGIN" != none ] && [ "$DO_NOT_STOP_AT_ERROR" != true ]; then | ||
make package | ||
scp ${TOOL_NAME}-${BRANCH_TO_BUILD}-bin-Linux.tar.gz ${INRIA_FORGE_LOGIN}@scm.gforge.inria.fr:/home/groups/gatb-tools/htdocs/ci-inria | ||
# source package is handled by the osx task | ||
fi | ||
|
103 changes: 103 additions & 0 deletions
103
scripts/jenkins/tool-dsk-build-macos-10.9.5-gcc-4.2.1.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
#!/bin/bash | ||
#--------------------------------------------------------------# | ||
# Continuous integration script for Jenkins # | ||
#--------------------------------------------------------------# | ||
# | ||
# Default mode : | ||
# This script will exit with error (exit code 1) if any of its steps fails. | ||
# To change this behaviour, choose DO_NOT_STOP_AT_ERROR in Jenkins (see below). | ||
#--------------------------------------------------------------# | ||
set +xv | ||
|
||
echo " | ||
----------------------------------------- | ||
Miscellaneous information | ||
----------------------------------------- | ||
date : `date` | ||
hostname : `hostname` | ||
pwd : `pwd` | ||
----------------------------------------- | ||
Jenkins build parameters (user defined) | ||
----------------------------------------- | ||
BRANCH_TO_BUILD : ${BRANCH_TO_BUILD} | ||
INRIA_FORGE_LOGIN : ${INRIA_FORGE_LOGIN} | ||
DO_NOT_STOP_AT_ERROR : ${DO_NOT_STOP_AT_ERROR} | ||
----------------------------------------- | ||
Jenkins build parameters (built in) | ||
----------------------------------------- | ||
BUILD_NUMBER : ${BUILD_NUMBER} | ||
" | ||
|
||
error_code () { [ "$DO_NOT_STOP_AT_ERROR" = "true" ] && { return 0 ; } } | ||
|
||
[ "$DO_NOT_STOP_AT_ERROR" != "true" ] && { set -e ; } || { echo "(!) DEBUG mode, the script will NOT stop..." ; echo; } | ||
set -xv | ||
|
||
# quick look at resources | ||
#----------------------------------------------- | ||
sw_vers -productVersion | ||
#----------------------------------------------- | ||
system_profiler SPSoftwareDataType | ||
#----------------------------------------------- | ||
lstopo | ||
#----------------------------------------------- | ||
top -l 1|head -15 | ||
#----------------------------------------------- | ||
|
||
|
||
################################################################ | ||
# COMPILATION # | ||
################################################################ | ||
|
||
gcc --version | ||
g++ --version | ||
|
||
[ `gcc -dumpversion` = 4.2.1 ] && { echo "GCC 4.2.1"; } || { echo "GCC version is not 4.2.1, we exit"; exit 1; } | ||
|
||
JENKINS_TASK=tool-${TOOL_NAME}-build-macos-10.9.5-gcc-4.2.1 | ||
GIT_DIR=/builds/workspace/$JENKINS_TASK/gatb-${TOOL_NAME} | ||
#N.B. /scratchdir not yet mounted on the osx slave (ciosx). | ||
# as soon as /scratchdir is created, one has to update TEST procedure, below. | ||
# refer to linux build target to see how to do that | ||
BUILD_DIR=$GIT_DIR/build | ||
|
||
rm -rf $BUILD_DIR | ||
mkdir -p $BUILD_DIR | ||
|
||
#----------------------------------------------- | ||
# we need gatb-core submodule to be initialized | ||
cd $GIT_DIR | ||
git submodule init | ||
git submodule update | ||
|
||
#----------------------------------------------- | ||
cd $BUILD_DIR | ||
|
||
#----------------------------------------------- | ||
cmake -Wno-dev -DJENKINS_TAG=${BRANCH_TO_BUILD} $GIT_DIR | ||
|
||
#----------------------------------------------- | ||
make -j 2 || error_code | ||
|
||
################################################################ | ||
# TEST # | ||
################################################################ | ||
|
||
cd ../scripts | ||
./simple_test.sh || error_code | ||
cd ../build | ||
|
||
################################################################ | ||
# PACKAGING # | ||
################################################################ | ||
|
||
# Prepare and upload bin and source bundle to the forge | ||
if [ $? -eq 0 ] && [ "$INRIA_FORGE_LOGIN" != none ] && [ "$DO_NOT_STOP_AT_ERROR" != true ]; then | ||
make package | ||
make package_source | ||
scp ${TOOL_NAME}-${BRANCH_TO_BUILD}-bin-Darwin.tar.gz ${INRIA_FORGE_LOGIN}@scm.gforge.inria.fr:/home/groups/gatb-tools/htdocs/ci-inria | ||
scp ${TOOL_NAME}-${BRANCH_TO_BUILD}-Source.tar.gz ${INRIA_FORGE_LOGIN}@scm.gforge.inria.fr:/home/groups/gatb-tools/htdocs/ci-inria | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
#!/bin/bash | ||
#--------------------------------------------------------------# | ||
# Continuous integration script for Jenkins # | ||
#--------------------------------------------------------------# | ||
# | ||
# Default mode : | ||
# This script will exit with error (exit code 1) if any of its steps fails. | ||
# To change this behaviour, choose DO_NOT_STOP_AT_ERROR in Jenkins (see below). | ||
#--------------------------------------------------------------# | ||
set +xv | ||
|
||
echo " | ||
----------------------------------------- | ||
Miscellaneous information | ||
----------------------------------------- | ||
date : `date` | ||
hostname : `hostname` | ||
pwd : `pwd` | ||
----------------------------------------- | ||
Jenkins build parameters (user defined) | ||
----------------------------------------- | ||
BRANCH_TO_BUILD : ${BRANCH_TO_BUILD} | ||
RELEASE_TO_BUILD : ${RELEASE_TO_BUILD} | ||
INRIA_FORGE_LOGIN : ${INRIA_FORGE_LOGIN} | ||
TEST_VARIABLE : ${TEST_VARIABLE} | ||
DO_NOT_STOP_AT_ERROR : ${DO_NOT_STOP_AT_ERROR} | ||
----------------------------------------- | ||
Jenkins build parameters (built in) | ||
----------------------------------------- | ||
BUILD_NUMBER : ${BUILD_NUMBER} | ||
" | ||
set -xv | ||
|
||
# quick look at resources | ||
#----------------------------------------------- | ||
free -h | ||
#----------------------------------------------- | ||
lstopo | ||
#----------------------------------------------- | ||
df -kh | ||
#----------------------------------------------- | ||
|
||
|
||
################################################################ | ||
# PREPARE RELEASE # | ||
################################################################ | ||
|
||
# paths to access tool source code and build | ||
JENKINS_TASK=tool-${TOOL_NAME}-build-debian7-64bits-gcc-4.7 | ||
BUILD_DIR=/scratchdir/$JENKINS_TASK/gatb-${TOOL_NAME}-release | ||
TOOL_GIT_HOME="/scratchdir/builds/workspace/gatb-${TOOL_NAME}" | ||
|
||
# path to 'github_release_manager.sh' script | ||
GRM_PATH="${BUILD_DIR}/github-release-api" | ||
GRM_CMD="${GRM_PATH}/github_release_manager.sh" | ||
# github credentials and repository | ||
GITHUB_REPO=${TOOL_NAME} | ||
GITHUB_OWNER=GATB | ||
GRM_CREDENTIALS="-l $GITHUB_ADMIN -t $GITHUB_TOKEN -o ${GITHUB_OWNER} -r ${GITHUB_REPO}" | ||
|
||
# Prepare build dir | ||
rm -rf $BUILD_DIR | ||
mkdir -p $BUILD_DIR | ||
|
||
#----------------------------------------------- | ||
# check tag version; 'master' is not allowed | ||
if [ ! "${BRANCH_TO_BUILD}" == "master" ] ; then | ||
cd ${TOOL_GIT_HOME} | ||
DOES_TAG_EXIST=`git tag -l | grep "^${BRANCH_TO_BUILD}$"` | ||
if [ -z ${DOES_TAG_EXIST} ] ; then | ||
echo "/!\ Error: tag '${BRANCH_TO_BUILD}' does not exist on 'gatb-tool-${TOOL_NAME}' repository" | ||
exit 1 | ||
fi | ||
else | ||
echo "/!\ Error: cannot make an official release on 'master' branch" | ||
exit 1 | ||
fi | ||
|
||
#----------------------------------------------- | ||
if [ "$INRIA_FORGE_LOGIN" == none ]; then | ||
echo "/!\ Error: No login name to connect to Inria Forge" | ||
exit 1 | ||
fi | ||
|
||
cd $BUILD_DIR | ||
git clone https://github.com/pgdurand/github-release-api.git | ||
|
||
################################################################ | ||
# RETRIEVE ARCHIVES FROM INRIA FORGE # | ||
################################################################ | ||
|
||
#retrieve last build from ci-inria (see tool-lean-build-XXX tasks) | ||
scp ${INRIA_FORGE_LOGIN}@scm.gforge.inria.fr:/home/groups/gatb-tools/htdocs/ci-inria/${TOOL_NAME}-${BRANCH_TO_BUILD}-bin-Linux.tar.gz . | ||
[ $? != 0 ] && exit 1 | ||
scp ${INRIA_FORGE_LOGIN}@scm.gforge.inria.fr:/home/groups/gatb-tools/htdocs/ci-inria/${TOOL_NAME}-${BRANCH_TO_BUILD}-bin-Darwin.tar.gz . | ||
[ $? != 0 ] && exit 1 | ||
scp ${INRIA_FORGE_LOGIN}@scm.gforge.inria.fr:/home/groups/gatb-tools/htdocs/ci-inria/${TOOL_NAME}-${BRANCH_TO_BUILD}-Source.tar.gz . | ||
[ $? != 0 ] && exit 1 | ||
|
||
################################################################ | ||
# INTERACT WITH GITHUB # | ||
################################################################ | ||
|
||
# create Github release | ||
${GRM_CMD} ${GRM_CREDENTIALS} -d ${BRANCH_TO_BUILD} -c create | ||
if [ $? != 0 ] ; then | ||
echo "/!\ Error: unable to create release, check above error" | ||
exit 1 | ||
fi | ||
|
||
#upload files | ||
function uploadFile(){ | ||
local FILE_TO_LOAD=$1 | ||
echo "Uploading: ${FILE_TO_LOAD}" | ||
${GRM_CMD} ${GRM_CREDENTIALS} -d ${BRANCH_TO_BUILD} -c upload ${FILE_TO_LOAD} | ||
if [ $? != 0 ] ; then | ||
echo "/!\ Error: unable to upload file, check above error" | ||
exit 1 | ||
fi | ||
} | ||
|
||
uploadFile ${TOOL_NAME}-${BRANCH_TO_BUILD}-bin-Linux.tar.gz | ||
uploadFile ${TOOL_NAME}-${BRANCH_TO_BUILD}-bin-Darwin.tar.gz | ||
uploadFile ${TOOL_NAME}-${BRANCH_TO_BUILD}-Source.tar.gz | ||
|
||
|