summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Kulhanek <tomas.kulhanek@stfc.ac.uk>2019-01-23 11:26:10 +0000
committerGitHub <noreply@github.com>2019-01-23 11:26:10 +0000
commitb38ac34e763aa442a19dff7c2c22f8892cc0cd3c (patch)
treeb8f3f1235b174a9bb2613eb5e54099f3a1860847
parent9f186d5978aa4e528ea071d5de0a74edb71916ad (diff)
parent619e972559992684854eef854e60fbc363e93819 (diff)
downloadregularization-b38ac34e763aa442a19dff7c2c22f8892cc0cd3c.tar.gz
regularization-b38ac34e763aa442a19dff7c2c22f8892cc0cd3c.tar.bz2
regularization-b38ac34e763aa442a19dff7c2c22f8892cc0cd3c.tar.xz
regularization-b38ac34e763aa442a19dff7c2c22f8892cc0cd3c.zip
Merge pull request #92 from TomasKulhanek/master
build scripts detects tag and branch
-rw-r--r--Readme.md4
-rwxr-xr-xbuild/jenkins-build.sh60
2 files changed, 38 insertions, 26 deletions
diff --git a/Readme.md b/Readme.md
index 70c9e13..1745b9e 100644
--- a/Readme.md
+++ b/Readme.md
@@ -1,4 +1,6 @@
-[![Build Status](https://anvil.softeng-support.ac.uk/jenkins/buildStatus/icon?job=CILsingle/CCPi-Regularisation-Toolkit)](https://anvil.softeng-support.ac.uk/jenkins/job/CILsingle/job/CCPi-Regularisation-Toolkit/)
+| Master | Development |
+|--------|-------------|
+| [![Build Status](https://anvil.softeng-support.ac.uk/jenkins/buildStatus/icon?job=CILsingle/CCPi-Regularisation-Toolkit)](https://anvil.softeng-support.ac.uk/jenkins/job/CILsingle/job/CCPi-Regularisation-Toolkit/) | [![Build Status](https://anvil.softeng-support.ac.uk/jenkins/buildStatus/icon?job=CILsingle/CCPi-Regularisation-Toolkit-dev)](https://anvil.softeng-support.ac.uk/jenkins/job/CILsingle/job/CCPi-Regularisation-Toolkit-dev/) |
# CCPi-Regularisation Toolkit (CCPi-RGL)
**Iterative image reconstruction (IIR) methods normally require regularisation to stabilise the convergence and make the reconstruction problem (inverse problem) more well-posed. The CCPi-RGL software provides 2D/3D and multi-channel regularisation strategies to ensure better performance of IIR methods. The regularisation modules are well-suited to use with [splitting algorithms](https://en.wikipedia.org/wiki/Augmented_Lagrangian_method#Alternating_direction_method_of_multipliers), such as, [ADMM](https://github.com/dkazanc/ADMM-tomo) and [FISTA](https://github.com/dkazanc/FISTA-tomo). Furthermore, the toolkit can be used for simpler inversion tasks, such as, image denoising, inpaiting, deconvolution etc. The core modules are written in C-OMP and CUDA languages and wrappers for Matlab and Python are provided.**
diff --git a/build/jenkins-build.sh b/build/jenkins-build.sh
index ca5b57a..87ca54f 100755
--- a/build/jenkins-build.sh
+++ b/build/jenkins-build.sh
@@ -4,26 +4,26 @@ if [[ -n ${CIL_VERSION} ]]
then
echo Using defined version: $CIL_VERSION
else
-
- #get tag, remove first char ('v') and leave rest
+ # define CIL_VERSION from last git tag, remove first char ('v') and leave rest
export CIL_VERSION=`git describe --tags | tail -c +2`
+ # dash means that it's some commit after tag release -thus will be treated as dev
if [[ ${CIL_VERSION} == *"-"* ]]; then
- # detected dash means that it is dev version
- # version is then string-string and all after second dash is ignored (usually commit sha)
- export CIL_VERSION=`echo ${CIL_VERSION} | cut -d "-" -f -2`
- # but dash is prohibited for conda build
- export CIL_VERSION=`echo ${CIL_VERSION} | tr - _`
- echo Building dev version ${CIL_VERSION}
+ # detected dash means that it is dev version,
+ # get first and second part between first dash and ignore all after other dash (usually sha)
+ # and as dash is prohibited for conda build, replace with underscore
+ export CIL_VERSION=`echo ${CIL_VERSION} | cut -d "-" -f -2 | tr - _`
+ echo Building dev version: ${CIL_VERSION}
else
- echo Defining version from last git tag and commit: $CIL_VERSION
- fi
+ echo Building release version: $CIL_VERSION
+ fi
fi
+
# Script to builds source code in Jenkins environment
# module try-load conda
# install miniconda if the module is not present
if hash conda 2>/dev/null; then
- echo using conda
+ echo using installed conda
else
if [ ! -f Miniconda3-latest-Linux-x86_64.sh ]; then
wget -q https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
@@ -32,6 +32,11 @@ else
./Miniconda3-latest-Linux-x86_64.sh -u -b -p .
PATH=$PATH:./bin
fi
+
+GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`
+echo on branch ${GIT_BRANCH}
+cat .git/HEAD
+
# presume that git clone is done before this script is launched, if not, uncomment
#git clone https://github.com/vais-ral/CCPi-Regularisation-Toolkit
conda install -y conda-build
@@ -43,20 +48,25 @@ conda build Wrappers/Python/conda-recipe
export REG_FILES=`conda build Wrappers/Python/conda-recipe --output`
# REG_FILES variable should contain output files
echo files created: $REG_FILES
-#upload to anaconda
-if [[ -n ${CCPI_CONDA_TOKEN} ]]
-then
- conda install anaconda-client
- while read -r outfile; do
- #if 0 commit after tag then call anaconda without --label dev
- #TODO if pull request??? do not upload
- if [[ $CIL_VERSION == *"_"* ]]; then
- # upload with dev label
- anaconda -v -t ${CCPI_CONDA_TOKEN} upload $outfile --force --label dev
- else
- anaconda -v -t ${CCPI_CONDA_TOKEN} upload $outfile --force
- fi
- done <<< "$REG_FILES"
+
+# upload to anaconda only if token is defined
+# and TODO pull request not to upload
+
+if [[ -n ${CCPI_CONDA_TOKEN} ]]; then
+ if [[ ${GIT_BRANCH} == "master" ]]; then
+ conda install anaconda-client
+ while read -r outfile; do
+ #if >0 commit (some _ in version) then marking as dev build
+ if [[ $CIL_VERSION == *"_"* ]]; then
+ # upload with dev label
+ anaconda -v -t ${CCPI_CONDA_TOKEN} upload $outfile --force --label dev
+ else
+ anaconda -v -t ${CCPI_CONDA_TOKEN} upload $outfile --force
+ fi
+ done <<< "$REG_FILES"
+ else
+ echo git branch is not master, will not upload to anaconda.
+ fi
else
echo CCPI_CONDA_TOKEN not defined, will not upload to anaconda.
fi