forked from lnls-dig/openMMC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci_build.sh
executable file
·91 lines (79 loc) · 2.42 KB
/
ci_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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/env bash
# help debug
set -x
set -e
set -o
LANG=C
LC_ALL=C
export LANG LC_ALL
# Location of releases
set +e
GIT_DESCRIBE=$(git describe --tags --abbrev=10)
if [ $? -ne 0 ]; then
GIT_DESCRIBE=devel
fi
set -e
# Declare all combinations for deploy all
# Note that the key is the name of the release object
declare -A BUILDS
BUILDS[afc-bpm-3.0-${GIT_DESCRIBE}]="\
-DBOARD=afc-bpm \
-DVERSION=3.0 \
-DBOARD_RTM= \
-DCMAKE_BUILD_TYPE=RelWithDebInfo"
BUILDS[afc-bpm-3.1-${GIT_DESCRIBE}]="\
-DBOARD=afc-bpm \
-DVERSION=3.1 \
-DBOARD_RTM= \
-DCMAKE_BUILD_TYPE=RelWithDebInfo"
BUILDS[afc-timing-${GIT_DESCRIBE}]="\
-DBOARD=afc-timing \
-DVERSION= \
-DBOARD_RTM=rtm-8sfp \
-DCMAKE_BUILD_TYPE=RelWithDebInfo"
TOP=$(pwd)
case "${BUILD_ARTIFACT}" in
# Generate builds for all list items. Both "all_binaries"
# and "docs" needs to build everyting and pass all tests.
all_binaries|docs)
for build in "${!BUILDS[@]}"; do
echo "Generating build for:" ${build} && \
mkdir -p ${BUILD_DIR}-${build} && \
cd ${BUILD_DIR}-${build} && \
cmake ../ ${BUILDS[${build}]}
# For each build, generate the "full"
# binary as well
for target in all full_binary; do
make ${target}
done
cd ${TOP}
done
# Extra step for "all_binaries" is to copy
# the artifacts to a release folder
if [ "${BUILD_ARTIFACT}" = "all_binaries" ]; then
# Copy the generated files to the release folder
mkdir -p ${RELEASE_DIR}
for build in "${!BUILDS[@]}"; do
cp ${BUILD_DIR}-${build}/out/openMMC.axf ${RELEASE_DIR}/openMMC-${build}.axf
cp ${BUILD_DIR}-${build}/out/openMMC.bin ${RELEASE_DIR}/openMMC-${build}.bin
cp ${BUILD_DIR}-${build}/out/bootloader.axf ${RELEASE_DIR}/bootloader-${build}.axf
cp ${BUILD_DIR}-${build}/out/bootloader.bin ${RELEASE_DIR}/bootloader-${build}.bin
done
fi
;;
# Regular build
binary)
mkdir -p ${BUILD_DIR} && \
cd ${BUILD_DIR} && \
cmake ../ \
-DBOARD=${BOARD} \
-DVERSION=${VERSION} \
-DBOARD_RTM=${RTM} \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} && \
make
;;
*)
echo "BUILD_ARTIFACT invalid: "${BUILD_ARTIFACT}
exit 0
;;
esac