Skip to content

Commit 495201e

Browse files
committed
PR check generator: add excludeOsAndVersionCombination
1 parent 3ce5d00 commit 495201e

9 files changed

+81
-38
lines changed

.github/workflows/__multi-language-autodetect.yml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/__scaling-reserved-ram.yml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/__swift-custom-build.yml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/__unset-environment.yml

+4-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pr-checks/checks/multi-language-autodetect.yml

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
name: "Multi-language repository"
22
description: "An end-to-end integration test of a multi-language repository using automatic language detection"
3-
# TODO: Add ubuntu back for `nightly-latest` and `latest` once CLI v2.17.4 is available.
4-
operatingSystems: ["macos"]
3+
operatingSystems: ["macos", "ubuntu"]
4+
excludeOsAndVersionCombination: [
5+
# Known failure for Swift on Linux before CLI v2.17.4.
6+
[ "ubuntu", "stable-20230403" ],
7+
[ "ubuntu", "stable-v2.13.5" ],
8+
[ "ubuntu", "stable-v2.14.6" ],
9+
[ "ubuntu", "stable-v2.15.5" ],
10+
[ "ubuntu", "stable-v2.16.6" ],
11+
]
512
steps:
613
- uses: actions/setup-go@v5
714
with:

pr-checks/checks/scaling-reserved-ram.yml

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
name: "Scaling reserved RAM"
22
description: "An end-to-end integration test of a multi-language repository with the scaling_reserved_ram feature flag enabled"
3-
# TODO: Add ubuntu back for `nightly-latest` and `latest` once CLI v2.17.4 is available.
4-
operatingSystems: ["macos"]
3+
operatingSystems: ["macos", "ubuntu"]
4+
excludeOsAndVersionCombination: [
5+
# Known failure for Swift on Linux before CLI v2.17.4.
6+
[ "ubuntu", "stable-20230403" ],
7+
[ "ubuntu", "stable-v2.13.5" ],
8+
[ "ubuntu", "stable-v2.14.6" ],
9+
[ "ubuntu", "stable-v2.15.5" ],
10+
[ "ubuntu", "stable-v2.16.6" ],
11+
]
512
env:
613
CODEQL_ACTION_SCALING_RESERVED_RAM: true
714
steps:

pr-checks/checks/swift-custom-build.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
name: "Swift analysis using a custom build command"
22
description: "Tests creation of a Swift database using custom build"
33
versions: ["linked", "default", "nightly-latest"]
4-
# TODO: Add ubuntu back for `nightly-latest` and `latest` once CLI v2.17.4 is available.
5-
operatingSystems: ["macos"]
4+
operatingSystems: ["macos", "ubuntu"]
65
env:
76
DOTNET_GENERATE_ASPNET_CERTIFICATE: "false"
87
steps:

pr-checks/checks/unset-environment.yml

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
name: "Test unsetting environment variables"
22
description: "An end-to-end integration test that unsets some environment variables"
3-
# TODO: Switch back to all versions once CLI v2.17.4 is available and running on ubuntu again.
4-
versions: ["stable-v2.14.6", "stable-v2.15.5", "stable-v2.16.6", "linked", "default", "nightly-latest"]
5-
operatingSystems: ["macos"] # TODO: Switch back to ubuntu for `nightly-latest` and `latest` once CLI v2.17.4 is available.
3+
operatingSystems: ["ubuntu"]
4+
excludeOsAndVersionCombination: [
5+
# Known failure for Swift on Linux before CLI v2.17.4.
6+
[ "ubuntu", "stable-20230403" ],
7+
[ "ubuntu", "stable-v2.13.5" ],
8+
[ "ubuntu", "stable-v2.14.6" ],
9+
[ "ubuntu", "stable-v2.15.5" ],
10+
[ "ubuntu", "stable-v2.16.6" ],
11+
]
12+
613
steps:
714
- uses: ./../action/init
815
id: init

pr-checks/sync.py

+30-19
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@
2727
"nightly-latest"
2828
]
2929

30+
def is_version_and_os_excluded(version, os, 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+
3036
# When updating the ruamel.yaml version here, update the PR check in
3137
# `.github/workflows/pr-checks.yml` too.
3238
header = """# Warning: This file is generated automatically, and should not be modified.
@@ -56,27 +62,32 @@ def writeHeader(checkStream):
5662
for file in (this_dir / 'checks').glob('*.yml'):
5763
with open(file, 'r') as checkStream:
5864
checkSpecification = yaml.load(checkStream)
59-
6065
matrix = []
66+
excludedVersionsAndOses = checkSpecification.get('excludeOsAndVersionCombination', [])
6167
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_version_and_os_excluded(version, operatingSystem, excludedVersionsAndOses):
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+
})
8091

8192
useAllPlatformBundle = "false" # Default to false
8293
if checkSpecification.get('useAllPlatformBundle'):

0 commit comments

Comments
 (0)