From d9d356b8a9cb24d7b5e855a9537f32faa1106a89 Mon Sep 17 00:00:00 2001 From: Zi Chen Date: Thu, 11 Jan 2024 13:00:14 -0800 Subject: [PATCH 01/15] Add pr-validation --- .github/workflows/pr-validation.yml | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/pr-validation.yml diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml new file mode 100644 index 0000000..ea06479 --- /dev/null +++ b/.github/workflows/pr-validation.yml @@ -0,0 +1,33 @@ +name: pr-validation + +on: pull_request + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest, ubuntu-latest, macos-latest] + 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 test -f netcoreapp3.1 + - run: dotnet test -f net5.0 + - run: dotnet test -f net6.0 + - run: dotnet test -f net7.0 + - run: dotnet test -f net8.0 \ No newline at end of file From 2b070057ae59cea0513ccb7425e3741a65a02e70 Mon Sep 17 00:00:00 2001 From: Zi Chen Date: Thu, 11 Jan 2024 13:03:31 -0800 Subject: [PATCH 02/15] Add DacFx.sln to tests --- .github/workflows/pr-validation.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index ea06479..ee81ac1 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -3,7 +3,7 @@ name: pr-validation on: pull_request jobs: - build: + test: runs-on: ${{ matrix.os }} strategy: matrix: @@ -26,8 +26,8 @@ jobs: with: dotnet-version: '8.x' - run: dotnet build DacFx.sln - - run: dotnet test -f netcoreapp3.1 - - run: dotnet test -f net5.0 - - run: dotnet test -f net6.0 - - run: dotnet test -f net7.0 - - run: dotnet test -f net8.0 \ No newline at end of file + - 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 From 9b7467893a185cccab5be60add99d80d7602b3d0 Mon Sep 17 00:00:00 2001 From: Zi Chen Date: Thu, 11 Jan 2024 13:14:19 -0800 Subject: [PATCH 03/15] Add dotnet pack command --- .github/workflows/pr-validation.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index ee81ac1..8088390 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -26,6 +26,7 @@ jobs: 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 From 837461060002cc1d54598d74e9440727783dc9ac Mon Sep 17 00:00:00 2001 From: Z Chen <13544267+zijchen@users.noreply.github.com> Date: Thu, 8 Feb 2024 19:55:15 -0800 Subject: [PATCH 04/15] Check for dotnet in DOTNET_INSTALL_DIR --- test/Microsoft.Build.Sql.Tests/TestUtils.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.Build.Sql.Tests/TestUtils.cs b/test/Microsoft.Build.Sql.Tests/TestUtils.cs index de2fcb7..679c6b2 100644 --- a/test/Microsoft.Build.Sql.Tests/TestUtils.cs +++ b/test/Microsoft.Build.Sql.Tests/TestUtils.cs @@ -10,6 +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"; /// /// Returns the full path to the dotnet executable based on the current operating system. @@ -18,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); + string? dotnetPath = Environment.GetEnvironmentVariable(DotnetToolPathEnvironmentVariable) ?? Environment.GetEnvironmentVariable(DotnetInstallDirEnvironmentVariable); if (string.IsNullOrEmpty(dotnetPath)) { // Determine OS specific dotnet installation path @@ -73,4 +74,4 @@ public static void CopyDirectoryRecursive(string sourceDirectoryPath, string tar } } } -} \ No newline at end of file +} From ecbb16028c67c3b51751b97c6ea916c35486bdfa Mon Sep 17 00:00:00 2001 From: Z Chen <13544267+zijchen@users.noreply.github.com> Date: Thu, 8 Feb 2024 19:58:42 -0800 Subject: [PATCH 05/15] Use /usr/share/dotnet --- test/Microsoft.Build.Sql.Tests/TestUtils.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.Build.Sql.Tests/TestUtils.cs b/test/Microsoft.Build.Sql.Tests/TestUtils.cs index 679c6b2..97e6021 100644 --- a/test/Microsoft.Build.Sql.Tests/TestUtils.cs +++ b/test/Microsoft.Build.Sql.Tests/TestUtils.cs @@ -29,7 +29,7 @@ public static string GetDotnetPath() } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { - dotnetPath = "/usr/bin/dotnet"; + dotnetPath = "/usr/share/dotnet"; } else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { 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 06/15] 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 From d67d7c1315031ba6139639910de6e010da11e2a5 Mon Sep 17 00:00:00 2001 From: "Zi Chen (from Dev Box)" Date: Fri, 9 Feb 2024 10:27:33 -0800 Subject: [PATCH 07/15] Fix matrix --- .github/workflows/pr-validation.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 4be6133..bab7442 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -9,6 +9,7 @@ jobs: fail-fast: false matrix: os: [windows-latest, ubuntu-latest, macos-latest] + dotnetVersion: ['3.1.x', '5.x', '6.x', '7.x', '8.x'] include: - dotnetVersion: '3.1.x' targetFramework: 'netcoreapp3.1' From 6a708c1b57fa31a41bcabf64d7dde7d415662546 Mon Sep 17 00:00:00 2001 From: "Zi Chen (from Dev Box)" Date: Fri, 9 Feb 2024 10:29:30 -0800 Subject: [PATCH 08/15] Add dotnet restore --- .github/workflows/pr-validation.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index bab7442..23c55e8 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -26,6 +26,7 @@ jobs: - uses: actions/setup-dotnet@v4 with: dotnet-version: ${{ matrix.dotnetVersion }} + - run: dotnet restore DacFx.sln - 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 From 1d966b8e59f897a312180badfeddfd3a5a9a0ebd Mon Sep 17 00:00:00 2001 From: "Zi Chen (from Dev Box)" Date: Fri, 9 Feb 2024 10:31:31 -0800 Subject: [PATCH 09/15] Add target framework to dotnet restore --- .github/workflows/pr-validation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 23c55e8..94be3fb 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -26,7 +26,7 @@ jobs: - uses: actions/setup-dotnet@v4 with: dotnet-version: ${{ matrix.dotnetVersion }} - - run: dotnet restore DacFx.sln + - run: dotnet restore DacFx.sln -f ${{ matrix.targetFramework }} - 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 From d624934e854286ea34bdf4264b175acf77784463 Mon Sep 17 00:00:00 2001 From: "Zi Chen (from Dev Box)" Date: Fri, 9 Feb 2024 10:32:58 -0800 Subject: [PATCH 10/15] Revert yml changes --- .github/workflows/pr-validation.yml | 37 ++++++++++++++++------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 94be3fb..ba25042 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -9,24 +9,27 @@ jobs: fail-fast: false matrix: os: [windows-latest, ubuntu-latest, macos-latest] - dotnetVersion: ['3.1.x', '5.x', '6.x', '7.x', '8.x'] - 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: ${{ matrix.dotnetVersion }} - - run: dotnet restore DacFx.sln -f ${{ matrix.targetFramework }} - - 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 + 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 From 9cf52a395c7d38ce5977c0b3cc285a8587f571d0 Mon Sep 17 00:00:00 2001 From: "Zi Chen (from Dev Box)" Date: Fri, 9 Feb 2024 10:52:16 -0800 Subject: [PATCH 11/15] Try matrix again --- .github/workflows/pr-validation.yml | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index ba25042..436e275 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -6,30 +6,14 @@ jobs: test: runs-on: ${{ matrix.os }} strategy: - fail-fast: false matrix: os: [windows-latest, ubuntu-latest, macos-latest] + dotnetVersion: [3.1.x, 5.x, 6.x, 7.x, 8.x] 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' + dotnet-version: ${{ matrix.dotnetVersion }} - 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 + - run: dotnet test DacFx.sln \ No newline at end of file From 3204d463420b7a9b8dad2a6f86b1231d29cd38d6 Mon Sep 17 00:00:00 2001 From: "Zi Chen (from Dev Box)" Date: Fri, 9 Feb 2024 10:55:47 -0800 Subject: [PATCH 12/15] Change fail fast to false --- .github/workflows/pr-validation.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 436e275..6627304 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -6,6 +6,7 @@ jobs: test: runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: [windows-latest, ubuntu-latest, macos-latest] dotnetVersion: [3.1.x, 5.x, 6.x, 7.x, 8.x] From 05f54dd8ee776496ec2343843f45807b2d2125ea Mon Sep 17 00:00:00 2001 From: "Zi Chen (from Dev Box)" Date: Fri, 9 Feb 2024 11:02:49 -0800 Subject: [PATCH 13/15] Add target framework --- .github/workflows/pr-validation.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 6627304..e15d8b4 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -10,11 +10,22 @@ jobs: matrix: os: [windows-latest, ubuntu-latest, macos-latest] dotnetVersion: [3.1.x, 5.x, 6.x, 7.x, 8.x] + 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: ${{ matrix.dotnetVersion }} - run: dotnet build DacFx.sln - - run: dotnet pack DacFx.sln - - run: dotnet test DacFx.sln \ No newline at end of file + - run: dotnet pack DacFx.sln --no-build + - run: dotnet test DacFx.sln --no-build -f ${{ matrix.targetFramework }} \ No newline at end of file From bec6743b068f73a5b157442862d39d3bc14dcc65 Mon Sep 17 00:00:00 2001 From: "Zi Chen (from Dev Box)" Date: Fri, 9 Feb 2024 14:28:46 -0800 Subject: [PATCH 14/15] Fix build warnings --- .../Microsoft.Build.Sql.Templates.csproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Microsoft.Build.Sql.Templates/Microsoft.Build.Sql.Templates.csproj b/src/Microsoft.Build.Sql.Templates/Microsoft.Build.Sql.Templates.csproj index 21b03ee..4cfe6b7 100644 --- a/src/Microsoft.Build.Sql.Templates/Microsoft.Build.Sql.Templates.csproj +++ b/src/Microsoft.Build.Sql.Templates/Microsoft.Build.Sql.Templates.csproj @@ -13,6 +13,7 @@ $(BaseIntermediateOutputPath)\$(Configuration)\$(MSBuildThisFileName)\sqlproject $(NoWarn);NU5128 + true @@ -39,6 +40,7 @@ MatchExpression="###ASSEMBLY_VERSION###" ReplacementText="$(PackageVersion)" /> + From b90fecff73e9d25605d2b73339020aec5baea96b Mon Sep 17 00:00:00 2001 From: "Zi Chen (from Dev Box)" Date: Fri, 9 Feb 2024 14:47:04 -0800 Subject: [PATCH 15/15] Fix indent --- .../Microsoft.Build.Sql.Templates.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.Build.Sql.Templates/Microsoft.Build.Sql.Templates.csproj b/src/Microsoft.Build.Sql.Templates/Microsoft.Build.Sql.Templates.csproj index 4cfe6b7..930c952 100644 --- a/src/Microsoft.Build.Sql.Templates/Microsoft.Build.Sql.Templates.csproj +++ b/src/Microsoft.Build.Sql.Templates/Microsoft.Build.Sql.Templates.csproj @@ -40,7 +40,7 @@ MatchExpression="###ASSEMBLY_VERSION###" ReplacementText="$(PackageVersion)" /> - +