Skip to content

Commit 7a6d65a

Browse files
committed
Fix SelectTests SDK bootstrap
1 parent 3d4299e commit 7a6d65a

3 files changed

Lines changed: 17 additions & 13 deletions

File tree

.github/actions/select-tests/action.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,22 +84,23 @@ runs:
8484
persist-credentials: false
8585

8686
# Minimal toolchain bootstrap -- not a full ./restore.sh. The repo SDK is .NET 11 while
87-
# SelectTests intentionally targets .NET 10 for its Microsoft.Build ProjectGraph dependency,
88-
# so install that one pinned runtime without restoring the rest of the repo toolsets.
87+
# SelectTests intentionally targets .NET 10 for its Microsoft.Build ProjectGraph dependency.
88+
# Install a .NET 10 SDK because MSBuildLocator needs its MSBuild assemblies; a runtime alone can
89+
# execute SelectTests but leaves RegisterDefaults with no MSBuild instance to discover.
8990
- name: Install toolchain (minimal)
9091
if: ${{ inputs.setupDotNet == 'true' }}
9192
shell: bash
9293
run: |
9394
set -euo pipefail
9495
./dotnet.sh --version
95-
runtime_version="$(sed -n 's:.*<DotNetRuntimeNet10VersionForTesting>\(.*\)</DotNetRuntimeNet10VersionForTesting>.*:\1:p' eng/Versions.props)"
96-
if [ -z "$runtime_version" ]; then
97-
echo "::error::Could not read DotNetRuntimeNet10VersionForTesting from eng/Versions.props." >&2
96+
sdk_version="$(sed -n 's:.*<DotNetSdkNet10VersionForTesting>\(.*\)</DotNetSdkNet10VersionForTesting>.*:\1:p' eng/Versions.props)"
97+
if [ -z "$sdk_version" ]; then
98+
echo "::error::Could not read DotNetSdkNet10VersionForTesting from eng/Versions.props." >&2
9899
exit 1
99100
fi
100101
./eng/common/dotnet-install.sh \
101-
-runtime dotnet \
102-
-version "$runtime_version"
102+
-runtime sdk \
103+
-version "$sdk_version"
103104
104105
- name: Select relevant tests
105106
id: select

eng/Versions.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<DotNetRuntimeNet10VersionForTesting>10.0.8</DotNetRuntimeNet10VersionForTesting>
1515
<DotNetSdkNet8VersionForTesting>8.0.415</DotNetSdkNet8VersionForTesting>
1616
<DotNetSdkNet9VersionForTesting>9.0.306</DotNetSdkNet9VersionForTesting>
17+
<DotNetSdkNet10VersionForTesting>10.0.400</DotNetSdkNet10VersionForTesting>
1718
<DotNetSdkNet11VersionForTesting>11.0.100-rc.1.26419.129</DotNetSdkNet11VersionForTesting>
1819
<!-- Keep these aliases for global.json and non-template test infrastructure. -->
1920
<DotNetRuntimePreviousVersionForTesting>$(DotNetRuntimeNet8VersionForTesting)</DotNetRuntimePreviousVersionForTesting>

tests/Infrastructure.Tests/TestTriggerMap/SelectTestsWorkflowTests.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,19 @@ public void SelectTestsActionGatesForceAllOnBooleanInputNotPrBody()
3333
}
3434

3535
// The repo SDK can move ahead of the target framework used by SelectTests. The minimal bootstrap
36-
// must install that runtime through Arcade's wrapper using the wrapper's single-dash switches;
37-
// unsupported raw dotnet-install switches make the setup job exit before test selection runs.
36+
// must install that SDK through Arcade's wrapper because MSBuildLocator needs the SDK's MSBuild
37+
// assemblies; installing only the runtime can execute SelectTests but cannot build its project graph.
3838
[Fact]
39-
public void SelectTestsActionInstallsPinnedRuntimeWithArcadeWrapperArguments()
39+
public void SelectTestsActionInstallsPinnedSdkWithArcadeWrapperArguments()
4040
{
4141
var action = File.ReadAllText(SelectTestsActionPath);
4242

43-
Assert.Contains("<DotNetRuntimeNet10VersionForTesting>", File.ReadAllText(VersionsPropsPath));
43+
Assert.Contains("<DotNetSdkNet10VersionForTesting>", File.ReadAllText(VersionsPropsPath));
44+
Assert.Contains("<DotNetSdkNet10VersionForTesting>", action);
4445
Assert.Contains("./eng/common/dotnet-install.sh", action);
45-
Assert.Contains("-runtime dotnet", action);
46-
Assert.Contains("-version \"$runtime_version\"", action);
46+
Assert.Contains("-runtime sdk", action);
47+
Assert.Contains("-version \"$sdk_version\"", action);
48+
Assert.DoesNotContain("-runtime dotnet", action);
4749
Assert.DoesNotContain("--install-dir", action);
4850
Assert.DoesNotContain("--skip-non-versioned-files", action);
4951
}

0 commit comments

Comments
 (0)