Skip to content

Commit

Permalink
Undo temporary hacks and workarounds
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio0694 committed Dec 25, 2024
1 parent b85e1bc commit 45029c6
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 7 deletions.
95 changes: 89 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ jobs:
strategy:
fail-fast: false # prevent one matrix pipeline from being cancelled if one fails, we want them all to run to completion.
matrix:
winui: [2, 3] # Temporary until we can get Uno/Wasm working
multitarget: ['uwp', 'wasdk'] # Temporary until we can get Uno/Wasm working
winui: [2, 3]
multitarget: ['uwp', 'wasdk', 'wasm', 'wpf', 'linuxgtk', 'macos', 'ios', 'android']
exclude:
# WinUI 2 not supported on wasdk
- winui: 2
Expand Down Expand Up @@ -134,7 +134,42 @@ jobs:

# Generate full solution with all projects (sample gallery heads, components, tests)
- name: Generate solution with ${{ matrix.multitarget }} gallery, components and tests
run: powershell -version 5.1 -command "./tooling/Build-Toolkit-Components.ps1 -Components DependencyPropertyGenerator -Release -MultiTargets ${{ matrix.multitarget }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }} -WinUIMajorVersion ${{ matrix.winui }}" -ErrorAction Stop
working-directory: ./
run: powershell -version 5.1 -command "./tooling/GenerateAllSolution.ps1 -MultiTargets ${{ matrix.multitarget }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }} -WinUIMajorVersion ${{ matrix.winui }}" -ErrorAction Stop

# Build solution
- name: MSBuild (With diagnostics)
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
run: >
msbuild.exe /restore /nowarn:MSB4011
/p:Configuration=Release
/m
${{ env.ENABLE_DIAGNOSTICS == 'true' && '/bl' || '' }}
/v:${{ env.MSBUILD_VERBOSITY }}
CommunityToolkit.AllComponents.sln
- name: MSBuild
if: ${{ env.ENABLE_DIAGNOSTICS == 'false' }}
run: msbuild.exe CommunityToolkit.AllComponents.sln /restore /nowarn:MSB4011 -p:Configuration=Release

# Run tests
- name: Setup VSTest Path
uses: darenm/setup-vstest@3a16d909a1f3bbc65b52f8270d475d905e7d3e44

- name: Install Testspace Module
uses: testspace-com/setup-testspace@v1
with:
domain: ${{ github.repository_owner }}

- name: Run component tests against ${{ matrix.multitarget }}
if: ${{ matrix.multitarget == 'uwp' || matrix.multitarget == 'wasdk' }}
id: test-platform
run: vstest.console.exe ./tooling/**/CommunityToolkit.Tests.${{ matrix.multitarget }}.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=${{ matrix.multitarget }}.trx" /Blame

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

- name: Artifact - Diagnostic Logs
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -178,7 +213,7 @@ jobs:
strategy:
fail-fast: false # prevent one matrix pipeline from being cancelled if one fails, we want them all to run to completion.
matrix:
winui: [2, 3] # Temporary until we can get Uno/Wasm working
winui: [2, 3]

env:
VERSION_PROPERTY: ${{ github.ref == 'refs/heads/main' && format('build.{0}', github.run_number) || format('pull-{0}.{1}', github.event.number, github.run_number) }}
Expand Down Expand Up @@ -234,7 +269,7 @@ jobs:
# Build and pack component nupkg
- name: Build and pack component packages
run: ./tooling/Build-Toolkit-Components.ps1 -Components DependencyPropertyGenerator -MultiTargets uwp,wasdk -ExcludeMultiTargets ${{ env.EXCLUDED_MULTITARGETS }} -WinUIMajorVersion ${{ matrix.winui }} -DateForVersion ${{ env.VERSION_DATE }} ${{ env.VERSION_PROPERTY != '' && format('-PreviewVersion "{0}"', env.VERSION_PROPERTY) || '' }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && '-EnableBinlogs' || '' }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && '-Verbose' || '' }} -BinlogOutput ./ -NupkgOutput ./ -Release
run: ./tooling/Build-Toolkit-Components.ps1 -MultiTargets all -ExcludeMultiTargets ${{ env.EXCLUDED_MULTITARGETS }} -WinUIMajorVersion ${{ matrix.winui }} -DateForVersion ${{ env.VERSION_DATE }} ${{ env.VERSION_PROPERTY != '' && format('-PreviewVersion "{0}"', env.VERSION_PROPERTY) || '' }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && '-EnableBinlogs' || '' }} ${{ env.ENABLE_DIAGNOSTICS == 'true' && '-Verbose' || '' }} -BinlogOutput ./ -NupkgOutput ./ -Release

