Building documentation is now part of the prepare release step.

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
Pedro Algarvio 2023-02-02 14:45:34 +00:00 committed by Pedro Algarvio
parent 62331bfa8f
commit 0af788e4fe
7 changed files with 122 additions and 246 deletions

View file

@ -217,12 +217,18 @@ jobs:
python-version: "3.10"
- name: Cache Python Tools Virtualenvs
id: nox-dependencies-cache
id: tools-venvs-dependencies-cache
uses: actions/cache@v3
with:
path: .tools-venvs/
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|tools-venvs|${{ steps.setup-python.outputs.python-version }}|${{ hashFiles('requirements/**/*.txt') }}
- name: Cache Sphinx Doctrees
uses: actions/cache@v3
with:
path: doc/_build/doctrees/
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|sphinx-doctrees|${{ steps.setup-python.outputs.python-version }}|${{ hashFiles('requirements/**/*.txt') }}
- name: Setup Python Tools Scripts
uses: ./.github/actions/setup-python-tools-scripts
@ -250,10 +256,23 @@ jobs:
tools changelog update-release-notes --draft
tools changelog update-release-notes
- name: Build Documentation
shell: bash
run: |
tools docs html --no-clean --archive salt-${{ needs.prepare-workflow.outputs.salt-version }}-docs.tar.xz
- name: Generate MAN Pages
shell: bash
run: |
tools docs man
tools docs man --no-clean
- name: Upload Built Documentation Archive
uses: actions/upload-artifact@v3
with:
name: salt-${{ needs.prepare-workflow.outputs.salt-version }}-docs.tar.xz
path: salt-${{ needs.prepare-workflow.outputs.salt-version }}-docs.tar.xz
retention-days: 7
if-no-files-found: error
- name: Update Changelog
shell: bash
@ -279,57 +298,6 @@ jobs:
retention-days: 7
if-no-files-found: error
docs:
name: Build Docs
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['docs'] && fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
runs-on: ubuntu-latest
container:
image: python:3.10-slim-buster
needs:
- prepare-workflow
- prepare-release
steps:
- uses: actions/checkout@v3
- name: Download Release Changes
uses: actions/download-artifact@v3
with:
name: salt-${{ needs.prepare-workflow.outputs.salt-version }}.diff
- name: Apply release changes
shell: bash
run: |
git apply salt-${{ needs.prepare-workflow.outputs.salt-version }}.diff
rm salt-${{ needs.prepare-workflow.outputs.salt-version }}.diff
# - name: Install System Deps
# run: |
# echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list
# apt-get update
# apt-get install -y enchant git gcc imagemagick make zlib1g-dev libc-dev libffi-dev g++ libxml2 libxml2-dev libxslt-dev libcurl4-openssl-dev libssl-dev libgnutls28-dev xz-utils
# apt-get install -y git/buster-backports
- name: Install Nox
run: |
python -m pip install --upgrade pip
pip install nox
- name: Install Python Requirements
run:
nox --install-only --forcecolor -e 'docs-html(compress=False, clean=True)'
- name: Build Docs
env:
SKIP_REQUIREMENTS_INSTALL: YES
run: |
nox --forcecolor -e 'docs-html(compress=False, clean=True)'
- name: Store Generated Documentation
uses: actions/upload-artifact@v3
with:
name: salt-html-docs
path: doc/_build/html
if-no-files-found: error
build-source-tarball:
name: Build Source Tarball
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-source-tarball'] && fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
@ -775,7 +743,6 @@ jobs:
- prepare-workflow
- pre-commit
- lint
- docs
- build-deps-onedir
- build-salt-onedir
- build-pkgs

View file

