diff --git a/.github/workflows/post-commit.yml b/.github/workflows/post-commit.yml index f94f3a2fc9f7..e12c9c74a262 100644 --- a/.github/workflows/post-commit.yml +++ b/.github/workflows/post-commit.yml @@ -77,6 +77,7 @@ jobs: - author - bats - checkstyle + - docs - findbugs - rat - unit @@ -93,7 +94,7 @@ jobs: maven-repo-${{ hashFiles('**/pom.xml') }}-8 maven-repo-${{ hashFiles('**/pom.xml') }} maven-repo- - if: ${{ !contains('author,bats', matrix.check) }} + if: ${{ !contains('author,bats,docs', matrix.check) }} - name: Execute tests run: hadoop-ozone/dev-support/checks/${{ matrix.check }}.sh - name: Summary of failures diff --git a/hadoop-ozone/dev-support/checks/_lib.sh b/hadoop-ozone/dev-support/checks/_lib.sh index ddc2866cd3fe..56b15da03088 100644 --- a/hadoop-ozone/dev-support/checks/_lib.sh +++ b/hadoop-ozone/dev-support/checks/_lib.sh @@ -87,6 +87,34 @@ _install_flekszible() { chmod +x bin/flekszible } +install_hugo() { + _install_tool hugo bin +} + +_install_hugo() { + : ${HUGO_VERSION:=0.81.0} + + local os=$(uname -s) + local arch=$(uname -m) + + mkdir bin + + case "${os}" in + Darwin) + os=macOS + ;; + esac + + case "${arch}" in + x86_64) + arch=64bit + ;; + esac + + curl -LSs "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_${os}-${arch}.tar.gz" | tar -xz -f - -C bin hugo + chmod +x bin/hugo +} + install_virtualenv() { _install_tool virtualenv } diff --git a/hadoop-ozone/dev-support/checks/docs.sh b/hadoop-ozone/dev-support/checks/docs.sh new file mode 100755 index 000000000000..11cb21859a4e --- /dev/null +++ b/hadoop-ozone/dev-support/checks/docs.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -u -o pipefail + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +cd "${DIR}/../../.." || exit 1 + +source "${DIR}/_lib.sh" +install_hugo + +REPORT_DIR=${OUTPUT_DIR:-"${DIR}/../../../target/docs"} +mkdir -p "${REPORT_DIR}" +REPORT_FILE="${REPORT_DIR}/summary.txt" + +hadoop-hdds/docs/dev-support/bin/generate-site.sh | tee "${REPORT_DIR}/output.log" +rc=$? + +grep -o 'ERROR.*' "${REPORT_DIR}/output.log" > "${REPORT_FILE}" + +wc -l "${REPORT_FILE}" | awk '{ print $1 }' > "${REPORT_DIR}/failures" + +if [[ -s "${REPORT_FILE}" ]]; then + exit 1 +fi + +exit ${rc}