CI: skip qemu matrix for documentation-only pull requests
Add a new "docs" CI type, selected when every file modified by a pull request matches a documentation pattern (man pages, .md, AUTHORS, COPYRIGHT, LICENSE, NOTICE, .gitignore). For this type the os_selection is empty and the qemu matrix runs no jobs. This affects only pull requests whose entire diff is documentation. Any change touching a non-documentation file continues to be classified as full, quick, linux, or freebsd by the existing file-path rules, and a manual ZFS-CI-Type commit tag still overrides that classification. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Christos Longros <chris.longros@gmail.com> Closes #18518
This commit is contained in:
@@ -6,6 +6,9 @@
|
||||
Output format: "<type> <source>" where source is "manual" (from
|
||||
ZFS-CI-Type commit tag) or "auto" (from file change heuristics).
|
||||
|
||||
Prints "docs auto" if every changed file is documentation; the qemu
|
||||
matrix is skipped in that case.
|
||||
|
||||
Prints "quick manual" if:
|
||||
- the *last* commit message contains 'ZFS-CI-Type: quick'
|
||||
or "quick auto" if (heuristics):
|
||||
@@ -28,6 +31,19 @@
|
||||
r'.*\.gitignore'
|
||||
]))
|
||||
|
||||
"""
|
||||
Patterns of files that are documentation only.
|
||||
"""
|
||||
DOCS_ONLY_REGEX = list(map(re.compile, [
|
||||
r'man/.*',
|
||||
r'.*\.md',
|
||||
r'AUTHORS',
|
||||
r'COPYRIGHT',
|
||||
r'LICENSE',
|
||||
r'NOTICE',
|
||||
r'\.gitignore',
|
||||
]))
|
||||
|
||||
"""
|
||||
Patterns of files that are considered to trigger full CI.
|
||||
"""
|
||||
@@ -116,6 +132,12 @@ def output_type(type, source, reason):
|
||||
f'changed file "{f}" matches pattern "{r.pattern}"'
|
||||
)
|
||||
|
||||
if changed_files and all(
|
||||
any(r.match(f) for r in DOCS_ONLY_REGEX)
|
||||
for f in changed_files):
|
||||
output_type('docs', 'auto',
|
||||
'all changed files are documentation')
|
||||
|
||||
# catch-all
|
||||
output_type('quick', 'auto',
|
||||
'no changed file matches full CI patterns')
|
||||
|
||||
@@ -45,6 +45,9 @@ jobs:
|
||||
fi
|
||||
|
||||
case "$ci_type" in
|
||||
docs)
|
||||
os_selection='[]'
|
||||
;;
|
||||
quick)
|
||||
os_selection='["almalinux8", "almalinux9", "almalinux10", "debian12", "fedora42", "freebsd15-1s", "ubuntu24"]'
|
||||
;;
|
||||
@@ -91,6 +94,7 @@ jobs:
|
||||
qemu-vm:
|
||||
name: qemu-x86
|
||||
needs: [ test-config ]
|
||||
if: needs.test-config.outputs.ci_type != 'docs'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
|
||||
Reference in New Issue
Block a user