-
Notifications
You must be signed in to change notification settings - Fork 6
/
check-build.sh
executable file
·61 lines (51 loc) · 2.45 KB
/
check-build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash -e
# My-First-Deploy
#
###############################################################################################
# This is the demo version of a build script for the CODE-RADE. Customise it for your needs. #
###############################################################################################
# If you have gotten this far, congratulations ! the first test has passed - compilation
# Now you have to check whether the application has been _properly_ compiled and whether it can execute
# properly.
# Most Open Source projects provide built-in tests which you can run using the makefile, but it's also a
# good idea to try to execute the program itself with a trivial use case.
# you need the CI module to set up your environment.
. /etc/profile.d/modules.sh
module add ci
# we need to run make check in the build directory - it's still there from the previous step, since we're in the same job.
cd ${WORKSPACE}/${NAME}-${VERSION}/build-${BUILD_NUMBER}
nice -n20 make -j2 check
# If this has passed, you can install the package
make install
# this should put things in $SOFT_DIR, which you recall is relative to /apprepo
###### MODULE FILE ########
# Now we have to create the modulefile so that we can use this application later
###########################
# this is the modulefile that will be used for integration.
mkdir -p modules/ci
(
cat <<MODULE_FILE
#%Module1.0
## $NAME modulefile
##
proc ModulesHelp { } {
puts stderr " This module does nothing but alert the user"
puts stderr " that the [module-info name] module is not available"
}
module-whatis "$NAME $VERSION."
set GMP_VERSION $VERSION
set GMP_DIR /apprepo/$::env(SITE)/$::env(OS)/$::env(ARCH)/$::env(NAME)/$VERSION
setenv GMP_DIR /apprepo/$::env(SITE)/$::env(OS)/$::env(ARCH)/$::env(NAME)/$VERSION
prepend-path LD_LIBRARY_PATH \$GMP_DIR/lib
prepend-path GCC_INCLUDE_DIR \$GMP_DIR/include
setenv CFLAGS "-I\$GMP_DIR/include -L\$GMP_DIR/lib"
MODULE_FILE
) > modules/ci/${VERSION}
# LIBRARIES_MODULES is set by the CI module - it is a bit different for the deploy environment
mkdir -p ${LIBRARIES_MODULES}/${NAME}
cp modules/ci/${VERSION} ${LIBRARIES_MODULES}/${NAME}
# Now we have to build the artifact. This is a tarball at the lowest directory level which we can use to re-deploy
# REPO_DIR is defined by the CI module
mkdir -p ${REPO_DIR}
tar cvfz ${REPO_DIR}/build-${BUILD_NUMBER}.tar.gz -C ${SOFT_DIR} .
# we are no ready to deploy.