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
|
Output format: "<type> <source>" where source is "manual" (from
|
||||||
ZFS-CI-Type commit tag) or "auto" (from file change heuristics).
|
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:
|
Prints "quick manual" if:
|
||||||
- the *last* commit message contains 'ZFS-CI-Type: quick'
|
- the *last* commit message contains 'ZFS-CI-Type: quick'
|
||||||
or "quick auto" if (heuristics):
|
or "quick auto" if (heuristics):
|
||||||
@@ -28,6 +31,19 @@
|
|||||||
r'.*\.gitignore'
|
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.
|
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}"'
|
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
|
# catch-all
|
||||||
output_type('quick', 'auto',
|
output_type('quick', 'auto',
|
||||||
'no changed file matches full CI patterns')
|
'no changed file matches full CI patterns')
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
case "$ci_type" in
|
case "$ci_type" in
|
||||||
|
docs)
|
||||||
|
os_selection='[]'
|
||||||
|
;;
|
||||||
quick)
|
quick)
|
||||||
os_selection='["almalinux8", "almalinux9", "almalinux10", "debian12", "fedora42", "freebsd15-1s", "ubuntu24"]'
|
os_selection='["almalinux8", "almalinux9", "almalinux10", "debian12", "fedora42", "freebsd15-1s", "ubuntu24"]'
|
||||||
;;
|
;;
|
||||||
@@ -91,6 +94,7 @@ jobs:
|
|||||||
qemu-vm:
|
qemu-vm:
|
||||||
name: qemu-x86
|
name: qemu-x86
|
||||||
needs: [ test-config ]
|
needs: [ test-config ]
|
||||||
|
if: needs.test-config.outputs.ci_type != 'docs'
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
|
|||||||
Reference in New Issue
Block a user