From e1d14b245ab5fad0044d08c3b9343908323e2407 Mon Sep 17 00:00:00 2001 From: "Zi Chen (from Dev Box)" Date: Fri, 9 Feb 2024 10:25:58 -0800 Subject: [PATCH] Change dotnet variable and fail fast --- .github/workflows/pr-validation.yml | 36 +++++++++------------ test/Microsoft.Build.Sql.Tests/TestUtils.cs | 4 +-- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 8088390..4be6133 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -6,29 +6,25 @@ jobs: test: runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: [windows-latest, ubuntu-latest, macos-latest] + include: + - dotnetVersion: '3.1.x' + targetFramework: 'netcoreapp3.1' + - dotnetVersion: '5.x' + targetFramework: 'net5.0' + - dotnetVersion: '6.x' + targetFramework: 'net6.0' + - dotnetVersion: '7.x' + targetFramework: 'net7.0' + - dotnetVersion: '8.x' + targetFramework: 'net8.0' steps: - uses: actions/checkout@v4 - uses: actions/setup-dotnet@v4 with: - dotnet-version: '3.1.x' - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '5.x' - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '6.x' - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '7.x' - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '8.x' - - run: dotnet build DacFx.sln - - run: dotnet pack DacFx.sln - - run: dotnet test DacFx.sln -f netcoreapp3.1 - - run: dotnet test DacFx.sln -f net5.0 - - run: dotnet test DacFx.sln -f net6.0 - - run: dotnet test DacFx.sln -f net7.0 - - run: dotnet test DacFx.sln -f net8.0 \ No newline at end of file + dotnet-version: ${{ matrix.dotnetVersion }} + - run: dotnet build DacFx.sln -f ${{ matrix.targetFramework }} + - run: dotnet pack DacFx.sln -f ${{ matrix.targetFramework }} + - run: dotnet test DacFx.sln -f ${{ matrix.targetFramework }} \ No newline at end of file diff --git a/test/Microsoft.Build.Sql.Tests/TestUtils.cs b/test/Microsoft.Build.Sql.Tests/TestUtils.cs index 97e6021..ee858c7 100644 --- a/test/Microsoft.Build.Sql.Tests/TestUtils.cs +++ b/test/Microsoft.Build.Sql.Tests/TestUtils.cs @@ -10,7 +10,7 @@ namespace Microsoft.Build.Sql.Tests public static class TestUtils { private const string DotnetToolPathEnvironmentVariable = "DOTNET_TOOL_PATH"; - private const string DotnetInstallDirEnvironmentVariable = "DOTNET_INSTALL_DIR"; + private const string DotnetRootEnvironmentVariable = "DOTNET_ROOT"; /// /// Returns the full path to the dotnet executable based on the current operating system. @@ -19,7 +19,7 @@ public static class TestUtils public static string GetDotnetPath() { string dotnetExecutable = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "dotnet.exe" : "dotnet"; - string? dotnetPath = Environment.GetEnvironmentVariable(DotnetToolPathEnvironmentVariable) ?? Environment.GetEnvironmentVariable(DotnetInstallDirEnvironmentVariable); + string? dotnetPath = Environment.GetEnvironmentVariable(DotnetToolPathEnvironmentVariable) ?? Environment.GetEnvironmentVariable(DotnetRootEnvironmentVariable); if (string.IsNullOrEmpty(dotnetPath)) { // Determine OS specific dotnet installation path