From 459c1c7e40c48ca2c10227f9cbf3667173266d97 Mon Sep 17 00:00:00 2001 From: Chris Hunt Date: Mon, 16 Sep 2019 20:52:46 -0400 Subject: [PATCH] Validate NEWS files with rstcheck. --- .github/workflows/python-linters.yml | 14 ++++++++++++++ noxfile.py | 13 +++++++++++++ pyproject.toml | 2 +- .../automation/news/template.rst | 0 4 files changed, 28 insertions(+), 1 deletion(-) rename news/_template.rst => tools/automation/news/template.rst (100%) diff --git a/.github/workflows/python-linters.yml b/.github/workflows/python-linters.yml index bf3308b02..0f237e90c 100644 --- a/.github/workflows/python-linters.yml +++ b/.github/workflows/python-linters.yml @@ -44,3 +44,17 @@ jobs: run: >- python -m tox env: ${{ matrix.env }} + + news_format: + name: Check NEWS format + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@master + - name: Set up Python + uses: actions/setup-python@v1 + with: + version: 3.7 + - name: Install nox + run: pip install nox + - name: Check NEWS format + run: nox -s validate_news diff --git a/noxfile.py b/noxfile.py index d6357b3dd..205c50e9f 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,6 +1,7 @@ """Release time helpers, executed using nox. """ +import glob import io import subprocess @@ -30,6 +31,18 @@ def get_author_list(): return sorted(authors, key=lambda x: x.lower()) +# ----------------------------------------------------------------------------- +# Ad-hoc commands +# ----------------------------------------------------------------------------- +@nox.session +def validate_news(session): + session.install("rstcheck") + + news_files = sorted(glob.glob("news/*")) + + session.run("rstcheck", *news_files) + + # ----------------------------------------------------------------------------- # Commands used during the release process # ----------------------------------------------------------------------------- diff --git a/pyproject.toml b/pyproject.toml index 919965c27..aa798360c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ filename = "NEWS.rst" directory = "news/" title_format = "{version} ({project_date})" issue_format = "`#{issue} `_" -template = "news/_template.rst" +template = "tools/automation/news/template.rst" type = [ { name = "Process", directory = "process", showcontent = true }, { name = "Deprecations and Removals", directory = "removal", showcontent = true }, diff --git a/news/_template.rst b/tools/automation/news/template.rst similarity index 100% rename from news/_template.rst rename to tools/automation/news/template.rst