From 4b1a6a439b0b9930c169d4c2c12d24e8131ec950 Mon Sep 17 00:00:00 2001 From: Hazel Megan Date: Thu, 7 Apr 2022 16:53:57 +0100 Subject: [PATCH 01/14] Run tests as part of CI --- .github/workflows/build.yml | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fc32e7e26..7c1aa22d6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,14 +3,14 @@ name: CI -# Controls when the action will run. +# Controls when the action will run. on: # Triggers the workflow on push or pull request events but only for the main branch push: branches: [ main ] pull_request: branches: [ main ] - + # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -51,24 +51,38 @@ jobs: - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v1.0.3 - + - name: MSBuild # working-directory: ./ run: msbuild.exe Toolkit.Labs.All.sln /restore -p:Configuration=Release - + # Build All Packages - TODO: Detect experiments - name: pack CanvasLayout working-directory: ./Labs/CanvasLayout/Src run: msbuild -t:pack /p:Configuration=Release /p:DebugType=Portable - # Push Packages to our DevOps Artifacts Feed + # Push Packages to our DevOps Artifacts Feed - name: Add source run: dotnet nuget add source "https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-Labs/nuget/v3/index.json" --name LabsFeed --username dummy --password ${{ secrets.DEVOPS_PACKAGE_PUSH_TOKEN }} - + - name: Push packages if: ${{github.ref == 'refs/heads/main'}} run: dotnet nuget push "**/*.nupkg" --api-key dummy --source LabsFeed --skip-duplicate + - name: Run tests on SourceGenerators + uses: microsoft-approved-actions/vstest@master + with: + testAssembly: CommunityToolkit.Labs.Core.SourceGenerators.Tests.dll + searchFolder: ./Common/**/ + runInParallel: true + + - name: Run tests on experiments + uses: microsoft-approved-actions/vstest@master + with: + testAssembly: CommunityToolkit.Labs.UnitTests*.dll + searchFolder: ./Tests/**/ + runInParallel: true + # Test/temp job to build a single experiment to ensure our changes work for both our main types of solutions at the moment experiment: runs-on: windows-latest @@ -85,7 +99,7 @@ jobs: - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v1.0.3 - + - name: MSBuild working-directory: ./Labs/CanvasLayout run: msbuild.exe CanvasLayout.sln /restore -p:Configuration=Release From cba589d4afb8896f78850dc6cfff43bc02859924 Mon Sep 17 00:00:00 2001 From: Hazel Megan Date: Thu, 7 Apr 2022 16:59:47 +0100 Subject: [PATCH 02/14] update action org --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7c1aa22d6..97204a1a9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -70,14 +70,14 @@ jobs: run: dotnet nuget push "**/*.nupkg" --api-key dummy --source LabsFeed --skip-duplicate - name: Run tests on SourceGenerators - uses: microsoft-approved-actions/vstest@master + uses: microsoft/vstest@master with: testAssembly: CommunityToolkit.Labs.Core.SourceGenerators.Tests.dll searchFolder: ./Common/**/ runInParallel: true - name: Run tests on experiments - uses: microsoft-approved-actions/vstest@master + uses: microsoft/vstest@master with: testAssembly: CommunityToolkit.Labs.UnitTests*.dll searchFolder: ./Tests/**/ From aeded857da1e54040b24c5b0e23da2faf92d715e Mon Sep 17 00:00:00 2001 From: Hazel Megan Date: Thu, 7 Apr 2022 17:06:51 +0100 Subject: [PATCH 03/14] try main version --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 97204a1a9..ae63d9b92 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -70,14 +70,14 @@ jobs: run: dotnet nuget push "**/*.nupkg" --api-key dummy --source LabsFeed --skip-duplicate - name: Run tests on SourceGenerators - uses: microsoft/vstest@master + uses: microsoft/vstest@main with: testAssembly: CommunityToolkit.Labs.Core.SourceGenerators.Tests.dll searchFolder: ./Common/**/ runInParallel: true - name: Run tests on experiments - uses: microsoft/vstest@master + uses: microsoft/vstest@main with: testAssembly: CommunityToolkit.Labs.UnitTests*.dll searchFolder: ./Tests/**/ From 38e44c1a8aba07720388c6207cac2c0343d5f829 Mon Sep 17 00:00:00 2001 From: Hazel Megan Date: Thu, 7 Apr 2022 20:10:56 +0100 Subject: [PATCH 04/14] Run tests by calling vstest.console.exe directly --- .github/workflows/build.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ae63d9b92..35a6b152e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -69,19 +69,19 @@ jobs: if: ${{github.ref == 'refs/heads/main'}} run: dotnet nuget push "**/*.nupkg" --api-key dummy --source LabsFeed --skip-duplicate + + # Run tests + - name: Setup VSTest Path + uses: darenm/Setup-VSTest@v1 + - name: Run tests on SourceGenerators - uses: microsoft/vstest@main - with: - testAssembly: CommunityToolkit.Labs.Core.SourceGenerators.Tests.dll - searchFolder: ./Common/**/ - runInParallel: true + run: vstest.console.exe ./Common/CommunityToolkit.Labs.Core.SourceGenerators.Tests/CommunityToolkit.Labs.Core.SourceGenerators.Tests/bin/Release/net6.0/CommunityToolkit.Labs.Core.SourceGenerators.Tests.dll - - name: Run tests on experiments - uses: microsoft/vstest@main - with: - testAssembly: CommunityToolkit.Labs.UnitTests*.dll - searchFolder: ./Tests/**/ - runInParallel: true + - name: Run tests on experiments against UWP + run: vstest.console.exe ./Tests/**/CommunityToolkit.Labs.UnitTests.UWP.build.appxrecipe /Framework:FrameworkUap10 + + - name: Run tests on experiments against WinAppSDK + run: vstest.console.exe ./Tests/**/CommunityToolkit.Labs.UnitTests.WinAppSdk.build.appxrecipe /Framework:FrameworkUap10 # Test/temp job to build a single experiment to ensure our changes work for both our main types of solutions at the moment experiment: From 40631c914bec0bbbe57d24dfab45add7f5e8a9c4 Mon Sep 17 00:00:00 2001 From: Hazel Megan Date: Thu, 7 Apr 2022 22:00:02 +0100 Subject: [PATCH 05/14] improve step names --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 35a6b152e..8a875131e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -74,13 +74,13 @@ jobs: - name: Setup VSTest Path uses: darenm/Setup-VSTest@v1 - - name: Run tests on SourceGenerators + - name: Run SourceGenerators tests run: vstest.console.exe ./Common/CommunityToolkit.Labs.Core.SourceGenerators.Tests/CommunityToolkit.Labs.Core.SourceGenerators.Tests/bin/Release/net6.0/CommunityToolkit.Labs.Core.SourceGenerators.Tests.dll - - name: Run tests on experiments against UWP + - name: Run experiment tests against UWP run: vstest.console.exe ./Tests/**/CommunityToolkit.Labs.UnitTests.UWP.build.appxrecipe /Framework:FrameworkUap10 - - name: Run tests on experiments against WinAppSDK + - name: Run experiment tests against WinAppSDK run: vstest.console.exe ./Tests/**/CommunityToolkit.Labs.UnitTests.WinAppSdk.build.appxrecipe /Framework:FrameworkUap10 # Test/temp job to build a single experiment to ensure our changes work for both our main types of solutions at the moment From effde14668ff0d964a7c492f3413586c8c331e9c Mon Sep 17 00:00:00 2001 From: Hazel Megan Date: Fri, 8 Apr 2022 01:11:47 +0100 Subject: [PATCH 06/14] add failing test to check CI fails --- .../CanvasLayout.Tests/ExampleCanvasLayoutTestClass.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Labs/CanvasLayout/Tests/CanvasLayout.Tests/ExampleCanvasLayoutTestClass.cs b/Labs/CanvasLayout/Tests/CanvasLayout.Tests/ExampleCanvasLayoutTestClass.cs index 135ada1e3..77222b0f9 100644 --- a/Labs/CanvasLayout/Tests/CanvasLayout.Tests/ExampleCanvasLayoutTestClass.cs +++ b/Labs/CanvasLayout/Tests/CanvasLayout.Tests/ExampleCanvasLayoutTestClass.cs @@ -13,5 +13,11 @@ public void Just_an_example_test() { Assert.AreEqual(1, 1); } + + [TestMethod] + public void example_failing_test_to_check_ci() + { + Assert.AreEqual(2, 1); + } } } From 2f5fc9875a3c7e1aea9f2bcb7f3b6759fbceb127 Mon Sep 17 00:00:00 2001 From: Hazel Megan Date: Fri, 8 Apr 2022 10:20:51 +0100 Subject: [PATCH 07/14] Revert "add failing test to check CI fails" This reverts commit effde14668ff0d964a7c492f3413586c8c331e9c. --- .../CanvasLayout.Tests/ExampleCanvasLayoutTestClass.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Labs/CanvasLayout/Tests/CanvasLayout.Tests/ExampleCanvasLayoutTestClass.cs b/Labs/CanvasLayout/Tests/CanvasLayout.Tests/ExampleCanvasLayoutTestClass.cs index 77222b0f9..135ada1e3 100644 --- a/Labs/CanvasLayout/Tests/CanvasLayout.Tests/ExampleCanvasLayoutTestClass.cs +++ b/Labs/CanvasLayout/Tests/CanvasLayout.Tests/ExampleCanvasLayoutTestClass.cs @@ -13,11 +13,5 @@ public void Just_an_example_test() { Assert.AreEqual(1, 1); } - - [TestMethod] - public void example_failing_test_to_check_ci() - { - Assert.AreEqual(2, 1); - } } } From e01bbf612a9945f924220af2e371ba194216f8f3 Mon Sep 17 00:00:00 2001 From: Hazel Megan Date: Fri, 8 Apr 2022 22:39:06 +0100 Subject: [PATCH 08/14] try generating test report --- .github/workflows/build.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8a875131e..95b32829d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -75,13 +75,19 @@ jobs: uses: darenm/Setup-VSTest@v1 - name: Run SourceGenerators tests - run: vstest.console.exe ./Common/CommunityToolkit.Labs.Core.SourceGenerators.Tests/CommunityToolkit.Labs.Core.SourceGenerators.Tests/bin/Release/net6.0/CommunityToolkit.Labs.Core.SourceGenerators.Tests.dll + run: vstest.console.exe ./Common/CommunityToolkit.Labs.Core.SourceGenerators.Tests/CommunityToolkit.Labs.Core.SourceGenerators.Tests/bin/Release/net6.0/CommunityToolkit.Labs.Core.SourceGenerators.Tests.dll /FailWhenNoTestsFound:true /logger:"trx;LogFileName=SourceGenerators.trx" - name: Run experiment tests against UWP - run: vstest.console.exe ./Tests/**/CommunityToolkit.Labs.UnitTests.UWP.build.appxrecipe /Framework:FrameworkUap10 + run: vstest.console.exe ./Tests/**/CommunityToolkit.Labs.UnitTests.UWP.build.appxrecipe /Framework:FrameworkUap10 /FailWhenNoTestsFound:true /logger:"trx;LogFileName=UWP.trx" - name: Run experiment tests against WinAppSDK - run: vstest.console.exe ./Tests/**/CommunityToolkit.Labs.UnitTests.WinAppSdk.build.appxrecipe /Framework:FrameworkUap10 + run: vstest.console.exe ./Tests/**/CommunityToolkit.Labs.UnitTests.WinAppSdk.build.appxrecipe /Framework:FrameworkUap10 /FailWhenNoTestsFound:true /logger:"trx;LogFileName=WinAppSdk.trx" + + - name: Create test reports + uses: dorny/test-reporter@v1 + with: + path: './TestResults/*.trx' + reporter: dotnet-trx # Test/temp job to build a single experiment to ensure our changes work for both our main types of solutions at the moment experiment: From 6560256f75183e0cba98d3942b6b43d2520cca34 Mon Sep 17 00:00:00 2001 From: Hazel Megan Date: Fri, 8 Apr 2022 22:42:51 +0100 Subject: [PATCH 09/14] Update build.yml --- .github/workflows/build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 95b32829d..a87ef01ad 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -86,8 +86,9 @@ jobs: - name: Create test reports uses: dorny/test-reporter@v1 with: - path: './TestResults/*.trx' - reporter: dotnet-trx + name: Test results + path: './TestResults/*.trx' + reporter: dotnet-trx # Test/temp job to build a single experiment to ensure our changes work for both our main types of solutions at the moment experiment: From c2483582d9c8e407425591e0e010220e7bbaf61c Mon Sep 17 00:00:00 2001 From: Hazel Megan Date: Fri, 8 Apr 2022 22:43:28 +0100 Subject: [PATCH 10/14] Update build.yml --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a87ef01ad..390de9525 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -87,7 +87,6 @@ jobs: uses: dorny/test-reporter@v1 with: name: Test results - path: './TestResults/*.trx' reporter: dotnet-trx # Test/temp job to build a single experiment to ensure our changes work for both our main types of solutions at the moment From c2cc7a15f14867d38f757f6b200f8e6d1de8e252 Mon Sep 17 00:00:00 2001 From: Hazel Megan Date: Fri, 8 Apr 2022 23:32:46 +0100 Subject: [PATCH 11/14] remove documented arg that isn't actually supported --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 390de9525..e5e039fd9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -75,13 +75,13 @@ jobs: uses: darenm/Setup-VSTest@v1 - name: Run SourceGenerators tests - run: vstest.console.exe ./Common/CommunityToolkit.Labs.Core.SourceGenerators.Tests/CommunityToolkit.Labs.Core.SourceGenerators.Tests/bin/Release/net6.0/CommunityToolkit.Labs.Core.SourceGenerators.Tests.dll /FailWhenNoTestsFound:true /logger:"trx;LogFileName=SourceGenerators.trx" + run: vstest.console.exe ./Common/CommunityToolkit.Labs.Core.SourceGenerators.Tests/CommunityToolkit.Labs.Core.SourceGenerators.Tests/bin/Release/net6.0/CommunityToolkit.Labs.Core.SourceGenerators.Tests.dll /logger:"trx;LogFileName=SourceGenerators.trx" - name: Run experiment tests against UWP - run: vstest.console.exe ./Tests/**/CommunityToolkit.Labs.UnitTests.UWP.build.appxrecipe /Framework:FrameworkUap10 /FailWhenNoTestsFound:true /logger:"trx;LogFileName=UWP.trx" + run: vstest.console.exe ./Tests/**/CommunityToolkit.Labs.UnitTests.UWP.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=UWP.trx" - name: Run experiment tests against WinAppSDK - run: vstest.console.exe ./Tests/**/CommunityToolkit.Labs.UnitTests.WinAppSdk.build.appxrecipe /Framework:FrameworkUap10 /FailWhenNoTestsFound:true /logger:"trx;LogFileName=WinAppSdk.trx" + run: vstest.console.exe ./Tests/**/CommunityToolkit.Labs.UnitTests.WinAppSdk.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=WinAppSdk.trx" - name: Create test reports uses: dorny/test-reporter@v1 From f6fd6bbf59b4bb7ca8fc632b0834aa36dce77e58 Mon Sep 17 00:00:00 2001 From: Hazel Megan Date: Sat, 9 Apr 2022 13:04:19 +0100 Subject: [PATCH 12/14] specify path when creating test reports --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e5e039fd9..38563b765 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -87,6 +87,7 @@ jobs: uses: dorny/test-reporter@v1 with: name: Test results + path: './TestResults/*.trx' reporter: dotnet-trx # Test/temp job to build a single experiment to ensure our changes work for both our main types of solutions at the moment From 0cce8ba48853285049c27ffc8089f2b4a066b5c4 Mon Sep 17 00:00:00 2001 From: Hazel Megan Date: Sat, 9 Apr 2022 16:01:56 +0100 Subject: [PATCH 13/14] re-add failing test to see output from GA chceck --- .github/workflows/build.yml | 1 + .../CanvasLayout.Tests/ExampleCanvasLayoutTestClass.cs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 38563b765..c03651940 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -85,6 +85,7 @@ jobs: - name: Create test reports uses: dorny/test-reporter@v1 + if: success() || failure() # run this step even if previous step failed with: name: Test results path: './TestResults/*.trx' diff --git a/Labs/CanvasLayout/Tests/CanvasLayout.Tests/ExampleCanvasLayoutTestClass.cs b/Labs/CanvasLayout/Tests/CanvasLayout.Tests/ExampleCanvasLayoutTestClass.cs index 135ada1e3..00515a275 100644 --- a/Labs/CanvasLayout/Tests/CanvasLayout.Tests/ExampleCanvasLayoutTestClass.cs +++ b/Labs/CanvasLayout/Tests/CanvasLayout.Tests/ExampleCanvasLayoutTestClass.cs @@ -13,5 +13,11 @@ public void Just_an_example_test() { Assert.AreEqual(1, 1); } + + [TestMethod] + public void Deliberately_failing_test_for_CI_verification() + { + Assert.AreEqual(3, 1); + } } } From fc02a5ab882ac5a5207461392370411f1cdf3efa Mon Sep 17 00:00:00 2001 From: Hazel Megan Date: Sat, 9 Apr 2022 19:25:55 +0100 Subject: [PATCH 14/14] remove deliberately failing test --- .../CanvasLayout.Tests/ExampleCanvasLayoutTestClass.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/labs/CanvasLayout/tests/CanvasLayout.Tests/ExampleCanvasLayoutTestClass.cs b/labs/CanvasLayout/tests/CanvasLayout.Tests/ExampleCanvasLayoutTestClass.cs index 00515a275..135ada1e3 100644 --- a/labs/CanvasLayout/tests/CanvasLayout.Tests/ExampleCanvasLayoutTestClass.cs +++ b/labs/CanvasLayout/tests/CanvasLayout.Tests/ExampleCanvasLayoutTestClass.cs @@ -13,11 +13,5 @@ public void Just_an_example_test() { Assert.AreEqual(1, 1); } - - [TestMethod] - public void Deliberately_failing_test_for_CI_verification() - { - Assert.AreEqual(3, 1); - } } }