Skip to content

Commit

Permalink
Merge branch 'master' into android
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-lerch committed Dec 13, 2024
2 parents a367db2 + 2f222de commit a838417
Show file tree
Hide file tree
Showing 61 changed files with 2,162 additions and 1,934 deletions.
111 changes: 65 additions & 46 deletions .github/workflows/dotnet-desktop.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,4 @@
# 2. Signing
# Generate a signing certificate in the Windows Application
# Packaging Project or add an existing signing certificate to the project.
# Next, use PowerShell to encode the .pfx file using Base64 encoding
# by running the following Powershell script to generate the output string:
#
# $pfx_cert = Get-Content '.\SigningCertificate.pfx' -Encoding Byte
# [System.Convert]::ToBase64String($pfx_cert) | Out-File 'SigningCertificate_Encoded.txt'
#
# Open the output file, SigningCertificate_Encoded.txt, and copy the
# string inside. Then, add the string to the repo as a GitHub secret
# and name it "Base64_Encoded_Pfx."
# For more information on how to configure your signing certificate for
# this workflow, refer to https://github.com/microsoft/github-actions-for-desktop-apps#signing
#
# Finally, add the signing certificate password to the repo as a secret and name it "Pfx_Key".
# See "Build the Windows Application Packaging project" below to see how the secret is used.

name: .NET Core Desktop
name: Windows Forms build and package

on:
push:
Expand All @@ -34,9 +16,8 @@ jobs:

env:
Solution_Name: Vocup.sln # Replace with your solution name, i.e. MyWpfApp.sln.
Test_Project_Path: tests\Vocup.UnitTests\Vocup.UnitTests.csproj # Replace with the path to your test project, i.e. MyWpfApp.Tests\MyWpfApp.Tests.csproj.
Wap_Project_Directory: src\Vocup.Packaging # Replace with the Wap project directory relative to the solution, i.e. MyWpfApp.Package.
Wap_Project_Path: src\Vocup.Packaging\Vocup.Packaging.wapproj # Replace with the path to your Wap project, i.e. MyWpf.App.Package\MyWpfApp.Package.wapproj.
App_Project_Directory: src\Vocup.WinForms
App_Project_Name: Vocup.WinForms

steps:
- name: Checkout
Expand All @@ -56,41 +37,79 @@ jobs:

# Execute all unit tests in the solution
- name: Execute unit tests
run: dotnet test
run: dotnet test --configuration ${{ matrix.configuration }} --arch x64

# Restore the application to populate the obj folder with RuntimeIdentifiers
- name: Restore the application
run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration
env:
Configuration: ${{ matrix.configuration }}
if: matrix.configuration == 'Release'
run: msbuild $env:Solution_Name /t:Restore /p:Configuration=${{ matrix.configuration }}

# Decode the base 64 encoded pfx and save the Signing_Certificate
- name: Decode the pfx
- name: Create MSIX package (x86)
if: matrix.configuration == 'Release'
run: |
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}")
$certificatePath = Join-Path -Path $env:Wap_Project_Directory -ChildPath GitHubActionsWorkflow.pfx
[IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte)
run: msbuild $env:App_Project_Directory /p:Configuration=${{ matrix.configuration }} /p:Platform=x86 /p:GenerateAppxPackageOnBuild=true

# Create the app package by building and packaging the Windows Application Packaging project
- name: Create the app package
- name: Create MSIX package (x64)
if: matrix.configuration == 'Release'
run: msbuild $env:Wap_Project_Path /p:Configuration=$env:Configuration /p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle /p:PackageCertificateKeyFile=GitHubActionsWorkflow.pfx
env:
Appx_Bundle: Always
Appx_Bundle_Platforms: x86|x64|arm64
Appx_Package_Build_Mode: StoreUpload
Configuration: ${{ matrix.configuration }}

# Remove the pfx
- name: Remove the pfx
run: msbuild $env:App_Project_Directory /p:Configuration=${{ matrix.configuration }} /p:Platform=x64 /p:GenerateAppxPackageOnBuild=true

- name: Create MSIX package (arm64)
if: matrix.configuration == 'Release'
run: Remove-Item -path $env:Wap_Project_Directory\GitHubActionsWorkflow.pfx
run: msbuild $env:App_Project_Directory /p:Configuration=${{ matrix.configuration }} /p:Platform=arm64 /p:GenerateAppxPackageOnBuild=true