@ -215,12 +215,18 @@ jobs:
python-version: "3.10"
- name: Cache Python Tools Virtualenvs
id: nox-dependencies-cache
id: tools-venvs-dependencies-cache
uses: actions/cache@v3
with:
path: .tools-venvs/
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|tools-venvs|${{ steps.setup-python.outputs.python-version }}|${{ hashFiles('requirements/**/*.txt') }}
- name: Cache Sphinx Doctrees
uses: actions/cache@v3
with:
path: doc/_build/doctrees/
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|sphinx-doctrees|${{ steps.setup-python.outputs.python-version }}|${{ hashFiles('requirements/**/*.txt') }}
- name: Setup Python Tools Scripts
uses: ./.github/actions/setup-python-tools-scripts
@ -248,10 +254,23 @@ jobs:
tools changelog update-release-notes --draft
tools changelog update-release-notes
- name: Build Documentation
shell: bash
run: |
tools docs html --no-clean --archive salt-${{ needs.prepare-workflow.outputs.salt-version }}-docs.tar.xz
- name: Generate MAN Pages
shell: bash
run: |
tools docs man
tools docs man --no-clean
- name: Upload Built Documentation Archive
uses: actions/upload-artifact@v3
with:
name: salt-${{ needs.prepare-workflow.outputs.salt-version }}-docs.tar.xz
path: salt-${{ needs.prepare-workflow.outputs.salt-version }}-docs.tar.xz
retention-days: 7
if-no-files-found: error
- name: Update Changelog
shell: bash
@ -277,57 +296,6 @@ jobs:
retention-days: 7
if-no-files-found: error
docs:
name: Build Docs
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['docs'] && fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
runs-on: ubuntu-latest
container:
image: python:3.10-slim-buster
needs:
- prepare-workflow
- prepare-release
steps:
- uses: actions/checkout@v3
- name: Download Release Changes
uses: actions/download-artifact@v3
with:
name: salt-${{ needs.prepare-workflow.outputs.salt-version }}.diff
- name: Apply release changes
shell: bash
run: |
git apply salt-${{ needs.prepare-workflow.outputs.salt-version }}.diff
rm salt-${{ needs.prepare-workflow.outputs.salt-version }}.diff
# - name: Install System Deps
# run: |
# echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list
# apt-get update
# apt-get install -y enchant git gcc imagemagick make zlib1g-dev libc-dev libffi-dev g++ libxml2 libxml2-dev libxslt-dev libcurl4-openssl-dev libssl-dev libgnutls28-dev xz-utils
# apt-get install -y git/buster-backports
- name: Install Nox
run: |
python -m pip install --upgrade pip
pip install nox
- name: Install Python Requirements
run:
nox --install-only --forcecolor -e 'docs-html(compress=False, clean=True)'
- name: Build Docs
env:
SKIP_REQUIREMENTS_INSTALL: YES
run: |
nox --forcecolor -e 'docs-html(compress=False, clean=True)'
- name: Store Generated Documentation
uses: actions/upload-artifact@v3
with:
name: salt-html-docs
path: doc/_build/html
if-no-files-found: error
build-source-tarball:
name: Build Source Tarball
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-source-tarball'] && fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
@ -821,7 +789,6 @@ jobs:
- prepare-workflow
- pre-commit
- lint
- docs
- build-deps-onedir
- build-salt-onedir
- build-pkgs

View file

