-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathci_cd_manual.sh
More file actions
97 lines (73 loc) · 1.82 KB
/
ci_cd_manual.sh
File metadata and controls
97 lines (73 loc) · 1.82 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
# On error, exit immediately
set -e
main(){
install_conan_config
build_template_app_cmake
build_template_app_conan_cmake
# run_clang_tidy
}
install_conan_config(){
title_1 "Install Conan config"
(cd tool/conan && ./conan_config_install.sh)
}
build_template_app_cmake(){
title_1 "Build Application CMake template"
cd application/template/app_cmake
rm -rf build/
title_2 "ARM GCC"
cmake --preset arm_gcc
cmake --build --preset arm_gcc
cmake --build --preset arm_gcc --target install
title_2 "Host GCC"
cmake --preset host_gcc
cmake --build --preset host_gcc
cmake --build --preset host_gcc --target install
title_2 "Host Clang"
cmake --preset host_clang
cmake --build --preset host_clang
cmake --build --preset host_clang --target install
title_2 "Code Linter"
cmake --preset code_linter
cmake --build --preset code_linter
cd -
}
build_template_app_conan_cmake(){
title_1 "Build Application Conan CMake template"
cd application/template/app_conan_cmake
rm -rf build/
title_2 "Cross compile"
conan build . -pr stm32f
cd -
}
run_clang_tidy(){
title_1 "Run Clang Tidy"
cd application/template/app_conan_cmake
# Pre-condition:
# - LLVM/bin must be in PATH
# - python3 be in path (on windows use: mklink python3.exe python.exe)
# -p: tells clang-tidy to use the compile commands from the specified build directory
# tee: output clang-tidy to file and stdout
run-clang-tidy -p build/MinSizeRel | tee build/MinSizeRel/clang_tidy_output.log
cd -
}
info(){
echo -e "$1"
}
title_1(){
echo -e "\n#=== $1"
}
title_2(){
echo -e "\n#--- $1"
}
error(){
RED='\033[0;41;30m'
STD='\033[0;0;39m'
echo -e "ERROR: ${RED}$1${STD}\n"
exit 1
}
#--- Main
(
time main
printf "\nCI/CD Done\n"
) 2>&1 | tee ci_cd_manual.log # redirect stdout/stderr to a file