- name: Gather MSIX files
id: gather
if: matrix.configuration == 'Release' && startsWith(github.ref, 'refs/tags/')
run: |
$gatherDirectory = Join-Path $env:App_Project_Directory "obj" "Bundle"
New-Item -ItemType Directory -Path $gatherDirectory | Out-Null
$msixFiles = Get-ChildItem -Path (Join-Path $env:App_Project_Directory "bin") -Recurse -Include "$env:App_Project_Name*.appx"
$msixFiles | ForEach-Object { Copy-Item -Path $_.FullName -Destination $gatherDirectory }
Write-Output "Copied $($msixFiles.Count) MSIX files to $gatherDirectory"
$version = $msixFiles[0].BaseName.Split("_")[1]
Write-Output "Bundle version based on MSIX file name is $version"
$uploadDirectory = Join-Path $env:App_Project_Directory "bin" "AppPackages"
New-Item -ItemType Directory -Path $uploadDirectory | Out-Null
$uploadFile = Join-Path $uploadDirectory "$($env:App_Project_Name)_$($version)_x86_x64_arm64_bundle.appxupload"
# Upload the MSIX package: https://github.com/marketplace/actions/upload-a-build-artifact
$bundleDirectory = Join-Path $uploadDirectory "$($env:App_Project_Name)_$($version)_Test"
New-Item -ItemType Directory -Path $bundleDirectory | Out-Null
$bundleFile = Join-Path $bundleDirectory "$($env:App_Project_Name)_$($version)_x86_x64_arm64.appxbundle"
$symbolFiles = Get-ChildItem -Path (Join-Path $env:App_Project_Directory "bin") -Recurse -Include "$env:App_Project_Name*.appxsym"
$symbolFiles | ForEach-Object { Copy-Item -Path $_.FullName -Destination $bundleDirectory }
Write-Output "Copied $($symbolFiles.Count) symbol files to $bundleDirectory"
Write-Output "gather_directory=$gatherDirectory" >> $env:GITHUB_OUTPUT
Write-Output "bundle_directory=$bundleDirectory" >> $env:GITHUB_OUTPUT
Write-Output "bundle_version=$version" >> $env:GITHUB_OUTPUT
Write-Output "bundle_file=$bundleFile" >> $env:GITHUB_OUTPUT
Write-Output "upload_directory=$uploadDirectory" >> $env:GITHUB_OUTPUT
Write-Output "upload_file=$uploadFile" >> $env:GITHUB_OUTPUT
- name: Create MSIX bundle
if: matrix.configuration == 'Release' && startsWith(github.ref, 'refs/tags/')
uses: LanceMcCarthy/[email protected]
with:
msix-folder: ${{ steps.gather.outputs.gather_directory }}
msixbundle-filepath: ${{ steps.gather.outputs.bundle_file }}
msixbundle-version: ${{ steps.gather.outputs.bundle_version }}

