ci: wiki: support only running for changed devices

The device wiki check currently runs for *all* devices in any given
MR, and can sometimes fail (e.g. if someone edits the wiki for some
unrelated device.) It's not fair to block MRs for devices when the
check fails on unrelated devices. This changes the default behavior to
only run on devices that are changed in the branch. This also adds an
`--all` flag that restores the previous behavior, this could be run on
the pmaports master branch to test general compliance for all devices
without blocking MRs where the check fails for unrelated devices.

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7098>
This commit is contained in:
Clayton Craft
2025-09-29 12:46:33 -07:00
committed by The Friendly Merge Bot
parent fd7dd519c2
commit 95a1a60e4b
3 changed files with 24 additions and 3 deletions
+14 -2
View File
@@ -7,6 +7,8 @@ import argparse
import sys
import urllib.request
# Same dir
import common
def get_devices() -> list[str]:
""":returns: list of all devices"""
@@ -94,13 +96,23 @@ def main() -> int:
parser.add_argument("--path", help="instead of downloading the devices"
" page from the wiki, use a local HTML file",
type=Path, default=None)
parser.add_argument("--all", help="check all devices (default: check only"
" devices changed from branch point)",
action="store_true")
args = parser.parse_args()
# Check all devices
html = get_wiki_devices_html(args.path)
html["renamed"] = get_wiki_renamed_devices_html()
error = False
for device in get_devices():
devices = []
if args.all:
devices = get_devices()
else:
devices = common.get_changed_devices()
# remove 'device-' prefix
devices = [d[7:] for d in devices]
devices = [d.removesuffix("-downstream") for d in devices]
for device in devices:
if not check_device(device, html, args.booting):
error = True
+7
View File
@@ -184,3 +184,10 @@ def get_changed_kernels():
if pkgname.startswith("linux-"):
ret += [pkgname]
return ret
def get_changed_devices():
ret = []
for pkgname in get_changed_packages():
if pkgname.startswith("device-"):
ret += [pkgname]
return ret
+3 -1
View File
@@ -7,9 +7,11 @@
if [ "$(id -u)" = 0 ]; then
set -x
apk -q add \
git \
python3
exec su "${TESTUSER:-build}" -c "sh -e $0"
fi
set -x
.ci/lib/check_devices_in_wiki.py --booting
# shellcheck disable=SC2068
.ci/lib/check_devices_in_wiki.py --booting $@