diff --git a/report/.gitignore b/report/.gitignore new file mode 100644 index 000000000..84c048a73 --- /dev/null +++ b/report/.gitignore @@ -0,0 +1 @@ +/build/ diff --git a/report/build.sh b/report/build.sh new file mode 100755 index 000000000..7919c2512 --- /dev/null +++ b/report/build.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +# Produce test HTML report file into ${REPORT_DIR} + +set -xeu + + +TESTR_DIR=${TESTR_DIR:-$(pwd)} +BUILD_DIR=${BUILD_DIR:-${TESTR_DIR}/report/build} +SUBUNIT_FILE=${SUBUNIT_FILE:-${BUILD_DIR}/last.subunit} +TESTR_RESULTS_HTML=${TESTR_RESULTS_HTML:-${BUILD_DIR}/testr_results.html} + +make_testr_results_html() { + mkdir -p "$(dirname ${SUBUNIT_FILE})" + (cd "${TESTR_DIR}" && stestr last --subunit) > "${SUBUNIT_FILE}" + (cd "${BUILD_DIR}" && subunit2html "${SUBUNIT_FILE}" "${TESTR_RESULTS_HTML}") +} + +make_testr_results_html diff --git a/report/requirements.txt b/report/requirements.txt new file mode 100644 index 000000000..2d450a513 --- /dev/null +++ b/report/requirements.txt @@ -0,0 +1,4 @@ +# Requirements file for 'report' Tox environment + +os-testr>=1.0 # Apache 2.0 +stestr>=2.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini index 5b60509d8..60027f663 100644 --- a/tox.ini +++ b/tox.ini @@ -143,7 +143,7 @@ whitelist_externals = * commands = {posargs} -# --- documentation environments --------------------------------------------- +# --- documentation environments ---------------------------------------------- [testenv:docs] @@ -169,3 +169,9 @@ deps = {[testenv:docs]deps} commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html + +# --- CI report environments -------------------------------------------------- + +[testenv:report] +deps = -r {toxinidir}/report/requirements.txt +commands = {toxinidir}/report/build.sh