From 5fbf3bf9a26f274348c7ce16316430e915c4a885 Mon Sep 17 00:00:00 2001 From: dannoe Date: Sun, 26 Apr 2020 22:55:57 +0200 Subject: [PATCH 1/2] Add unit test logger for github actions. --- .github/workflows/pr.yml | 47 +--------------------- KeeTrayTOTP.Tests/KeeTrayTOTP.Tests.csproj | 1 + 2 files changed, 2 insertions(+), 46 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 8239e24..eb04616 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -22,53 +22,8 @@ jobs: - name: nuget restore run: nuget restore KeeTrayTOTP.sln - - name: Install dotnet-sonarscanner - run: dotnet tool install --global dotnet-sonarscanner - - - name: SonarScanner Begin - run: dotnet sonarscanner begin /k:KeeTrayTOTP_KeeTrayTOTP /o:keetraytotp /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="coverage.opencover.xml" - - name: MSBuild run: msbuild KeeTrayTOTP.sln /m - name: Run tests - # It looks like the dotnet CLI can no longer build net45 projects? see https://github.com/microsoft/msbuild/issues/4704 - run: dotnet test --no-build --collect:"XPlat Code Coverage" --settings coverlet.runsettings - - - name: Copy coverage file to root for SonarQube. SonarQube currently does not support wildcards, and the coverage file ends up in a new folder with a random name. - run: cp -Path ("KeeTrayTOTP.Tests\TestResults\" + (gci -Path KeeTrayTOTP.Tests\TestResults -Recurse -Force -Name coverage.opencover.xml)) -Destination coverage.opencover.xml - - - name: SonarScanner End - run: dotnet sonarscanner end - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - - name: MSBuild (With Plgx) - run: msbuild KeeTrayTOTP.sln /p:Configuration=ReleasePlgx - - - name: Upload plgx - uses: actions/upload-artifact@v1 - with: - name: KeeTrayTOTP.plgx - path: KeeTrayTOTP\bin\ReleasePlgx\KeeTrayTOTP.plgx - - build-mono: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Install xvfb-run - run: sudo apt -y install xvfb - - - name: Download nuget.exe - run: wget https://dist.nuget.org/win-x86-commandline/latest/nuget.exe - - - name: nuget restore - run: mono nuget.exe restore - - - name: MSBuild - run: msbuild /target:build - - - name: Run tests - run: xvfb-run dotnet vstest KeeTrayTOTP.Tests/bin/Debug/KeeTrayTOTP.Tests.dll + run: dotnet test --no-build --collect:"XPlat Code Coverage" --settings coverlet.runsettings --logger GitHubActions diff --git a/KeeTrayTOTP.Tests/KeeTrayTOTP.Tests.csproj b/KeeTrayTOTP.Tests/KeeTrayTOTP.Tests.csproj index 4dee41b..ad933b1 100644 --- a/KeeTrayTOTP.Tests/KeeTrayTOTP.Tests.csproj +++ b/KeeTrayTOTP.Tests/KeeTrayTOTP.Tests.csproj @@ -20,6 +20,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive + From ee7e91c92baf337b821c23585d076815eeda6879 Mon Sep 17 00:00:00 2001 From: dannoe Date: Tue, 12 May 2020 19:25:32 +0200 Subject: [PATCH 2/2] Added failing code to test unit test logger --- KeeTrayTOTP/Menu/LegacyTrayMenuItemProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KeeTrayTOTP/Menu/LegacyTrayMenuItemProvider.cs b/KeeTrayTOTP/Menu/LegacyTrayMenuItemProvider.cs index 2c46956..c525913 100644 --- a/KeeTrayTOTP/Menu/LegacyTrayMenuItemProvider.cs +++ b/KeeTrayTOTP/Menu/LegacyTrayMenuItemProvider.cs @@ -46,7 +46,7 @@ private void SetUpLegacyContextMenuEntries() public override ToolStripMenuItem ProvideMenuItem() { - return null; + return new ToolStripMenuItem(); } private void OnTrayContextMenuOpened(object sender, EventArgs e)