Repository navigation
refactor(util): share one stdlib-only Actions helper across the CI scripts (#2047) - #2050
Conversation
|
GOOD TO GO at
Being tightened before ready: the new test's 3.7 check lets |
…ripts (#2047) - util/_actions.py: annotation()/annotate() with GitHub's escaping (and escape=False for callers that keep their own), group(), set_output() (multiline for a \n or \r), summary()/open_summary(), emit()/say(), exit_status() and run(), the tee of a command to stdout and a log. Standard library only, 3.7 syntax. - apt_packages, classify_changes, coverage_report, leg_summary, pip_install, regenerate_samples, vendor_code_changed: use it for outputs, summaries, byte writes, exit statuses and the logged run; output is unchanged. Annotations that #1672's scan of KTLO steps reads stay literal. - tests/project/test_actions_helper_2047.py pins the helper's output and imports to 3.7, and runs each script as the steps do; workflows.rst lists the helper.
17c9c86 to
967d907
Compare
|
Pushed
Each check fails on a planted violation; I re-planted |
|
GOOD TO GO at
No |
|
should we separate action helper scripts from other project maintenance scripts in the |
|
Almost everything in
So the line between the groups would be fuzzy, and a move costs churn everywhere: every Needs you:
This PR is ready to merge either way. |
|
take (a) |
|
Recorded: (a). |
|
Coverage: 91.54% (unit tier, Python 3.15,
Per-file detail: the |
|
Ordering check on |
The scripts table gains a "By hand" column, and a second table lists the scripts a person runs, with the command: bump_version, changelog_md, run_unittest_leg, conda_vendor --check, ci_timing and pyshark_encap_map. Every other util/ script is CI-only, as ruled on #2050 (keep util/ flat).
…R roles (#1103) - Cite issues and pull requests by :issue:/:pr: in rendered text: the hand-written GitHub links in workflows.rst, releasing.rst and pep.rst, the bare #NNN in workflows.rst, and the #NNN in pcapkit docstrings and #: comments. #2050, linked as an issue, is a pull request. - Add tests/project/test_docs_issue_pr_roles_1103_unit.py, which fails on a hand-written link or bare #NNN in .rst pages, docstrings and #: comments; its allowlist holds only the references other tests pin. - Record the rule on the documentation conventions page. - Name the external action functions releasing.rst and workflows.rst cited by line, where no test pins the line. - Fix stale claims: the shared changelog pull request has merged, the Windows leg runs leg_summary.py and pip_install.py, Lint expects pylint's import-error rather than tracking a count, pypcapfile fails from 3.12 up rather than working only on 3.10 and 3.11, cryptography in the all extra is no pure-Python wheel; drop "today", "this change" and "current". Docs build: no warnings, and the same 116 under -n as origin/main.
make pylint,make mypy,make isort)make testpasses, and a test case covers the changeWhat is the purpose of your pull request?
refactor— restructures code without changing behaviourDescription of your pull request and other information
The first PR for #2047 (owner's ruling: option (a)).
util/_actions.py: standard library only and 3.7-syntax. It providesannotation/annotate,group,set_output(with the heredoc form for multiline values),summary/open_summary,say/emit,exit_statusandrun. The tee-to-log thatpip_installandregenerate_samplesboth copied becomesrun. Escaping follows GitHub's workflow-commands reference.apt_packages,classify_changes,coverage_report,leg_summary,pip_install,regenerate_samplesandvendor_code_changed. Each keeps its exact output, withescape=Falsewhere a script escapes its own way. On/usr/bin/python3.7,main's and this branch's copies gave byte-identical stdout, stderr, exit code, outputs file and summary file on 10 cases.apt_packages,leg_summaryandcoverage_reportstay literal (marked#2047). ci: a failed KTLO leg turns main and pull requests red; report it as a warning and exit 0 #1672's KTLO guard (commands()intest_ktlo_legs_stay_green_1672.py) reads literalprint('::leveltext, and routing them through the helper would blind it. Teaching the guard to see_actions.annotatecomes next.verdict_covers_checkout.py,superseded.pyandproject_status.pyare left out: each runs from a single-file checkout or download.tests/project/test_actions_helper_2047.pychecks the stdlib-only and 3.7-parse rules, the exact output and escaping, and that every migrated script loads both asutil.xand from its file path. It errors without the helper and passes here (21 passed). Every existing test of the migrated scripts passes unchanged, and none was edited.