-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker_entrypoint.sh
More file actions
executable file
·83 lines (63 loc) · 1.57 KB
/
docker_entrypoint.sh
File metadata and controls
executable file
·83 lines (63 loc) · 1.57 KB
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
#!/bin/bash
# USAGE: ./docker_entrypoint.sh <native or target> <path to git volume> <path to project source with CMakelist.txt>
time=$(date)
echo "::set-output name=start_time::$time"
build_type=$1
# Remove $1 from args.
shift
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_docker
CMAKE_DIR=cmake
rc=0
PROJECT_SRC=baremetal-cxx-coro-dev
for target in $build_type ; do
BUILD_DIR=${BUILD_BASE}_$target
echo "Using: BUILD_DIR=${BUILD_DIR}, PROJECT_SRC=${PROJECT_SRC}"
rm -rf ${BUILD_DIR}
mkdir -p ${BUILD_DIR}
if [ "$target" == "target" ] ; then
EXTRA_ARGS="-DCMAKE_TOOLCHAIN_FILE=${CMAKE_DIR}/riscv.cmake"
else
EXTRA_ARGS="-DCMAKE_BUILD_TYPE=Debug"
fi
cmake \
-DCMAKE_MAKE_PROGRAM=make \
${EXTRA_ARGS} \
-G "Unix Makefiles" \
-B ${BUILD_DIR} \
-S .
cmake --build ${BUILD_DIR}
if [ "$?" != "0" ] ; then
echo "CMAKE: ${PROJECT_SRC}; Build failed: $?"
rc=$[$rc + 1]
else
echo "CMAKE: ${PROJECT_SRC}; Build success"
fi
done
echo "RUN TESTS IN ${BUILD_BASE}_native"
${BUILD_BASE}_native/test/unit_tests
pushd ${BUILD_BASE}_native
ctest \
--output-junit results.xml
popd
if [ "$?" != "0" ] ; then
echo "CMAKE: ${PROJECT_SRC}; Test failed: $?"
rc=$[$rc + 1]
else
echo "CMAKE: ${PROJECT_SRC}; Test success"
fi
time=$(date)
echo "::set-output name=end_time::$time"
exit $rc