Merge pull request #2350 from github/angelapwen/add-exclude-pr-check-… · github/codeql-action@8723b5b (original) (raw)
`@@ -27,6 +27,12 @@
`
27
27
`"nightly-latest"
`
28
28
`]
`
29
29
``
``
30
`+
def is_os_and_version_excluded(os, version, exclude_params):
`
``
31
`+
for exclude_param in exclude_params:
`
``
32
`+
if exclude_param[0] == os and exclude_param[1] == version:
`
``
33
`+
return True
`
``
34
`+
return False
`
``
35
+
30
36
`# When updating the ruamel.yaml version here, update the PR check in
`
31
37
`` # .github/workflows/pr-checks.yml
too.
``
32
38
`header = """# Warning: This file is generated automatically, and should not be modified.
`
`@@ -56,27 +62,32 @@ def writeHeader(checkStream):
`
56
62
`for file in (this_dir / 'checks').glob('*.yml'):
`
57
63
`with open(file, 'r') as checkStream:
`
58
64
`checkSpecification = yaml.load(checkStream)
`
59
``
-
60
65
`matrix = []
`
``
66
`+
excludedOsesAndVersions = checkSpecification.get('excludeOsAndVersionCombination', [])
`
61
67
`for version in checkSpecification.get('versions', defaultTestVersions):
`
62
``
`-
runnerImages = ["ubuntu-latest", "macos-latest", "windows-latest"]
`
63
``
`-
if checkSpecification.get('operatingSystems', None):
`
64
``
`-
runnerImages = [image for image in runnerImages for operatingSystem in checkSpecification['operatingSystems']
`
65
``
`-
if image.startswith(operatingSystem)]
`
66
``
-
67
``
`-
for runnerImage in runnerImages:
`
68
``
`-
Prior to CLI v2.15.1, ARM runners were not supported by the build tracer.
`
69
``
`-
"macos-latest" is now an ARM runner, so we run tests on the old CLIs on Intel runners instead.
`
70
``
`-
if version in ["stable-20230403", "stable-v2.13.4", "stable-v2.13.5", "stable-v2.14.6"] and runnerImage == "macos-latest":
`
71
``
`-
matrix.append({
`
72
``
`-
'os': "macos-12",
`
73
``
`-
'version': version
`
74
``
`-
})
`
75
``
`-
else:
`
76
``
`-
matrix.append({
`
77
``
`-
'os': runnerImage,
`
78
``
`-
'version': version
`
79
``
`-
})
`
``
68
`+
runnerImages = ["ubuntu-latest", "macos-latest", "windows-latest"]
`
``
69
`+
operatingSystems = checkSpecification.get('operatingSystems', ["ubuntu", "macos", "windows"])
`
``
70
+
``
71
`+
for operatingSystem in operatingSystems:
`
``
72
`+
runnerImagesForOs = [image for image in runnerImages if image.startswith(operatingSystem)]
`
``
73
+
``
74
`+
for runnerImage in runnerImagesForOs:
`
``
75
`+
Skip appending this combination to the matrix if it is explicitly excluded.
`
``
76
`+
if is_os_and_version_excluded(operatingSystem, version, excludedOsesAndVersions):
`
``
77
`+
continue
`
``
78
+
``
79
`+
Prior to CLI v2.15.1, ARM runners were not supported by the build tracer.
`
``
80
`+
"macos-latest" is now an ARM runner, so we run tests on the old CLIs on Intel runners instead.
`
``
81
`+
if version in ["stable-20230403", "stable-v2.13.4", "stable-v2.13.5", "stable-v2.14.6"] and runnerImage == "macos-latest":
`
``
82
`+
matrix.append({
`
``
83
`+
'os': "macos-12",
`
``
84
`+
'version': version
`
``
85
`+
})
`
``
86
`+
else:
`
``
87
`+
matrix.append({
`
``
88
`+
'os': runnerImage,
`
``
89
`+
'version': version
`
``
90
`+
})
`
80
91
``
81
92
`useAllPlatformBundle = "false" # Default to false
`
82
93
`if checkSpecification.get('useAllPlatformBundle'):
`