From 6e3a9e0ea67ed0fd754093ff60db34ba30a7c17f Mon Sep 17 00:00:00 2001 From: michael-hawker <24302614+michael-hawker@users.noreply.github.com> Date: Tue, 25 Jul 2023 14:35:10 -0700 Subject: [PATCH 1/3] Adds the WinUI 2/3 Build script from the main repository as an additional job to test changes to tooling against our main code-base --- .github/workflows/build.yml | 120 +++++++++++++++++++++++++++++++++++- 1 file changed, 117 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5ccfb2cc..bc8136a8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,6 +20,8 @@ env: ENABLE_DIAGNOSTICS: false #COREHOST_TRACE: 1 COREHOST_TRACEFILE: corehosttrace.log + MULTI_TARGET_DIRECTORY: tooling/MultiTarget + HEADS_DIRECTORY: tooling/ProjectHeads # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: @@ -91,7 +93,6 @@ jobs: project-template: runs-on: windows-latest env: - HEADS_DIRECTORY: tooling/ProjectHeads PROJECT_DIRECTORY: tooling/ProjectTemplate steps: @@ -141,7 +142,6 @@ jobs: new-experiment: runs-on: windows-latest env: - HEADS_DIRECTORY: tooling/ProjectHeads PROJECT_DIRECTORY: tooling/ProjectTemplate TEST_PROJECT_NAME: CiTestExp TEST_PROJECT_DIRECTORY: components/CiTestExp @@ -238,7 +238,6 @@ jobs: wasm-linux: runs-on: ubuntu-latest env: - HEADS_DIRECTORY: tooling/ProjectHeads TEST_PROJECT_NAME: CiTestExp steps: @@ -299,3 +298,118 @@ jobs: with: name: linux-logs path: ./**/*.*log + + # Modified copy from build step at https://github.com/CommunityToolkit/Windows/blob/main/.github/workflows/build.yml#L52-L152 + main-repo: + runs-on: windows-latest + + # See https://docs.github.com/actions/using-jobs/using-a-matrix-for-your-jobs + strategy: + fail-fast: false # prevent one matrix pipeline from being cancelled if one fails, we want them both to run to completion. + matrix: + platform: [WinUI2, WinUI3] + + env: + # faux-ternary expression to select which platforms to build for each platform vs. duplicating step below. + TARGET_PLATFORMS: ${{ matrix.platform != 'WinUI3' && 'all' || 'all-uwp' }} + TEST_PLATFORM: ${{ matrix.platform != 'WinUI3' && 'UWP' || 'WinAppSdk' }} + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - name: Install .NET SDK v${{ env.DOTNET_VERSION }} + uses: actions/setup-dotnet@v3 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + - name: .NET Info (if diagnostics) + if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }} + run: dotnet --info + + # Modified - Check out the main repo's repository first + - name: Checkout Main Repository + uses: actions/checkout@v3 + with: + repository: CommunityToolkit/Windows + ref: main + + # Checks-out Current tooling changes as the submodule + - name: Checkout Tooling Repository + uses: actions/checkout@v3 + with: + path: tooling + clean: false + + # TODO: Everything below these two checkout steps are the same, can we next in a yml for a composited build? + # Restore Tools from Manifest list in the Repository + - name: Restore dotnet tools + run: dotnet tool restore + + - name: Run Uno Check to Install Dependencies + run: dotnet tool run uno-check --ci --fix --non-interactive --skip wsl --skip androidemulator --verbose + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v1.3.1 + + - name: Enable ${{ env.TARGET_PLATFORMS }} TargetFrameworks + working-directory: ./${{ env.MULTI_TARGET_DIRECTORY }} + run: powershell -version 5.1 -command "./UseTargetFrameworks.ps1 ${{ env.TARGET_PLATFORMS }}" -ErrorAction Stop + + - name: Generate solution w/ ${{ env.TEST_PLATFORM }} Tests + working-directory: ./ + run: powershell -version 5.1 -command "./tooling/GenerateAllSolution.ps1 -IncludeHeads ${{ env.TEST_PLATFORM }}${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}" -ErrorAction Stop + + - name: Enable Uno.WinUI (in WinUI3 matrix only) + working-directory: ./${{ env.MULTI_TARGET_DIRECTORY }} + run: powershell -version 5.1 -command "./UseUnoWinUI.ps1 3" -ErrorAction Stop + if: ${{ matrix.platform == 'WinUI3' }} + + - name: MSBuild + run: msbuild.exe CommunityToolkit.AllComponents.sln /restore /nowarn:MSB4011 -p:Configuration=Release -m -p:UseDotNetNativeToolchain=false + + # Build All Packages + - name: pack experiments + working-directory: ./tooling/Scripts/ + run: ./PackEachExperiment.ps1 all + + # Push Packages to our DevOps Artifacts Feed (see nuget.config) + - name: Add source + if: ${{ github.ref == 'refs/heads/main' }} + run: dotnet nuget update source MainLatest --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 MainLatest --skip-duplicate + + # Run tests + - name: Setup VSTest Path + uses: darenm/Setup-VSTest@v1 + + - name: Install Testspace Module + uses: testspace-com/setup-testspace@v1 + with: + domain: ${{ github.repository_owner }} + + - name: Run SourceGenerators tests + id: test-generator + run: vstest.console.exe ./tooling/CommunityToolkit.Tooling.SampleGen.Tests/bin/Release/net6.0/CommunityToolkit.Tooling.SampleGen.Tests.dll /logger:"trx;LogFileName=SourceGenerators.trx" + + - name: Run experiment tests against ${{ env.TEST_PLATFORM }} + id: test-platform + run: vstest.console.exe ./tooling/**/CommunityToolkit.Tests.${{ env.TEST_PLATFORM }}.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=${{ env.TEST_PLATFORM }}.trx" + + - name: Create test reports + run: | + testspace '[${{ matrix.platform }}]./TestResults/*.trx' + if: ${{ always() && (steps.test-generator.conclusion == 'success' || steps.test-platform.conclusion == 'success') }} + + - name: Artifact - Diagnostic Logs + uses: actions/upload-artifact@v3 + if: ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }} + with: + name: build-logs + path: ./**/*.*log + + - name: Windows System Error Log + shell: pwsh + working-directory: ./ + run: Get-EventLog -LogName System -EntryType Error | Format-List From d7fa6e32fcba1118500d12093276042ac62f872e Mon Sep 17 00:00:00 2001 From: michael-hawker <24302614+michael-hawker@users.noreply.github.com> Date: Tue, 25 Jul 2023 16:15:09 -0700 Subject: [PATCH 2/3] Add both Windows and Labs-Windows to matrix for repos to check against --- .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 bc8136a8..3cc938d2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -307,6 +307,7 @@ jobs: strategy: fail-fast: false # prevent one matrix pipeline from being cancelled if one fails, we want them both to run to completion. matrix: + repo: [Windows, Labs-Windows] platform: [WinUI2, WinUI3] env: @@ -326,10 +327,10 @@ jobs: run: dotnet --info # Modified - Check out the main repo's repository first - - name: Checkout Main Repository + - name: Checkout ${{ matrix.repo }} Repository uses: actions/checkout@v3 with: - repository: CommunityToolkit/Windows + repository: CommunityToolkit/${{ matrix.repo }} ref: main # Checks-out Current tooling changes as the submodule From ef9daa3c7c8d1303ea1145147507aaa1c740df73 Mon Sep 17 00:00:00 2001 From: michael-hawker <24302614+michael-hawker@users.noreply.github.com> Date: Tue, 25 Jul 2023 16:18:06 -0700 Subject: [PATCH 3/3] Remove pushing packages as a build step --- .github/workflows/build.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3cc938d2..556511e1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -372,15 +372,6 @@ jobs: working-directory: ./tooling/Scripts/ run: ./PackEachExperiment.ps1 all - # Push Packages to our DevOps Artifacts Feed (see nuget.config) - - name: Add source - if: ${{ github.ref == 'refs/heads/main' }} - run: dotnet nuget update source MainLatest --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 MainLatest --skip-duplicate - # Run tests - name: Setup VSTest Path uses: darenm/Setup-VSTest@v1