Initial setup for gating
Add files for building and gating the security-guide. Change-Id: Ia3b70a259289575c1b5c37d6d77e53af373bc62e
This commit is contained in:
parent
c80823bc9b
commit
2ebc3f4a24
6
doc-test.conf
Normal file
6
doc-test.conf
Normal file
@ -0,0 +1,6 @@
|
||||
[DEFAULT]
|
||||
repo_name = security-doc
|
||||
|
||||
# Repository is not under doc, thus we need to set api_site to True.
|
||||
api_site = True
|
||||
|
1
test-requirements.txt
Normal file
1
test-requirements.txt
Normal file
@ -0,0 +1 @@
|
||||
openstack-doc-tools>=0.15
|
91
tools/test-languages.sh
Executable file
91
tools/test-languages.sh
Executable file
@ -0,0 +1,91 @@
|
||||
#!/bin/bash
|
||||
|
||||
function setup_directory {
|
||||
SET_LANG=$1
|
||||
shift
|
||||
for BOOK_DIR in "$@" ; do
|
||||
echo " $BOOK_DIR"
|
||||
openstack-generate-docbook -l $SET_LANG -b $BOOK_DIR -r ./
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
function setup_lang {
|
||||
SET_LANG=$1
|
||||
shift
|
||||
echo "Setting up files for $SET_LANG"
|
||||
echo "======================="
|
||||
echo " Directories:"
|
||||
setup_directory $SET_LANG 'security-guide'
|
||||
}
|
||||
|
||||
function test_security_guide {
|
||||
SET_LANG=$1
|
||||
shift
|
||||
setup_lang "$SET_LANG"
|
||||
|
||||
case "$PURPOSE" in
|
||||
test)
|
||||
openstack-doc-test -v --check-build -l "$SET_LANG" \
|
||||
--only-book security-guide
|
||||
RET=$?
|
||||
;;
|
||||
publish)
|
||||
openstack-doc-test -v --publish --check-build "$SET_LANG" \
|
||||
--only-book security-guide
|
||||
RET=$?
|
||||
;;
|
||||
esac
|
||||
if [ "$RET" -eq "0" ] ; then
|
||||
echo "... succeeded"
|
||||
else
|
||||
echo "... failed"
|
||||
BUILD_FAIL=1
|
||||
fi
|
||||
}
|
||||
|
||||
function test_language () {
|
||||
|
||||
case "$language" in
|
||||
all)
|
||||
test_security_guide "ja"
|
||||
;;
|
||||
ja)
|
||||
test_security_guide "$language"
|
||||
;;
|
||||
*)
|
||||
BUILD_FAIL=1
|
||||
echo "Language $language not handled"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function usage () {
|
||||
echo "Call the script as: "
|
||||
echo "$0 PURPOSE LANGUAGE1 LANGUAGE2..."
|
||||
echo "PURPOSE is either 'test', 'publish' or 'publish-install'"
|
||||
echo "LANGUAGE can also be 'all'."
|
||||
}
|
||||
|
||||
if [ "$#" -lt 2 ] ; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ "$1" = "test" ] ; then
|
||||
PURPOSE="test"
|
||||
elif [ "$1" = "publish" ] ; then
|
||||
PURPOSE="publish"
|
||||
else
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
shift
|
||||
BUILD_FAIL=0
|
||||
for language in "$@" ; do
|
||||
echo
|
||||
echo "Building for language $language"
|
||||
echo
|
||||
test_language "$language"
|
||||
done
|
||||
|
||||
exit $BUILD_FAIL
|
68
tox.ini
Normal file
68
tox.ini
Normal file
@ -0,0 +1,68 @@
|
||||
[tox]
|
||||
minversion = 1.6
|
||||
envlist = checkniceness,checksyntax,checkdeletions,checkbuild
|
||||
skipsdist = True
|
||||
|
||||
[testenv]
|
||||
setenv =
|
||||
VIRTUAL_ENV={envdir}
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
whitelist_externals =
|
||||
bash
|
||||
cp
|
||||
mkdir
|
||||
rm
|
||||
sed
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
|
||||
[testenv:checkniceness]
|
||||
commands = openstack-doc-test --check-niceness {posargs}
|
||||
|
||||
[testenv:checksyntax]
|
||||
commands =
|
||||
openstack-doc-test --check-syntax {posargs}
|
||||
# Check that .po and .pot files are valid:
|
||||
bash -c "find security-guide -type f -regex '.*\.pot?' -print0|xargs -0 -n 1 msgfmt --check-format -o /dev/null"
|
||||
|
||||
[testenv:checkdeletions]
|
||||
commands = openstack-doc-test --check-deletions {posargs}
|
||||
|
||||
[testenv:checkbuild]
|
||||
commands = openstack-doc-test --check-build {posargs}
|
||||
|
||||
[testenv:publishdocs]
|
||||
# Prepare all documents so that they can get published on
|
||||
# docs.openstack.org with just copying publish-docs/* over.
|
||||
commands =
|
||||
# Create directory, it might not be here if openstack-doc-test does
|
||||
# not publish anything.
|
||||
mkdir publish-docs
|
||||
# We only publish changed manuals.
|
||||
openstack-doc-test --check-build --publish
|
||||
|
||||
[testenv:checklang]
|
||||
# Generatedocbook needs xml2po which cannot be installed
|
||||
# in the venv. Since it's installed in the system, let's
|
||||
# use sitepackages.
|
||||
sitepackages=True
|
||||
whitelist_externals = bash
|
||||
commands = bash tools/test-languages.sh test ja
|
||||
|
||||
[testenv:buildlang]
|
||||
# Run as "tox -e buildlang -- $LANG"
|
||||
# Generatedocbook needs xml2po which cannot be installed
|
||||
# in the venv. Since it's installed in the system, let's
|
||||
# use sitepackages.
|
||||
sitepackages=True
|
||||
whitelist_externals = bash
|
||||
commands = bash tools/test-languages.sh publish {posargs}
|
||||
|
||||
[testenv:publishlang]
|
||||
# Generatedocbook needs xml2po which cannot be installed
|
||||
# in the venv. Since it's installed in the system, let's
|
||||
# use sitepackages.
|
||||
sitepackages=True
|
||||
whitelist_externals = bash
|
||||
commands = bash tools/test-languages.sh publish all
|
Loading…
Reference in New Issue
Block a user