Skip to content

Commit

Permalink
Merge pull request #335 from CommunityToolkit/llama/workflow-improvem…
Browse files Browse the repository at this point in the history
…ents

De-duplicate our WinUI2/3 workflow definitions with a matrix
  • Loading branch information
michael-hawker authored Dec 12, 2022
2 parents b35b8fb + 5976599 commit 084e2db
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 86 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
]
},
"xamlstyler.console": {
"version": "3.2008.4",
"version": "3.2206.4",
"commands": [
"xstyler"
]
Expand Down
106 changes: 21 additions & 85 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ jobs:

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Needed until XAML Styler updates to .NET 6
- name: Install .NET Core 3.1 SDK
- name: Install .NET 6 SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
dotnet-version: '6.0.x'

# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout Repository
Expand All @@ -41,84 +40,16 @@ jobs:
- name: Check XAML Styling
run: powershell -version 5.1 -command "./ApplyXamlStyling.ps1 -Passive" -ErrorAction Stop

# This workflow contains a single job called "Build-WinUI-2"
Build-WinUI-2:
# Build both Uno.UI/WinUI2/UWP and Uno.WinUI/WinUI3/WindowsAppSDK versions of our packages using a matrix
build:
needs: [Xaml-Style-Check]
runs-on: windows-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Install .NET 6 SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.202'

# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout Repository
uses: actions/checkout@v2

# 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/[email protected]

- name: Enable all TargetFrameworks
working-directory: ./common/Scripts/
run: powershell -version 5.1 -command "./UseTargetFrameworks.ps1 all" -ErrorAction Stop

- name: Generate solution
run: powershell -version 5.1 -command "./GenerateAllSolution.ps1" -ErrorAction Stop

- name: MSBuild
# working-directory: ./
run: msbuild.exe Toolkit.Labs.All.sln /restore -p:Configuration=Release

# Build All Packages
- name: pack experiments
working-directory: ./common/Scripts/
run: ./PackEachExperiment.ps1 all

# Push Packages to our DevOps Artifacts Feed
- name: Add source
if: ${{github.ref == 'refs/heads/main'}}
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

# 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
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.Tests.UWP.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=UWP.trx"

- name: Run experiment tests against WinAppSDK
run: vstest.console.exe ./tests/**/CommunityToolkit.Labs.Tests.WinAppSdk.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=WinAppSdk.trx"

- name: Create test reports
run: |
testspace '[WinUI2]./TestResults/*.trx'
if: always()

# This workflow contains a single job called "Build-WinUI-3"
Build-WinUI-3:
needs: [Xaml-Style-Check]
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]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand Down Expand Up @@ -148,12 +79,12 @@ jobs:
- name: Generate solution
run: powershell -version 5.1 -command "./GenerateAllSolution.ps1" -ErrorAction Stop

- name: Enable WinUI 3
- name: Enable Uno.WinUI (in WinUI3 matrix only)
working-directory: ./common/Scripts/
run: powershell -version 5.1 -command "./UseUnoWinUI.ps1 3" -ErrorAction Stop
if: ${{ matrix.platform == 'WinUI3' }}

- name: MSBuild
# working-directory: ./
run: msbuild.exe Toolkit.Labs.All.sln /restore /nowarn:MSB4011 -p:Configuration=Release

# Build All Packages
Expand All @@ -180,21 +111,24 @@ jobs:
domain: ${{ github.repository_owner }}

- name: Run SourceGenerators tests
id: test-generator
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
id: test-uwp
run: vstest.console.exe ./tests/**/CommunityToolkit.Labs.Tests.UWP.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=UWP.trx"

- name: Run experiment tests against WinAppSDK
id: test-winappsdk
run: vstest.console.exe ./tests/**/CommunityToolkit.Labs.Tests.WinAppSdk.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=WinAppSdk.trx"

- name: Create test reports
run: |
testspace '[WinUI3]./TestResults/*.trx'
if: always()
testspace '[${{ matrix.platform }}]./TestResults/*.trx'
if: ${{ always() && (steps.test-generator.conclusion == 'success' || steps.test-uwp.conclusion == 'success' || steps.test-winappsdk.conclusion == 'success') }}

# Test/temp job to build a single experiment to ensure our changes work for both our main types of solutions at the moment
experiment:
# Test job to build a single experiment to ensure our changes work for both our main types of solutions at the moment
new-experiment:
needs: [Xaml-Style-Check]
runs-on: windows-latest

Expand Down Expand Up @@ -239,15 +173,17 @@ jobs:
domain: ${{ github.repository_owner }}

- name: Run tests in the generated experiment against UWP
id: test-uwp
run: vstest.console.exe ./labs/CiTestExp/**/CiTestExp.Tests.UWP.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=CiTestExpUWP.trx"

- name: Run tests in the generated experiment against WinAppSDK
id: test-winappsdk
run: vstest.console.exe ./labs/CiTestExp/**/CiTestExp.Tests.WinAppSdk.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=CiTestExpWinAppSdk.trx"

- name: Create test reports
run: |
testspace '[New Experiment]./TestResults/*.trx'
if: always()
if: ${{ always() && (steps.test-uwp.conclusion == 'success' || steps.test-winappsdk.conclusion == 'success') }}

wasm-linux:
needs: [Xaml-Style-Check]
Expand Down

0 comments on commit 084e2db

Please sign in to comment.