@ -215,12 +215,18 @@ jobs:
python-version: "3.10"
- name: Cache Python Tools Virtualenvs
id: nox-dependencies-cache
id: tools-venvs-dependencies-cache
uses: actions/cache@v3
with:
path: .tools-venvs/
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|tools-venvs|${{ steps.setup-python.outputs.python-version }}|${{ hashFiles('requirements/**/*.txt') }}
- name: Cache Sphinx Doctrees
uses: actions/cache@v3
with:
path: doc/_build/doctrees/
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|sphinx-doctrees|${{ steps.setup-python.outputs.python-version }}|${{ hashFiles('requirements/**/*.txt') }}
- name: Setup Python Tools Scripts
uses: ./.github/actions/setup-python-tools-scripts
@ -248,10 +254,23 @@ jobs:
tools changelog update-release-notes --draft
tools changelog update-release-notes
- name: Build Documentation
shell: bash
run: |
tools docs html --no-clean --archive salt-${{ needs.prepare-workflow.outputs.salt-version }}-docs.tar.xz
- name: Generate MAN Pages
shell: bash
run: |
tools docs man
tools docs man --no-clean
- name: Upload Built Documentation Archive
uses: actions/upload-artifact@v3
with:
name: salt-${{ needs.prepare-workflow.outputs.salt-version }}-docs.tar.xz
path: salt-${{ needs.prepare-workflow.outputs.salt-version }}-docs.tar.xz
retention-days: 7
if-no-files-found: error
- name: Update Changelog
shell: bash
@ -277,57 +296,6 @@ jobs:
retention-days: 7
if-no-files-found: error
docs:
name: Build Docs
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['docs'] && fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
runs-on: ubuntu-latest
container:
image: python:3.10-slim-buster
needs:
- prepare-workflow
- prepare-release
steps:
- uses: actions/checkout@v3
- name: Download Release Changes
uses: actions/download-artifact@v3
with:
name: salt-${{ needs.prepare-workflow.outputs.salt-version }}.diff
- name: Apply release changes
shell: bash
run: |
git apply salt-${{ needs.prepare-workflow.outputs.salt-version }}.diff
rm salt-${{ needs.prepare-workflow.outputs.salt-version }}.diff
# - name: Install System Deps
# run: |
# echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list
# apt-get update
# apt-get install -y enchant git gcc imagemagick make zlib1g-dev libc-dev libffi-dev g++ libxml2 libxml2-dev libxslt-dev libcurl4-openssl-dev libssl-dev libgnutls28-dev xz-utils
# apt-get install -y git/buster-backports
- name: Install Nox
run: |
python -m pip install --upgrade pip
pip install nox
- name: Install Python Requirements
run:
nox --install-only --forcecolor -e 'docs-html(compress=False, clean=True)'
- name: Build Docs
env:
SKIP_REQUIREMENTS_INSTALL: YES
run: |
nox --forcecolor -e 'docs-html(compress=False, clean=True)'
- name: Store Generated Documentation
uses: actions/upload-artifact@v3
with:
name: salt-html-docs
path: doc/_build/html
if-no-files-found: error
build-source-tarball:
name: Build Source Tarball
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['build-source-tarball'] && fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
@ -773,7 +741,6 @@ jobs:
- prepare-workflow
- pre-commit
- lint
- docs
- build-deps-onedir
- build-salt-onedir
- build-pkgs

View file

