Nox docs build now builds HTML docs and Man pages

This commit is contained in:
Pedro Algarvio 2019-10-28 14:17:49 +00:00
parent c086a7546a
commit ed0dccaeff
No known key found for this signature in database
GPG Key ID: BB36BF6584A298FF
2 changed files with 60 additions and 5 deletions

View File

@ -41,13 +41,22 @@ wrappedNode('docs', global_timeout, '#jenkins-prod-pr') {
'''
}
stage('Build') {
stage('Build HTML Docs') {
sh shell_header + '''
eval "$(pyenv init -)"
pyenv shell 3.6.8
nox -e docs
nox -e 'docs-html(compress=True)'
'''
archiveArtifacts artifacts: 'doc/doc-archive.tar.gz'
archiveArtifacts artifacts: 'doc/html-archive.tar.gz'
}
stage('Build Man Pages') {
sh shell_header + '''
eval "$(pyenv init -)"
pyenv shell 3.6.8
nox -e 'docs-man(compress=True, update=False)'
'''
archiveArtifacts artifacts: 'doc/man-archive.tar.gz'
}
}

View File

@ -945,10 +945,22 @@ def lint_tests(session):
@nox.session(python='3')
def docs(session):
@nox.parametrize('update', [False, True])
@nox.parametrize('compress', [False, True])
def docs(session, compress, update):
'''
Build Salt's Documentation
'''
session.notify('docs-html(compress={})'.format(compress))
session.notify('docs-man(compress={}, update={})'.format(compress, update))
@nox.session(name='docs-html', python='3')
@nox.parametrize('compress', [False, True])
def docs_html(session, compress):
'''
Build Salt's HTML Documentation
'''
pydir = _get_pydir(session)
if pydir == 'py3.4':
session.error('Sphinx only runs on Python >= 3.5')
@ -967,5 +979,39 @@ def docs(session):
os.chdir('doc/')
session.run('make', 'clean', external=True)
session.run('make', 'html', 'SPHINXOPTS=-W', external=True)
session.run('tar', '-czvf', 'doc-archive.tar.gz', '_build/html')
if compress:
session.run('tar', '-czvf', 'html-archive.tar.gz', '_build/html', external=True)
os.chdir('..')
@nox.session(name='docs-man', python='3')
@nox.parametrize('update', [False, True])
@nox.parametrize('compress', [False, True])
def docs_man(session, compress, update):
'''
Build Salt's Manpages Documentation
'''
pydir = _get_pydir(session)
if pydir == 'py3.4':
session.error('Sphinx only runs on Python >= 3.5')
requirements_file = 'requirements/static/docs.in'
distro_constraints = [
'requirements/static/{}/docs.txt'.format(_get_pydir(session))
]
install_command = [
'--progress-bar=off', '-r', requirements_file
]
for distro_constraint in distro_constraints:
install_command.extend([
'--constraint', distro_constraint
])
session.install(*install_command, silent=PIP_INSTALL_SILENT)
os.chdir('doc/')
session.run('make', 'clean', external=True)
session.run('make', 'man', 'SPHINXOPTS=-W', external=True)
if update:
session.run('rm', '-rf', 'man/', external=True)
session.run('cp', '-Rp', '_build/man', 'man/', external=True)
if compress:
session.run('tar', '-czvf', 'man-archive.tar.gz', '_build/man', external=True)
os.chdir('..')