File tree Expand file tree Collapse file tree 3 files changed +42
-5
lines changed
test-setup-dotnet-windows Expand file tree Collapse file tree 3 files changed +42
-5
lines changed Original file line number Diff line number Diff line change @@ -110,10 +110,28 @@ runs:
110110 max_attempts : 3
111111 retry_on : timeout
112112 command : |
113+ $dotnetCandidates = @()
113114 if ('${{inputs.os == 'macos-arm64' && inputs.architecture == 'x64' && inputs.runtime-type == 'dotnet'}}' -eq 'true') {
114- $dotnet = '/Users/runner/.dotnet/x64/dotnet'
115- } else {
116- $dotnet = '/Users/runner/.dotnet/dotnet'
115+ $dotnetCandidates += '/Users/runner/.dotnet/x64/dotnet'
116+ }
117+
118+ if ($env:DOTNET_ROOT) {
119+ $dotnetCandidates += (Join-Path $env:DOTNET_ROOT 'dotnet')
120+ }
121+
122+ $dotnetCandidates += '/Users/runner/.dotnet/dotnet'
123+ $dotnetCandidates += 'dotnet'
124+
125+ $dotnet = $null
126+ foreach ($candidate in $dotnetCandidates) {
127+ if ($candidate -eq 'dotnet' -or (Test-Path $candidate)) {
128+ $dotnet = $candidate
129+ break
130+ }
131+ }
132+
133+ if (-not $dotnet) {
134+ throw 'Unable to locate a dotnet executable.'
117135 }
118136 foreach ($target_framework in ConvertFrom-Json "${{steps.test-args.outputs.target_frameworks}}") {
119137 $trxFileName = "${{inputs.os}}-${{inputs.architecture}}-${{inputs.runtime-type}}-${{inputs.build_configuration}}-$target_framework.trx"
Original file line number Diff line number Diff line change @@ -15,6 +15,11 @@ inputs:
1515runs :
1616 using : " composite"
1717 steps :
18+ - name : Setup .NET SDK ${{inputs.architecture}}
19+ uses : actions/setup-dotnet@v4
20+ with :
21+ dotnet-version : ' 10.0.x'
22+
1823 - name : Get .NET Channel for ${{inputs.target_framework}}
1924 uses : ./.github/actions/get-dotnet-channel
2025 id : get_channel
@@ -33,16 +38,21 @@ runs:
3338 Invoke-WebRequest 'https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.ps1' -OutFile dotnet-install.ps1;
3439 .\dotnet-install.ps1 -Runtime dotnet -SkipNonVersionedFiles -NoPath -Channel LTS -Architecture ${{inputs.architecture}} -InstallDir "${{steps.get-program-files.outputs.path}}/dotnet";
3540 .\dotnet-install.ps1 -Runtime dotnet -SkipNonVersionedFiles -NoPath -Channel STS -Architecture ${{inputs.architecture}} -InstallDir "${{steps.get-program-files.outputs.path}}/dotnet";
36-
41+
3742 $channel = "${{steps.get_channel.outputs.channel}}";
3843 if ($channel -ne '') {
3944 .\dotnet-install.ps1 -Runtime dotnet -SkipNonVersionedFiles -NoPath -Channel $channel -Architecture ${{inputs.architecture}} -InstallDir "${{steps.get-program-files.outputs.path}}/dotnet";
4045 }
41-
46+
4247 $channels = "${{steps.get_channel.outputs.channels_multiline}}";
4348 if ($channels -ne '') {
4449 foreach ($channel in ($channels -split "[\r\n]+")) {
4550 .\dotnet-install.ps1 -Runtime dotnet -SkipNonVersionedFiles -NoPath -Channel $channel -Architecture ${{inputs.architecture}} -InstallDir "${{steps.get-program-files.outputs.path}}/dotnet";
4651 }
4752 }
53+
54+ $installRoot = (Resolve-Path (Join-Path "${{steps.get-program-files.outputs.path}}" 'dotnet')).Path;
55+ if ('${{ inputs.architecture == 'x86'}}' -eq 'true') {
56+ Add-Content -Path $env:GITHUB_ENV -Value "DOTNET_ROOT(x86)=$installRoot";
57+ }
4858 shell : pwsh
Original file line number Diff line number Diff line change @@ -72,10 +72,19 @@ jobs:
7272 sudo apt-get update
7373 sudo apt-get install -y mono-complete
7474
75+ - name : Install Mono on macOS
76+ if : runner.os == 'macOS'
77+ run : |
78+ brew update
79+ brew install mono || (brew link --overwrite --force mono && brew install mono)
80+ brew link --overwrite --force mono
81+ shell : bash
82+
7583 - name : Setup .NET SDK
7684 uses : actions/setup-dotnet@v4
7785 with :
7886 dotnet-version : ' 10.0.x'
87+ architecture : ${{inputs.architecture}}
7988 env :
8089 DOTNET_INSTALL_DIR : ${{ runner.temp }}/.dotnet
8190
You can’t perform that action at this time.
0 commit comments