-
Notifications
You must be signed in to change notification settings - Fork 6
/
docker_entrypoint.sh
executable file
·60 lines (43 loc) · 1 KB
/
docker_entrypoint.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
#!/bin/bash
# USAGE: ./docker_entrypoint.sh <path to git volume> <path to project source with CMakelist.txt>
time=$(date)
echo "::set-output name=start_time::$time"
if [ -d $1 ] ; then
echo "Changing to working directory: $1"
cd $1
else
echo "Not changing directory: $1"
fi
# Remove $1 from args.
shift
# Default path
if [ "$#" == "0" ]; then
echo "$USAGE"
exit 1
fi
BUILD_BASE=build
CMAKE_DIR=cmake
rc=0
while (( "$#" )) ; do
PROJECT_SRC=$1
BUILD_DIR=${BUILD_BASE}/$(basename ${PROJECT_SRC/\/src})
rm -rf ${BUILD_DIR}
mkdir -p ${BUILD_DIR}
cmake \
-DCMAKE_MAKE_PROGRAM=make \
-DCMAKE_TOOLCHAIN_FILE=../../${CMAKE_DIR}/riscv.cmake \
-G "Unix Makefiles" \
-B ${BUILD_DIR} \
-S ${PROJECT_SRC} \
cmake --build ${BUILD_DIR}
if [ "$?" != "0" ] ; then
echo "CMAKE: ${PROJECT_SRC}; Build failed: $?"
rc = $[$rc + 1]
else
echo "CMAKE: ${PROJECT_SRC}; Build success"
fi
shift
done
time=$(date)
echo "::set-output name=end_time::$time"
exit $rc