From 016942aa593bbb1cd7a17b279352d56c8743ac40 Mon Sep 17 00:00:00 2001 From: Neo Zhang Jianyu Date: Fri, 8 Nov 2024 09:38:54 +0800 Subject: [PATCH] add ci for build online doc (#241) * add ci for build online doc * for debug * for debug * fix bug * add print Signed-off-by: ZhangJianyu * add print * debug * debug * debug * debug * debug * fix * debug * fix * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug * rm write access --------- Signed-off-by: ZhangJianyu Co-authored-by: ZhangJianyu --- .github/workflows/check-online-doc-build.yml | 21 ++++++++++++++++++++ CONTRIBUTING.md | 2 +- conf.py | 1 + scripts/build.sh | 2 +- scripts/filter-doc-log.sh | 8 ++++---- scripts/filter-known-issues.py | 12 +++++++++-- 6 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/check-online-doc-build.yml diff --git a/.github/workflows/check-online-doc-build.yml b/.github/workflows/check-online-doc-build.yml new file mode 100644 index 00000000..f4c21fbe --- /dev/null +++ b/.github/workflows/check-online-doc-build.yml @@ -0,0 +1,21 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +name: Check Online Document Building +permissions: {} + +on: + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Build Online Document + shell: bash + run: | + git config --local --get remote.origin.url + echo "build online doc" + bash scripts/build.sh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9c8bd2dc..2a3bfc2c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,4 +11,4 @@ Thank you for being a part of this journey. We can't wait to see what we can ach # Additional Content - [Code of Conduct](https://github.com/opea-project/docs/tree/main/community/CODE_OF_CONDUCT.md) -- [Security Policy](https://github.com/opea-project/docs/tree/main/community/SECURITY.md) \ No newline at end of file +- [Security Policy](https://github.com/opea-project/docs/tree/main/community/SECURITY.md) diff --git a/conf.py b/conf.py index 43164625..40e46375 100644 --- a/conf.py +++ b/conf.py @@ -114,6 +114,7 @@ ) } +show_warning_types = True # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the diff --git a/scripts/build.sh b/scripts/build.sh index 89679883..9cedec55 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -40,8 +40,8 @@ echo "Build HTML" cd docs make clean make html - retval=$? +echo "result = $retval" if [ $retval -ne 0 ]; then echo "make html is error" exit 1 diff --git a/scripts/filter-doc-log.sh b/scripts/filter-doc-log.sh index 61f2417c..a7cbd90a 100755 --- a/scripts/filter-doc-log.sh +++ b/scripts/filter-doc-log.sh @@ -9,7 +9,7 @@ # Only argument is the name of the log file saved by the build. KI_SCRIPT=scripts/filter-known-issues.py -CONFIG_DIR=.known-issues/doc +CONFIG_DIR=.known-issues/ LOG_FILE=$1 BUILDDIR=$(dirname $LOG_FILE) @@ -32,7 +32,7 @@ else fi if [ -s "${LOG_FILE}" ]; then - $KI_SCRIPT --config-dir ${CONFIG_DIR} ${LOG_FILE} > ${BUILDDIR}/doc.warnings 2>&1 + python3 $KI_SCRIPT --config-dir ${CONFIG_DIR} ${LOG_FILE} > ${BUILDDIR}/doc.warnings 2>&1 if [ -s ${BUILDDIR}/doc.warnings ]; then echo echo -e "${red}New errors/warnings found, please fix them:" @@ -41,7 +41,7 @@ if [ -s "${LOG_FILE}" ]; then echo cat ${BUILDDIR}/doc.warnings echo - exit 1 + exit 2 else echo -e "${green}No new errors/warnings." $TPUT sgr0 @@ -49,5 +49,5 @@ if [ -s "${LOG_FILE}" ]; then else echo "Error in $0: logfile \"${LOG_FILE}\" not found." - exit 1 + exit 3 fi diff --git a/scripts/filter-known-issues.py b/scripts/filter-known-issues.py index 79f56fd1..256aa3be 100755 --- a/scripts/filter-known-issues.py +++ b/scripts/filter-known-issues.py @@ -113,12 +113,21 @@ def config_import(paths): _paths = [] # Go over the list, flush it if the user gave an empty path ("") for path in paths: + if not os.path.exists(path): + logging.debug("{} not exist".format(path)) + continue + if path == "" or path is None: logging.debug("flushing current config list: %s", _paths) _paths = [] else: _paths.append(path) logging.debug("config list: %s", _paths) + + if len(_paths)==0: + logging.debug("No available path") + assert(False) + for path in _paths: config_import_path(path) @@ -146,8 +155,7 @@ def config_import(paths): logging.basicConfig(level=40 - 10 * (args.verbosity - args.quiet), format="%(levelname)s: %(message)s") -path = ".known-issues/" -logging.debug("Reading configuration from directory `%s`", path) +logging.debug("Reading configuration from directory `%s`", args.config_dir) config_import(args.config_dir) exclude_ranges = []