This repository was archived by the owner on Dec 8, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +51
-0
lines changed Expand file tree Collapse file tree 3 files changed +51
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ # Copyright 2020 Google LLC
3+ #
4+ # Licensed under the Apache License, Version 2.0 (the "License");
5+ # you may not use this file except in compliance with the License.
6+ # You may obtain a copy of the License at
7+ #
8+ # http://www.apache.org/licenses/LICENSE-2.0
9+ #
10+ # Unless required by applicable law or agreed to in writing, software
11+ # distributed under the License is distributed on an "AS IS" BASIS,
12+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ # See the License for the specific language governing permissions and
14+ # limitations under the License.
15+
16+ set -eu
17+
18+ if [[ " ${CHECK_MARKDOWN} " != " yes" ]]; then
19+ echo " Skipping the generated markdown check as it is disabled for this build."
20+ exit 0
21+ fi
22+
23+ declare -A -r GENERATOR_MAP=(
24+ [" ci/generate-markdown/generate-readme.sh" ]=" README.md"
25+ [" ci/generate-markdown/generate-packaging.sh" ]=" doc/packaging.md"
26+ )
27+
28+ exit_status=0
29+ for k in " ${! GENERATOR_MAP[@]} " ; do
30+ generator=" ${k} "
31+ file=" ${GENERATOR_MAP[${k}]} "
32+ out=$( diff <( " ${generator} " ) " ${file} " || true)
33+ if [[ -n " ${out} " ]]; then
34+ echo " Did you forget to run ${generator} ?"
35+ echo " Unexpected diff found in ${file} :"
36+ echo " $out "
37+ exit_status=1
38+ fi
39+ done
40+
41+ exit ${exit_status}
Original file line number Diff line number Diff line change @@ -41,6 +41,11 @@ echo "Verify formatting $(date)"
4141(cd " ${PROJECT_ROOT} " ; ./ci/check-style.sh)
4242echo " ================================================================"
4343
44+ echo " ================================================================"
45+ echo " Verify markdown $( date) "
46+ (cd " ${PROJECT_ROOT} " ; ./ci/check-markdown.sh)
47+ echo " ================================================================"
48+
4449echo " ================================================================"
4550echo " Compiling on $( date) "
4651echo " ================================================================"
Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ if [[ "${BUILD_NAME}" = "clang-tidy" ]]; then
7979 export CXX=clang++
8080 export BUILD_TYPE=Debug
8181 export CHECK_STYLE=yes
82+ export CHECK_MARKDOWN=yes
8283 export GENERATE_DOCS=yes
8384 export CLANG_TIDY=yes
8485 export TEST_INSTALL=yes
@@ -326,6 +327,10 @@ docker_flags=(
326327 # clang-format, cmake-format, and buildifier.
327328 " --env" " CHECK_STYLE=${CHECK_STYLE:- } "
328329
330+ # If set to 'yes', the build script will verify that auto-generated
331+ # markdown files are in sync.
332+ " --env" " CHECK_MARKDOWN=${CHECK_MARKDOWN:- } "
333+
329334 # If set to 'yes', the build script will configure clang-tidy. Currently
330335 # only the CMake builds use this flag.
331336 " --env" " CLANG_TIDY=${CLANG_TIDY:- } "
You can’t perform that action at this time.
0 commit comments