@ -59,12 +59,18 @@ on:
python-version: "3.10"
- name: Cache Python Tools Virtualenvs
id: nox-dependencies-cache
id: tools-venvs-dependencies-cache
uses: actions/cache@v3
with:
path: .tools-venvs/
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|tools-venvs|${{ steps.setup-python.outputs.python-version }}|${{ hashFiles('requirements/**/*.txt') }}
- name: Cache Sphinx Doctrees
uses: actions/cache@v3
with:
path: doc/_build/doctrees/
key: ${{ needs.prepare-workflow.outputs.cache-seed }}|${{ github.workflow }}|sphinx-doctrees|${{ steps.setup-python.outputs.python-version }}|${{ hashFiles('requirements/**/*.txt') }}
- name: Setup Python Tools Scripts
uses: ./.github/actions/setup-python-tools-scripts
@ -92,10 +98,23 @@ on:
tools changelog update-release-notes --draft
tools changelog update-release-notes
- name: Build Documentation
shell: bash
run: |
tools docs html --no-clean --archive salt-${{ needs.prepare-workflow.outputs.salt-version }}-docs.tar.xz
- name: Generate MAN Pages
shell: bash
run: |
tools docs man
tools docs man --no-clean
- name: Upload Built Documentation Archive
uses: actions/upload-artifact@v3
with:
name: salt-${{ needs.prepare-workflow.outputs.salt-version }}-docs.tar.xz
path: salt-${{ needs.prepare-workflow.outputs.salt-version }}-docs.tar.xz
retention-days: 7
if-no-files-found: error
- name: Update Changelog
shell: bash
@ -124,64 +143,6 @@ on:
<%- endif %>
<%- set job_name = "docs" %>
<%- if includes.get(job_name, True) %>
<{ job_name }>:
<%- do conclusion_needs.append(job_name) %>
name: Build Docs
if: ${{ fromJSON(needs.prepare-workflow.outputs.jobs)['<{ job_name }>'] && fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
runs-on: ubuntu-latest
container:
image: python:3.10-slim-buster
needs:
- prepare-workflow
- prepare-release
steps:
- uses: actions/checkout@v3
- name: Download Release Changes
uses: actions/download-artifact@v3
with:
name: salt-${{ needs.prepare-workflow.outputs.salt-version }}.diff
- name: Apply release changes
shell: bash
run: |
git apply salt-${{ needs.prepare-workflow.outputs.salt-version }}.diff
rm salt-${{ needs.prepare-workflow.outputs.salt-version }}.diff
# - name: Install System Deps
# run: |
# echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list
# apt-get update
# apt-get install -y enchant git gcc imagemagick make zlib1g-dev libc-dev libffi-dev g++ libxml2 libxml2-dev libxslt-dev libcurl4-openssl-dev libssl-dev libgnutls28-dev xz-utils
# apt-get install -y git/buster-backports
- name: Install Nox
run: |
python -m pip install --upgrade pip
pip install nox
- name: Install Python Requirements
run:
nox --install-only --forcecolor -e 'docs-html(compress=False, clean=True)'
- name: Build Docs
env:
SKIP_REQUIREMENTS_INSTALL: YES
run: |
nox --forcecolor -e 'docs-html(compress=False, clean=True)'
- name: Store Generated Documentation
uses: actions/upload-artifact@v3
with:
name: salt-html-docs
path: doc/_build/html
if-no-files-found: error
<%- endif %>
<%- set job_name = "build-source-tarball" %>
<%- if includes.get(job_name, True) %>

View file

@ -1,6 +0,0 @@
@Library('salt@master-1.11') _
runDocs(
env: env)
// vim: ft=groovy

View file

@ -245,7 +245,6 @@ def define_jobs(ctx: Context, event_name: str, changed_files: pathlib.Path):
assert github_step_summary is not None
jobs = {
"docs": True,
"lint": True,
"test": True,
"prepare-release": True,
@ -281,15 +280,6 @@ def define_jobs(ctx: Context, event_name: str, changed_files: pathlib.Path):
# So, it's a pull request...
# Based on which files changed, we can decide what jobs to run.
required_docs_changes: set[str] = {
changed_files_contents["docs"],
changed_files_contents["salt"],
}
if required_docs_changes == {"false"}:
with open(github_step_summary, "a", encoding="utf-8") as wfh:
wfh.write("De-selecting the 'docs' job.\n")
jobs["docs"] = False
required_lint_changes: set[str] = {
changed_files_contents["salt"],
changed_files_contents["tests"],

View file

@ -36,9 +36,15 @@ docs = command_group(
@docs.command(
name="man",
arguments={
"no_clean": {
"help": "Don't cleanup prior to building",
}
},
)
def man(ctx: Context):
ctx.run("make", "clean", cwd="doc/", check=True)
def man(ctx: Context, no_clean: bool = False):
if no_clean is False:
ctx.run("make", "clean", cwd="doc/", check=True)
ctx.run("make", "man", "SHPINXOPTS=-W", cwd="doc/", check=True)
for root, dirs, files in os.walk("doc/_build/man"):
for file in files:
@ -47,26 +53,50 @@ def man(ctx: Context):
@docs.command(
name="html",
arguments={
"no_clean": {
"help": "Don't cleanup prior to building",
},
"archive": {
"help": "Compress the generated documentation into the provided archive.",
},
},
)
def html(ctx: Context):
ctx.run("make", "clean", cwd="doc/", check=True)
def html(ctx: Context, no_clean: bool = False, archive: pathlib.Path = None):
if no_clean is False:
ctx.run("make", "clean", cwd="doc/", check=True)
ctx.run("make", "html", "SHPINXOPTS=-W", cwd="doc/", check=True)
if archive is not None:
ctx.info(f"Compressing the generated documentation to '{archive}'...")
ctx.run("tar", "caf", str(archive.resolve()), ".", cwd="doc/_build/html")
@docs.command(
name="epub",
arguments={
"no_clean": {
"help": "Don't cleanup prior to building",
}
},
)
def epub(ctx: Context):
ctx.run("make", "clean", cwd="doc/", check=True)
def epub(ctx: Context, no_clean: bool = False):
if no_clean is False:
ctx.run("make", "clean", cwd="doc/", check=True)
ctx.run("make", "epub", "SHPINXOPTS=-W", cwd="doc/", check=True)
@docs.command(
name="pdf",
arguments={
"no_clean": {
"help": "Don't cleanup prior to building",
}
},
)
def pdf(ctx: Context):
def pdf(ctx: Context, no_clean: bool = False):
if not shutil.which("inkscape"):
ctx.warn("No inkscape binary found")
ctx.exit(1)
ctx.run("make", "clean", cwd="doc/", check=True)
if no_clean is False:
ctx.run("make", "clean", cwd="doc/", check=True)
ctx.run("make", "pdf", "SHPINXOPTS=-W", cwd="doc/", check=True)