Skip to content

Commit a098492

Browse files
committed
ci: add more utils functions
1 parent 673fbca commit a098492

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

ci_common/utils.libsonnet

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,27 @@
1717
// utility for array contains
1818
contains(array, value)::
1919
std.count(array, value) > 0,
20+
21+
// validation
22+
isGraalVmVm(name)::
23+
std.startsWith(name, "graalvm_"),
24+
25+
isGraalPythonVm(name)::
26+
std.startsWith(name, "graalpython"),
27+
28+
isBaselineVm(name)::
29+
std.startsWith(name, "cpython") || std.startsWith(name, "pypy"),
30+
31+
local isBuilder = function(builder)
32+
std.objectHas(builder, "run"),
33+
isBuilder:: isBuilder,
34+
35+
// make a builder run with a given primary suite
36+
withPrimarySuite(suite, builder)::
37+
if (std.isArray(builder)) then [
38+
b + (if isBuilder(b) then {environment +: {'MX_PRIMARY_SUITE_PATH': suite}} else {})
39+
for b in builder
40+
]
41+
else
42+
builder + (if (isBuilder(builder)) then {environment +: {'MX_PRIMARY_SUITE_PATH': suite}} else {}),
2043
}

mx.graalpython/mx_graalpython.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -908,16 +908,18 @@ def import_python_sources(args):
908908
# add ci verification util
909909
#
910910
# ----------------------------------------------------------------------------------------------------------------------
911-
def verify_ci(dest_suite, args=None):
911+
def verify_ci(dest_suite, common_dirs=None, args=None):
912912
"""Verify CI configuration"""
913+
if common_dirs is None:
914+
common_dirs = ['ci_common']
913915
base_suite = SUITE
914916
if not isinstance(dest_suite, mx.SourceSuite) or not isinstance(base_suite, mx.SourceSuite):
915917
raise mx.abort("Can not use verify-ci on binary suites: {} and {} need to be source suites".format(
916918
SUITE.name, dest_suite.name))
917919
assert isinstance(base_suite, mx.SourceSuite)
918920
for ext in [".libsonnet", ".jsonnet"]:
919921
mx.log("CI setup verifying *{} files ... ".format(ext))
920-
mx.verify_ci(args, base_suite, dest_suite, common_dirs=['ci_common'], extension=ext)
922+
mx.verify_ci(args, base_suite, dest_suite, common_dirs=common_dirs, extension=ext)
921923

922924

923925
# ----------------------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)