- name: Create MSIX upload
if: matrix.configuration == 'Release' && startsWith(github.ref, 'refs/tags/')
run: |
$uploadFile = "${{ steps.gather.outputs.upload_file }}"
$bundleDirectory = "${{ steps.gather.outputs.bundle_directory }}"
Compress-Archive -Path "$bundleDirectory\*" -DestinationPath $uploadFile
- name: Upload build artifacts
if: matrix.configuration == 'Release' && startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v4
with:
name: MSIX Package
path: ${{ env.Wap_Project_Directory }}\AppPackages
path: ${{ steps.gather.outputs.upload_file }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ publish/
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
#*.pubxml
*.publishproj

# Microsoft Azure Web App publish settings. Comment the next line if you want to
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Nullable>enable</Nullable>
<AvaloniaVersion>11.2.1</AvaloniaVersion>
<AvaloniaVersion>11.2.2</AvaloniaVersion>
</PropertyGroup>
</Project>
29 changes: 6 additions & 23 deletions Vocup.sln
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "setup", "setup", "{2EC721A1
setup\vocup.iss = setup\vocup.iss
EndProjectSection
EndProject
Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "Vocup.Packaging", "src\Vocup.Packaging\Vocup.Packaging.wapproj", "{B6986B1F-50BC-4E36-87B4-1C195B15F953}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{DB3F9D1B-E719-4A4B-8953-5FB027887083}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vocup.UnitTests", "tests\Vocup.UnitTests\Vocup.UnitTests.csproj", "{AEB8CB75-2A9D-4DE1-B4F8-B529FFA21240}"
Expand All @@ -65,38 +63,24 @@ Global
{004AE06A-96F3-4B2E-9AF4-524835814A36}.Debug|Any CPU.Build.0 = Debug|Any CPU
{004AE06A-96F3-4B2E-9AF4-524835814A36}.Debug|ARM64.ActiveCfg = Debug|ARM64
{004AE06A-96F3-4B2E-9AF4-524835814A36}.Debug|ARM64.Build.0 = Debug|ARM64
{004AE06A-96F3-4B2E-9AF4-524835814A36}.Debug|ARM64.Deploy.0 = Debug|ARM64
{004AE06A-96F3-4B2E-9AF4-524835814A36}.Debug|x64.ActiveCfg = Debug|x64
{004AE06A-96F3-4B2E-9AF4-524835814A36}.Debug|x64.Build.0 = Debug|x64
{004AE06A-96F3-4B2E-9AF4-524835814A36}.Debug|x64.Deploy.0 = Debug|x64
{004AE06A-96F3-4B2E-9AF4-524835814A36}.Debug|x86.ActiveCfg = Debug|x86
{004AE06A-96F3-4B2E-9AF4-524835814A36}.Debug|x86.Build.0 = Debug|x86
{004AE06A-96F3-4B2E-9AF4-524835814A36}.Debug|x86.Deploy.0 = Debug|x86
{004AE06A-96F3-4B2E-9AF4-524835814A36}.Release|Any CPU.ActiveCfg = Release|Any CPU
{004AE06A-96F3-4B2E-9AF4-524835814A36}.Release|Any CPU.Build.0 = Release|Any CPU
{004AE06A-96F3-4B2E-9AF4-524835814A36}.Release|ARM64.ActiveCfg = Release|ARM64
{004AE06A-96F3-4B2E-9AF4-524835814A36}.Release|ARM64.Build.0 = Release|ARM64
{004AE06A-96F3-4B2E-9AF4-524835814A36}.Release|ARM64.Deploy.0 = Release|ARM64
{004AE06A-96F3-4B2E-9AF4-524835814A36}.Release|x64.ActiveCfg = Release|x64
{004AE06A-96F3-4B2E-9AF4-524835814A36}.Release|x64.Build.0 = Release|x64
{004AE06A-96F3-4B2E-9AF4-524835814A36}.Release|x64.Deploy.0 = Release|x64
{004AE06A-96F3-4B2E-9AF4-524835814A36}.Release|x86.ActiveCfg = Release|x86
{004AE06A-96F3-4B2E-9AF4-524835814A36}.Release|x86.Build.0 = Release|x86
{B6986B1F-50BC-4E36-87B4-1C195B15F953}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B6986B1F-50BC-4E36-87B4-1C195B15F953}.Debug|ARM64.ActiveCfg = Debug|ARM64
{B6986B1F-50BC-4E36-87B4-1C195B15F953}.Debug|ARM64.Build.0 = Debug|ARM64
{B6986B1F-50BC-4E36-87B4-1C195B15F953}.Debug|ARM64.Deploy.0 = Debug|ARM64
{B6986B1F-50BC-4E36-87B4-1C195B15F953}.Debug|x64.ActiveCfg = Debug|x64
{B6986B1F-50BC-4E36-87B4-1C195B15F953}.Debug|x64.Build.0 = Debug|x64
{B6986B1F-50BC-4E36-87B4-1C195B15F953}.Debug|x64.Deploy.0 = Debug|x64
{B6986B1F-50BC-4E36-87B4-1C195B15F953}.Debug|x86.ActiveCfg = Debug|x86
{B6986B1F-50BC-4E36-87B4-1C195B15F953}.Debug|x86.Build.0 = Debug|x86
{B6986B1F-50BC-4E36-87B4-1C195B15F953}.Debug|x86.Deploy.0 = Debug|x86
{B6986B1F-50BC-4E36-87B4-1C195B15F953}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B6986B1F-50BC-4E36-87B4-1C195B15F953}.Release|ARM64.ActiveCfg = Release|ARM64
{B6986B1F-50BC-4E36-87B4-1C195B15F953}.Release|ARM64.Build.0 = Release|ARM64
{B6986B1F-50BC-4E36-87B4-1C195B15F953}.Release|ARM64.Deploy.0 = Release|ARM64
{B6986B1F-50BC-4E36-87B4-1C195B15F953}.Release|x64.ActiveCfg = Release|x64
{B6986B1F-50BC-4E36-87B4-1C195B15F953}.Release|x64.Build.0 = Release|x64
{B6986B1F-50BC-4E36-87B4-1C195B15F953}.Release|x64.Deploy.0 = Release|x64
{B6986B1F-50BC-4E36-87B4-1C195B15F953}.Release|x86.ActiveCfg = Release|x86
{B6986B1F-50BC-4E36-87B4-1C195B15F953}.Release|x86.Build.0 = Release|x86
{B6986B1F-50BC-4E36-87B4-1C195B15F953}.Release|x86.Deploy.0 = Release|x86
{004AE06A-96F3-4B2E-9AF4-524835814A36}.Release|x86.Deploy.0 = Release|x86
{AEB8CB75-2A9D-4DE1-B4F8-B529FFA21240}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AEB8CB75-2A9D-4DE1-B4F8-B529FFA21240}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AEB8CB75-2A9D-4DE1-B4F8-B529FFA21240}.Debug|ARM64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -175,7 +159,6 @@ Global
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{004AE06A-96F3-4B2E-9AF4-524835814A36} = {C15174B9-657C-4871-BD70-E367286C3A48}
{B6986B1F-50BC-4E36-87B4-1C195B15F953} = {C15174B9-657C-4871-BD70-E367286C3A48}
{AEB8CB75-2A9D-4DE1-B4F8-B529FFA21240} = {DB3F9D1B-E719-4A4B-8953-5FB027887083}
{3A27DC34-46FB-44FB-B169-C3AAC746AC9B} = {C15174B9-657C-4871-BD70-E367286C3A48}
{B6B9C56D-7384-4D6B-B822-FB70E5D6ACCA} = {C15174B9-657C-4871-BD70-E367286C3A48}
Expand Down
105 changes: 0 additions & 105 deletions src/Vocup.Packaging/Vocup.Packaging.wapproj

This file was deleted.

Loading

0 comments on commit a838417

Please sign in to comment.