Skip to content

Commit 8723b5b

Browse files
authored
Merge pull request #2350 from github/angelapwen/add-exclude-pr-check-param
PR check generator: add `excludeOsAndVersionCombination`
2 parents 3ce5d00 + 5d57660 commit 8723b5b

10 files changed

+86
-45
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.

.github/workflows/debug-artifacts.yml

+5-7
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,18 @@ jobs:
2222
fail-fast: false
2323
matrix:
2424
version:
25-
# TODO: Once CLI v2.17.4 is available and the platform is switched back to ubuntu,
26-
# stable-20230403, stable-v2.13.5, and stable-v2.14.6 can be added back to this matrix,
27-
# and the VERSIONS variable in the bash script below.
28-
# Prior to CLI v2.15.1, ARM runners were not supported by the build tracer.
25+
- stable-20230403
26+
- stable-v2.13.5
27+
- stable-v2.14.6
2928
- stable-v2.15.5
30-
- stable-v2.16.6
3129
- default
3230
- linked
3331
- nightly-latest
3432
name: Upload debug artifacts
3533
env:
3634
CODEQL_ACTION_TEST_MODE: true
3735
timeout-minutes: 45
38-
runs-on: macos-latest # TODO: Switch back to ubuntu for `nightly-latest` and `linked` once CLI v2.17.4 is available.
36+
runs-on: ubuntu-latest
3937
steps:
4038
- name: Check out repository
4139
uses: actions/checkout@v4
@@ -73,7 +71,7 @@ jobs:
7371
- name: Check expected artifacts exist
7472
shell: bash
7573
run: |
76-
VERSIONS="stable-v2.15.5 stable-v2.16.6 default linked nightly-latest"
74+
VERSIONS="stable-20230403 stable-v2.13.5 stable-v2.14.6 stable-v2.15.5 default linked nightly-latest"
7775
LANGUAGES="cpp csharp go java javascript python"
7876
for version in $VERSIONS; do
7977
pushd "./my-debug-artifacts-${version//./}"

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_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+
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+
excludedOsesAndVersions = 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_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+
})
8091

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

0 commit comments

Comments
 (0)