forked from ratanparai/cpp-template
-
Notifications
You must be signed in to change notification settings - Fork 107
Expand file tree
/
Copy pathprecheckin.csh
More file actions
23 lines (20 loc) · 858 Bytes
/
precheckin.csh
File metadata and controls
23 lines (20 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# This script is used to run pre-checkin tasks for a project.
bazel clean --expunge
# Remove any existing build artifacts
rm -rf bazel-bin bazel-out bazel-testlogs
# Run the build command for all targets in the src directory
# This will ensure that all source files are compiled and linked correctly
bazel build $(bazel query //src/...)
# Run the test command for all targets in the src directory
# Note: not all tests are expected to pass since this is a demo of gtests.
bazel test $(bazel query //tests/gtest_demo/...)
bazel test $(bazel query //tests/gmock_demo/...)
bazel test $(bazel query 'kind(".*_test", //tests:all)')
# Run the commands from the README.md file that are in the bash code blocks
awk '
/^\`\`\`bash/ {in_bash=1; next}
/^\`\`\`/ {in_bash=0}
in_bash && /^bazel / {print}
' README.md | while read -r cmd; do
eval "$cmd"
done