Add a script that runs your changes to recipes in CI This is required because changes to recipes cannot generally be tested in CI until after the recipe has been *submitted*. Change-Id: I4d3f2951e7116eb461c82126cbe5a8ae6a6a6964 Reviewed-on: https://gn-review.googlesource.com/c/gn/+/24821 Reviewed-by: Takuto Ikuta <tikuta@google.com>
diff --git a/tools/verify_recipe.py b/tools/verify_recipe.py new file mode 100755 index 0000000..eecde73 --- /dev/null +++ b/tools/verify_recipe.py
@@ -0,0 +1,63 @@ +#!/usr/bin/env python3 +# Copyright 2026 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import argparse +import os +import subprocess +import sys + +REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + +def main(): + os.chdir(REPO_ROOT) + + parser = argparse.ArgumentParser( + description='Trigger remote tryjobs with local recipe modifications.') + parser.add_argument( + 'cl', + help='Gerrit CL URL or number (e.g. 24801 or https://gn-review.googlesource.com/c/gn/+/24801)' + ) + parser.add_argument( + '--platform', + '-p', + choices=['linux', 'mac', 'win'], + action='append', + help='Platform(s) to run tryjobs for. If omitted, runs all platforms.') + + args = parser.parse_args() + + cl = args.cl + if cl.isdigit(): + cl = f'https://gn-review.googlesource.com/c/gn/+/{cl}' + + platforms = list(dict.fromkeys(args.platform)) if args.platform else ['linux', 'mac', 'win'] + + print(f'Triggering tryjobs for CL: {cl}...') + + for platform in platforms: + print(f'Triggering {platform} tryjob...') + p1 = subprocess.Popen(['led', 'get-builder', f'gn/try/{platform}'], + stdout=subprocess.PIPE) + p2 = subprocess.Popen(['led', 'edit-cr-cl', cl], + stdin=p1.stdout, + stdout=subprocess.PIPE) + p3 = subprocess.Popen(['led', 'edit-recipe-bundle'], + stdin=p2.stdout, + stdout=subprocess.PIPE) + p4 = subprocess.Popen(['led', 'launch'], stdin=p3.stdout) + + p1.stdout.close() + p2.stdout.close() + p3.stdout.close() + + for p in [p4, p3, p2, p1]: + p.wait() + if p.returncode != 0: + print(f'Failed to launch tryjob for {platform}', file=sys.stderr) + sys.exit(1) + + +if __name__ == '__main__': + main()