[Python-checkins] Use CSV-separated outputs @ get-changed-files @ CI (#105151)
hugovk
webhook-mailer at python.org
Wed Jun 21 06:43:02 EDT 2023
https://github.com/python/cpython/commit/eaa670228066220f08c8d73f80365c50058d40b8
commit: eaa670228066220f08c8d73f80365c50058d40b8
branch: main
author: Sviatoslav Sydorenko <wk.cvs.github at sydorenko.org.ua>
committer: hugovk <hugovk at users.noreply.github.com>
date: 2023-06-21T13:42:59+03:00
summary:
Use CSV-separated outputs @ get-changed-files @ CI (#105151)
Co-authored-by: Hugo van Kemenade <hugovk at users.noreply.github.com>
files:
M .github/workflows/build.yml
M .github/workflows/reusable-docs.yml
M Doc/tools/touch-clean-files.py
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 4760c07a6d9cb..34fcce445d0cd 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -87,21 +87,9 @@ jobs:
with:
filter: |
Doc/**
- # Temporarily skip paths with spaces
- # (i.e. "C API", "Core and Builtins")
- # to avoid "Error: One of your files includes a space".
- # Pending https://github.com/python/core-workflow/issues/186
- # Misc/**
- Misc/NEWS.d/next/Build/**
- Misc/NEWS.d/next/Documentation/**
- Misc/NEWS.d/next/IDLE/**
- Misc/NEWS.d/next/Library/**
- Misc/NEWS.d/next/Security/**
- Misc/NEWS.d/next/Tests/**
- Misc/NEWS.d/next/Tools-Demos/**
- Misc/NEWS.d/next/Windows/**
- Misc/NEWS.d/next/macOS/**
+ Misc/**
.github/workflows/reusable-docs.yml
+ format: csv # works for paths with spaces
- name: Check for docs changes
if: >-
github.event_name == 'pull_request'
diff --git a/.github/workflows/reusable-docs.yml b/.github/workflows/reusable-docs.yml
index c5a15a10866e2..b39d8cea6421e 100644
--- a/.github/workflows/reusable-docs.yml
+++ b/.github/workflows/reusable-docs.yml
@@ -38,12 +38,14 @@ jobs:
uses: Ana06/get-changed-files at v2.2.0
with:
filter: "Doc/**"
+ format: csv # works for paths with spaces
- name: 'Build changed files in nit-picky mode'
if: github.event_name == 'pull_request'
continue-on-error: true
run: |
+ set -Eeuo pipefail
# Mark files the pull request modified
- touch ${{ steps.changed_files.outputs.added_modified }}
+ python Doc/tools/touch-clean-files.py --clean '${{ steps.changed_files.outputs.added_modified }}'
# Build docs with the '-n' (nit-picky) option; convert warnings to annotations
make -C Doc/ PYTHON=../python SPHINXOPTS="-q -n --keep-going" html 2>&1 |
python Doc/tools/warnings-to-gh-actions.py
diff --git a/Doc/tools/touch-clean-files.py b/Doc/tools/touch-clean-files.py
index 19bc1be31deb2..2b045bd68a0cf 100644
--- a/Doc/tools/touch-clean-files.py
+++ b/Doc/tools/touch-clean-files.py
@@ -3,7 +3,9 @@
Touch files that must pass Sphinx nit-picky mode
so they are rebuilt and we can catch regressions.
"""
-
+import argparse
+import csv
+import sys
from pathlib import Path
wrong_directory_msg = "Must run this script from the repo root"
@@ -28,14 +30,33 @@
rst for rst in Path("Doc/").rglob("*.rst") if rst.parts[1] not in EXCLUDE_SUBDIRS
}
-with Path("Doc/tools/.nitignore").open() as clean_files:
- DIRTY = {
+
+parser = argparse.ArgumentParser(
+ description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter
+)
+parser.add_argument("-c", "--clean", help="Comma-separated list of clean files")
+args = parser.parse_args()
+
+if args.clean:
+ clean_files = next(csv.reader([args.clean]))
+ CLEAN = {
Path(filename.strip())
for filename in clean_files
- if filename.strip() and not filename.startswith("#")
+ if Path(filename.strip()).is_file()
}
-
-CLEAN = ALL_RST - DIRTY - EXCLUDE_FILES
+elif args.clean is not None:
+ print(
+ "Not touching any files: an empty string `--clean` arg value passed.",
+ )
+ sys.exit(0)
+else:
+ with Path("Doc/tools/.nitignore").open() as ignored_files:
+ IGNORED = {
+ Path(filename.strip())
+ for filename in ignored_files
+ if filename.strip() and not filename.startswith("#")
+ }
+ CLEAN = ALL_RST - IGNORED - EXCLUDE_FILES
print("Touching:")
for filename in sorted(CLEAN):
More information about the Python-checkins
mailing list