- name: Validate package names
if: ${{ env.VERSION_PROPERTY != '' }}
Expand Down Expand Up @@ -271,4 +306,52 @@ jobs:
if: ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }}
with:
name: build-logs-winui${{ matrix.winui }}
path: ./*.*log
path: ./*.*log

wasm-linux:
runs-on: ubuntu-latest
env:
HEADS_DIRECTORY: tooling/ProjectHeads

steps:
- name: Install .NET SDK v${{ env.DOTNET_VERSION }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: .NET Info (if diagnostics)
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
run: dotnet --info

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

# Restore Tools from Manifest list in the Repository
- name: Restore dotnet tools
run: dotnet tool restore

- name: Generate solution
shell: pwsh
working-directory: ./
run: ./tooling/GenerateAllSolution.ps1${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}

- name: Install ninja for WASM native dependencies
run: sudo apt-get install ninja-build

# Issue with Comment Links currently, see: https://github.com/mrlacey/CommentLinks/issues/38
# See launch.json configuration file for analogous command we're emulating here to build LINK: ../../.vscode/launch.json:CommunityToolkit.App.Wasm.csproj
- name: dotnet build
working-directory: ./${{ env.HEADS_DIRECTORY }}/AllComponents/Wasm/
run: dotnet build /r /bl /p:UnoSourceGeneratorUseGenerationHost=true /p:UnoSourceGeneratorUseGenerationController=false

# TODO: Do we want to run tests here? Can we do that on linux easily?

- name: Artifact - Diagnostic Logs
uses: actions/upload-artifact@v4
if: ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }}
with:
name: linux-logs
path: ./**/*.*log
1 change: 1 addition & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<SlnGenSolutionItem Include="$(MSBuildThisFileDirectory).editorconfig" />
<SlnGenSolutionItem Include="$(MSBuildThisFileDirectory)settings.xamlstyler" />
<SlnGenSolutionItem Include="$(MSBuildThisFileDirectory)*.md" />
<SlnGenSolutionItem Include="$(MSBuildThisFileDirectory)tooling\GlobalUsings*.cs" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@
<ProjectReference Include="..\CommunityToolkit.AppServices.SourceGenerators\CommunityToolkit.AppServices.SourceGenerators.csproj" />
<ProjectReference Include="..\src\CommunityToolkit.AppServices.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Remove="C:\Users\sergiopedri\git\Labs-Windows\tooling\GlobalUsings.cs" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@
<AdditionalFiles Include="AnalyzerReleases.Shipped.md" />
<AdditionalFiles Include="AnalyzerReleases.Unshipped.md" />
</ItemGroup>

<!-- Remove imported global usings -->
<ItemGroup>
<Compile Remove="$(ToolingDirectory)\GlobalUsings.cs" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<RootNamespace>CommunityToolkit.AppServices</RootNamespace>
<PackageId>$(PackageIdPrefix).$(ToolkitComponentName)</PackageId>
<HasWinUI>false</HasWinUI>
<EnableGlobalUsings>false</EnableGlobalUsings>
</PropertyGroup>

<!-- Sets this up as a toolkit component's source project -->
Expand Down Expand Up @@ -56,4 +55,9 @@
<!-- Pack the source generator to the right package folder -->
<None Include="..\CommunityToolkit.AppServices.SourceGenerators\bin\$(Platform)\$(Configuration)\netstandard2.0\CommunityToolkit.AppServices.SourceGenerators.dll" PackagePath="analyzers\dotnet\cs" Pack="true" Visible="false" />
</ItemGroup>

<!-- Remove imported global usings -->
<ItemGroup>
<Compile Remove="$(ToolingDirectory)\GlobalUsings.cs" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<IsPackable>false</IsPackable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

<!--
Suppress ref safety warnings in unsafe contexts (see https://github.com/dotnet/csharplang/issues/6476).
This is used eg. to replace Unsafe.SizeOf<T>() calls with just sizeof(T), or to just use raw pointers to
reinterpret references to managed objects when it is safe to do so. The warnings are not necessary in this
context, since in order to use these APIs the caller already has to be in an unsafe context.
-->
<NoWarn>$(NoWarn);CS8500</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.1" PrivateAssets="all" Pack="false" />
<PackageReference Include="PolySharp" Version="1.13.2" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<AdditionalFiles Include="AnalyzerReleases.Shipped.md" />
<AdditionalFiles Include="AnalyzerReleases.Unshipped.md" />
</ItemGroup>

<!-- Remove imported global usings -->
<ItemGroup>
<Compile Remove="$(ToolingDirectory)\GlobalUsings.cs" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,9 @@
<!-- Pack the source generator to the right package folder -->
<None Include="..\CommunityToolkit.Extensions.DependencyInjection.SourceGenerators\bin\$(Configuration)\netstandard2.0\CommunityToolkit.Extensions.DependencyInjection.SourceGenerators.dll" PackagePath="analyzers\dotnet\cs" Pack="true" Visible="false" />
</ItemGroup>

<!-- Remove imported global usings -->
<ItemGroup>
<Compile Remove="$(ToolingDirectory)\GlobalUsings.cs" />
</ItemGroup>
</Project>

0 comments on commit 45029c6

Please sign in to comment.