From b0fd9c2c42180d47d1d10a9ff71892e46d27c6ad Mon Sep 17 00:00:00 2001 From: kerenr-jfrog Date: Thu, 12 Sep 2024 11:11:37 +0300 Subject: [PATCH 01/12] added tests.yml file --- .github/workflows/tests.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..e69de29 From 75d4ea1237c8a0b408048b1009db17f68fb315c6 Mon Sep 17 00:00:00 2001 From: kerenr-jfrog Date: Thu, 12 Sep 2024 12:14:07 +0300 Subject: [PATCH 02/12] test --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e69de29..00bcb6e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -0,0 +1 @@ +# test \ No newline at end of file From e65932a30dc1e1d8e3edf0c97b52656bc6755725 Mon Sep 17 00:00:00 2001 From: kerenr-jfrog Date: Thu, 12 Sep 2024 12:21:55 +0300 Subject: [PATCH 03/12] Revert "test" This reverts commit 75d4ea1237c8a0b408048b1009db17f68fb315c6. --- .github/workflows/tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 00bcb6e..e69de29 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1 +0,0 @@ -# test \ No newline at end of file From fc1b700fe7cc0467f3cc6a4b2d3ecc72d439f7e9 Mon Sep 17 00:00:00 2001 From: kerenr-jfrog Date: Thu, 12 Sep 2024 13:28:10 +0300 Subject: [PATCH 04/12] added basic structure for tests workflow + unitest project --- .github/workflows/tests.yml | 31 +++++++++ JFrogVSExtension.sln | 10 +++ .../Properties/AssemblyInfo.cs | 20 ++++++ UnitTestJfrogVSExtension/UnitTest1.cs | 14 ++++ .../UnitTestJfrogVSExtension.csproj | 68 +++++++++++++++++++ UnitTestJfrogVSExtension/packages.config | 5 ++ 6 files changed, 148 insertions(+) create mode 100644 UnitTestJfrogVSExtension/Properties/AssemblyInfo.cs create mode 100644 UnitTestJfrogVSExtension/UnitTest1.cs create mode 100644 UnitTestJfrogVSExtension/UnitTestJfrogVSExtension.csproj create mode 100644 UnitTestJfrogVSExtension/packages.config diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e69de29..f341680 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -0,0 +1,31 @@ +name: Run Tests + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '4.7.2' + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --no-restore + + - name: Run tests + run: dotnet test --no-build --verbosity normal diff --git a/JFrogVSExtension.sln b/JFrogVSExtension.sln index 7f33148..1054059 100644 --- a/JFrogVSExtension.sln +++ b/JFrogVSExtension.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 17.1.32407.343 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JFrogVSExtension", "JFrogVSExtension\JFrogVSExtension.csproj", "{6443B797-2478-4A1D-BECA-28E24C1F1F41}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestJfrogVSExtension", "UnitTestJfrogVSExtension\UnitTestJfrogVSExtension.csproj", "{DB770B26-1629-45D0-8526-8902F83731B2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,6 +23,14 @@ Global {6443B797-2478-4A1D-BECA-28E24C1F1F41}.Release|Any CPU.Build.0 = Release|Any CPU {6443B797-2478-4A1D-BECA-28E24C1F1F41}.Release|x86.ActiveCfg = Release|x86 {6443B797-2478-4A1D-BECA-28E24C1F1F41}.Release|x86.Build.0 = Release|x86 + {DB770B26-1629-45D0-8526-8902F83731B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DB770B26-1629-45D0-8526-8902F83731B2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DB770B26-1629-45D0-8526-8902F83731B2}.Debug|x86.ActiveCfg = Debug|Any CPU + {DB770B26-1629-45D0-8526-8902F83731B2}.Debug|x86.Build.0 = Debug|Any CPU + {DB770B26-1629-45D0-8526-8902F83731B2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DB770B26-1629-45D0-8526-8902F83731B2}.Release|Any CPU.Build.0 = Release|Any CPU + {DB770B26-1629-45D0-8526-8902F83731B2}.Release|x86.ActiveCfg = Release|Any CPU + {DB770B26-1629-45D0-8526-8902F83731B2}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/UnitTestJfrogVSExtension/Properties/AssemblyInfo.cs b/UnitTestJfrogVSExtension/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..9082718 --- /dev/null +++ b/UnitTestJfrogVSExtension/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("UnitTestJfrogVSExtension")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("UnitTestJfrogVSExtension")] +[assembly: AssemblyCopyright("Copyright © 2024")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: ComVisible(false)] + +[assembly: Guid("db770b26-1629-45d0-8526-8902f83731b2")] + +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/UnitTestJfrogVSExtension/UnitTest1.cs b/UnitTestJfrogVSExtension/UnitTest1.cs new file mode 100644 index 0000000..e139341 --- /dev/null +++ b/UnitTestJfrogVSExtension/UnitTest1.cs @@ -0,0 +1,14 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; + +namespace UnitTestJfrogVSExtension +{ + [TestClass] + public class UnitTest1 + { + [TestMethod] + public void TestMethod1() + { + } + } +} diff --git a/UnitTestJfrogVSExtension/UnitTestJfrogVSExtension.csproj b/UnitTestJfrogVSExtension/UnitTestJfrogVSExtension.csproj new file mode 100644 index 0000000..d371106 --- /dev/null +++ b/UnitTestJfrogVSExtension/UnitTestJfrogVSExtension.csproj @@ -0,0 +1,68 @@ + + + + + + Debug + AnyCPU + {DB770B26-1629-45D0-8526-8902F83731B2} + Library + Properties + UnitTestJfrogVSExtension + UnitTestJfrogVSExtension + v4.7.2 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 15.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages + False + UnitTest + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\MSTest.TestFramework.2.2.10\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll + + + ..\packages\MSTest.TestFramework.2.2.10\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/UnitTestJfrogVSExtension/packages.config b/UnitTestJfrogVSExtension/packages.config new file mode 100644 index 0000000..36cbc3e --- /dev/null +++ b/UnitTestJfrogVSExtension/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file From 6f0af9681f014d4b3912113d4a7e0f3c127bf558 Mon Sep 17 00:00:00 2001 From: kerenr-jfrog Date: Thu, 12 Sep 2024 14:51:56 +0300 Subject: [PATCH 05/12] Update tests.yml --- .github/workflows/tests.yml | 33 +++++++++++++++++++-------- UnitTestJfrogVSExtension/UnitTest1.cs | 4 ++++ 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f341680..4281734 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,29 +3,42 @@ name: Run Tests on: push: branches: - - main + - add-tests-workflow pull_request: branches: - - main + - add-tests-workflow jobs: build: - runs-on: ubuntu-latest + runs-on: windows-latest steps: - name: Checkout code uses: actions/checkout@v3 - - name: Setup .NET + - name: Setup .NET SDK uses: actions/setup-dotnet@v3 with: - dotnet-version: '4.7.2' + dotnet-version: '6.0' + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v1 + with: + vs-version: 'latest' + - name: Restore dependencies - run: dotnet restore - - - name: Build - run: dotnet build --no-restore + run: | + dotnet restore + nuget restore + + - name: Download JFrog CLI executable + run: | + powershell -Command "Start-Process -Wait -Verb RunAs powershell '-NoProfile iwr https://releases.jfrog.io/artifactory/jfrog-cli/v2-jf/[RELEASE]/jfrog-cli-windows-amd64/jf.exe -OutFile ./JFrogVSExtension/Resources/jfrog.exe'" + - name: Build VSIX Project + run: | + msbuild ./JFrogVSExtension /p:Configuration=Release /p:Platform="AnyCPU" + - name: Run tests - run: dotnet test --no-build --verbosity normal + run: | + dotnet test --no-build --verbosity normal diff --git a/UnitTestJfrogVSExtension/UnitTest1.cs b/UnitTestJfrogVSExtension/UnitTest1.cs index e139341..bde9a6f 100644 --- a/UnitTestJfrogVSExtension/UnitTest1.cs +++ b/UnitTestJfrogVSExtension/UnitTest1.cs @@ -1,14 +1,18 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System; +using System.Diagnostics; namespace UnitTestJfrogVSExtension { [TestClass] public class UnitTest1 { + public TestContext TestContext { get; set; } + [TestMethod] public void TestMethod1() { + TestContext.WriteLine("Success!!!"); } } } From e333ef39b88e2b8552c5ef580506d09b453fae2b Mon Sep 17 00:00:00 2001 From: kerenr-jfrog Date: Thu, 12 Sep 2024 20:06:19 +0300 Subject: [PATCH 06/12] optimized workflow and added restrict workflow for labled PRs --- .github/workflows/tests.yml | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4281734..d647da1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,15 +2,15 @@ name: Run Tests on: push: - branches: - - add-tests-workflow pull_request: - branches: - - add-tests-workflow + type: [ labeled ] jobs: build: runs-on: windows-latest + + env: + JFROG_CLI_VERSION: '2.67.0' steps: - name: Checkout code @@ -25,6 +25,15 @@ jobs: uses: microsoft/setup-msbuild@v1 with: vs-version: 'latest' + + - name: Cache NuGet packages # optimizing the build process + uses: actions/cache@v3 + with: + path: | + ~/.nuget/packages + key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj') }} + restore-keys: | + nuget-${{ runner.os }}- - name: Restore dependencies run: | @@ -33,12 +42,12 @@ jobs: - name: Download JFrog CLI executable run: | - powershell -Command "Start-Process -Wait -Verb RunAs powershell '-NoProfile iwr https://releases.jfrog.io/artifactory/jfrog-cli/v2-jf/[RELEASE]/jfrog-cli-windows-amd64/jf.exe -OutFile ./JFrogVSExtension/Resources/jfrog.exe'" + powershell -Command "Start-Process -Wait -Verb RunAs powershell '-NoProfile iwr https://releases.jfrog.io/artifactory/jfrog-cli/v2-jf/${{ env.JFROG_CLI_VERSION }}/jfrog-cli-windows-amd64/jf.exe -OutFile ./JFrogVSExtension/Resources/jfrog.exe'" - name: Build VSIX Project - run: | - msbuild ./JFrogVSExtension /p:Configuration=Release /p:Platform="AnyCPU" + # build the vsix project using multi-core compilation and parallel builds + run: msbuild ./JFrogVSExtension/ /p:Configuration=Release /p:Platform="AnyCPU" /p:BuildInParallel=true /m + - name: Run tests - run: | - dotnet test --no-build --verbosity normal + run: dotnet test --no-build --verbosity normal \ No newline at end of file From a0a3b6d9ec7863f9afa834948ee7f4a9e4a9633e Mon Sep 17 00:00:00 2001 From: kerenr-jfrog Date: Sun, 15 Sep 2024 12:59:00 +0300 Subject: [PATCH 07/12] added PR template file --- .github/PULL_REQUEST_TEMPLATE.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..b07a7da --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,3 @@ +- [ ] All [tests](https://github.com/jfrog/jfrog-visual-studio-extension/actions/workflows/tests.yml) passed. If this feature is not already covered by the tests, I added new tests. +- [ ] Open pull request for dev branch. +----- \ No newline at end of file From 5cfe0890056af9fadb5a83a2de25619882f60b07 Mon Sep 17 00:00:00 2001 From: Keren Reshef Date: Sun, 15 Sep 2024 15:22:48 +0300 Subject: [PATCH 08/12] Update PULL_REQUEST_TEMPLATE.md --- .github/PULL_REQUEST_TEMPLATE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index b07a7da..da527f7 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,3 +1,3 @@ +- [ ] The pull request is targeting the `dev` branch. - [ ] All [tests](https://github.com/jfrog/jfrog-visual-studio-extension/actions/workflows/tests.yml) passed. If this feature is not already covered by the tests, I added new tests. -- [ ] Open pull request for dev branch. ------ \ No newline at end of file +----- From a78456ab0279b94a905e46329f19fe8b4efecc57 Mon Sep 17 00:00:00 2001 From: kerenr-jfrog Date: Mon, 16 Sep 2024 11:09:22 +0300 Subject: [PATCH 09/12] PR fixes --- .github/workflows/tests.yml | 11 ++++---- .../Properties/AssemblyInfo.cs | 20 -------------- .../UnitTestJfrogVSExtension.csproj | 26 +++++++------------ UnitTestJfrogVSExtension/packages.config | 5 ---- 4 files changed, 14 insertions(+), 48 deletions(-) delete mode 100644 UnitTestJfrogVSExtension/Properties/AssemblyInfo.cs delete mode 100644 UnitTestJfrogVSExtension/packages.config diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d647da1..402d4fb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -36,14 +36,13 @@ jobs: nuget-${{ runner.os }}- - name: Restore dependencies - run: | - dotnet restore - nuget restore + run: dotnet restore - name: Download JFrog CLI executable - run: | - powershell -Command "Start-Process -Wait -Verb RunAs powershell '-NoProfile iwr https://releases.jfrog.io/artifactory/jfrog-cli/v2-jf/${{ env.JFROG_CLI_VERSION }}/jfrog-cli-windows-amd64/jf.exe -OutFile ./JFrogVSExtension/Resources/jfrog.exe'" - + - uses: jfrog/setup-jfrog-cli@v4 + with: + version: ${{ env.JFROG_CLI_VERSION }} + - name: Build VSIX Project # build the vsix project using multi-core compilation and parallel builds run: msbuild ./JFrogVSExtension/ /p:Configuration=Release /p:Platform="AnyCPU" /p:BuildInParallel=true /m diff --git a/UnitTestJfrogVSExtension/Properties/AssemblyInfo.cs b/UnitTestJfrogVSExtension/Properties/AssemblyInfo.cs deleted file mode 100644 index 9082718..0000000 --- a/UnitTestJfrogVSExtension/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("UnitTestJfrogVSExtension")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("UnitTestJfrogVSExtension")] -[assembly: AssemblyCopyright("Copyright © 2024")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -[assembly: ComVisible(false)] - -[assembly: Guid("db770b26-1629-45d0-8526-8902f83731b2")] - -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/UnitTestJfrogVSExtension/UnitTestJfrogVSExtension.csproj b/UnitTestJfrogVSExtension/UnitTestJfrogVSExtension.csproj index d371106..fc59ba7 100644 --- a/UnitTestJfrogVSExtension/UnitTestJfrogVSExtension.csproj +++ b/UnitTestJfrogVSExtension/UnitTestJfrogVSExtension.csproj @@ -1,6 +1,5 @@  - Debug @@ -39,30 +38,23 @@ 4 - - ..\packages\MSTest.TestFramework.2.2.10\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll - - - ..\packages\MSTest.TestFramework.2.2.10\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll - - - + + + + + 2.2.10 + + + 2.2.10 + - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - \ No newline at end of file diff --git a/UnitTestJfrogVSExtension/packages.config b/UnitTestJfrogVSExtension/packages.config deleted file mode 100644 index 36cbc3e..0000000 --- a/UnitTestJfrogVSExtension/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file From b88724ef6ebc8478d164e9e350fa20769dd88f68 Mon Sep 17 00:00:00 2001 From: kerenr-jfrog Date: Mon, 16 Sep 2024 11:25:28 +0300 Subject: [PATCH 10/12] add script for downloading jfrog-cli --- .github/workflows/tests.yml | 19 ++++++++-------- .../Resources/DownloadJfrogCli.ps1 | 22 +++++++++++++++++++ 2 files changed, 31 insertions(+), 10 deletions(-) create mode 100644 JFrogVSExtension/Resources/DownloadJfrogCli.ps1 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 402d4fb..432474d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,9 +8,6 @@ on: jobs: build: runs-on: windows-latest - - env: - JFROG_CLI_VERSION: '2.67.0' steps: - name: Checkout code @@ -36,17 +33,19 @@ jobs: nuget-${{ runner.os }}- - name: Restore dependencies - run: dotnet restore + run: | + dotnet restore + nuget restore - name: Download JFrog CLI executable - - uses: jfrog/setup-jfrog-cli@v4 - with: - version: ${{ env.JFROG_CLI_VERSION }} + env: + JFROG_CLI_VERSION: ${{ env.JFROG_CLI_VERSION }} + run: | + .\JFrogVSExtension\Resources\DownloadJfrogCli.ps1 + shell: pwsh - - name: Build VSIX Project - # build the vsix project using multi-core compilation and parallel builds + - name: Build VSIX Project # build the vsix project using multi-core compilation and parallel builds run: msbuild ./JFrogVSExtension/ /p:Configuration=Release /p:Platform="AnyCPU" /p:BuildInParallel=true /m - - name: Run tests run: dotnet test --no-build --verbosity normal \ No newline at end of file diff --git a/JFrogVSExtension/Resources/DownloadJfrogCli.ps1 b/JFrogVSExtension/Resources/DownloadJfrogCli.ps1 new file mode 100644 index 0000000..3255f2e --- /dev/null +++ b/JFrogVSExtension/Resources/DownloadJfrogCli.ps1 @@ -0,0 +1,22 @@ +# Check if the JFROG_CLI_VERSION environment variable is set, if not using latest version +if (-not $env:JFROG_CLI_VERSION) { + Write-Output "Environment variable 'JFROG_CLI_VERSION' is not set. Using latest version as default." + $env:JFROG_CLI_VERSION = "[RELEASE]" +} + +# Define the URL for the JFrog CLI executable +$jfrogCliUrl = "https://releases.jfrog.io/artifactory/jfrog-cli/v2-jf/$($env:JFROG_CLI_VERSION)/jfrog-cli-windows-amd64/jf.exe" + +# Define the destination path for the downloaded file +$destinationPath = Join-Path (Get-Location).Path "JFrogVSExtension/Resources/jfrog.exe" + +# Download the JFrog CLI executable +Invoke-WebRequest -Uri $jfrogCliUrl -OutFile $destinationPath -Verbose + + +# Verify the file was downloaded successfully +if (Test-Path -Path $destinationPath) { + Write-Output "JFrog CLI v$env:JFROG_CLI_VERSION successfully downloaded to: $destinationPath" +} else { + Write-Output "Failed to download JFrog CLI to: $destinationPath" +} From cdd36a213101a16b136d635d07b3922e969d0ed3 Mon Sep 17 00:00:00 2001 From: kerenr-jfrog Date: Mon, 16 Sep 2024 15:23:07 +0300 Subject: [PATCH 11/12] using dotnet test to run the tests --- .github/workflows/tests.yml | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 432474d..a2782b4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,7 +3,7 @@ name: Run Tests on: push: pull_request: - type: [ labeled ] + type: [ labeled ] jobs: build: @@ -12,11 +12,6 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 - - - name: Setup .NET SDK - uses: actions/setup-dotnet@v3 - with: - dotnet-version: '6.0' - name: Setup MSBuild uses: microsoft/setup-msbuild@v1 @@ -26,26 +21,24 @@ jobs: - name: Cache NuGet packages # optimizing the build process uses: actions/cache@v3 with: - path: | - ~/.nuget/packages + path: ~/.nuget/packages key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj') }} - restore-keys: | - nuget-${{ runner.os }}- + restore-keys: nuget-${{ runner.os }}- - name: Restore dependencies run: | dotnet restore nuget restore - - name: Download JFrog CLI executable + - name: Download JFrog CLI executable env: - JFROG_CLI_VERSION: ${{ env.JFROG_CLI_VERSION }} - run: | - .\JFrogVSExtension\Resources\DownloadJfrogCli.ps1 + JFROG_CLI_VERSION: '2.67.0' # jfrog cli version can be changed here + run: .\JFrogVSExtension\Resources\DownloadJfrogCli.ps1 shell: pwsh - name: Build VSIX Project # build the vsix project using multi-core compilation and parallel builds - run: msbuild ./JFrogVSExtension/ /p:Configuration=Release /p:Platform="AnyCPU" /p:BuildInParallel=true /m + run: msbuild JFrogVSExtension.sln /p:Configuration=Release /p:Platform="Any CPU" /p:BuildInParallel=true /m + + - name: Run MSTest Project # run tests in release mode with logs presentation + run: dotnet test --no-build --configuration Release --logger "console;verbosity=detailed" ./UnitTestJfrogVSExtension/bin/Release/UnitTestJfrogVSExtension.dll - - name: Run tests - run: dotnet test --no-build --verbosity normal \ No newline at end of file From 7f1a2dc23ee5b259d3092e6f14cc042d502bb0be Mon Sep 17 00:00:00 2001 From: kerenr-jfrog Date: Wed, 18 Sep 2024 16:41:40 +0300 Subject: [PATCH 12/12] changes following PR comments --- .../Resources/DownloadJfrogCli.ps1 | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/JFrogVSExtension/Resources/DownloadJfrogCli.ps1 b/JFrogVSExtension/Resources/DownloadJfrogCli.ps1 index 3255f2e..376b652 100644 --- a/JFrogVSExtension/Resources/DownloadJfrogCli.ps1 +++ b/JFrogVSExtension/Resources/DownloadJfrogCli.ps1 @@ -1,7 +1,9 @@ # Check if the JFROG_CLI_VERSION environment variable is set, if not using latest version -if (-not $env:JFROG_CLI_VERSION) { - Write-Output "Environment variable 'JFROG_CLI_VERSION' is not set. Using latest version as default." - $env:JFROG_CLI_VERSION = "[RELEASE]" +if ($env:JFROG_CLI_VERSION) { + Write-Output "Downloading Jfrog CLI version: $env:JFROG_CLI_VERSION" +} else { + Write-Error "Error: JFROG_CLI_VERSION environment variable is not set." + exit 1 } # Define the URL for the JFrog CLI executable @@ -17,6 +19,15 @@ Invoke-WebRequest -Uri $jfrogCliUrl -OutFile $destinationPath -Verbose # Verify the file was downloaded successfully if (Test-Path -Path $destinationPath) { Write-Output "JFrog CLI v$env:JFROG_CLI_VERSION successfully downloaded to: $destinationPath" + $downloadedVersion = & $destinationPath --version + + if ($downloadedVersion -eq "jf version $env:JFROG_CLI_VERSION"){ + Write-Output "Successfully downloaded Jfrog CLI version $env:JFROG_CLI_VERSION." + } else { + Write-Error "Version does not match the environment variable. Expected: $env:JFROG_CLI_VERSION, Got: $downloadedVersion" + exit 1 + } + } else { - Write-Output "Failed to download JFrog CLI to: $destinationPath" + Write-Error "Failed to download JFrog CLI to: $destinationPath" }