diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5ccfb2cc..556511e1 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,110 @@ 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: + repo: [Windows, Labs-Windows] + 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 ${{ matrix.repo }} Repository + uses: actions/checkout@v3 + with: + repository: CommunityToolkit/${{ matrix.repo }} + 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 + + # 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