From 24bad2c41efc3dba0815c4799e1e5eb2adc8e018 Mon Sep 17 00:00:00 2001 From: Daniel B Date: Mon, 11 May 2020 15:20:14 -0400 Subject: [PATCH 1/8] Create wpfdotnet-core.yml --- .github/workflows/wpfdotnet-core.yml | 115 +++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 .github/workflows/wpfdotnet-core.yml diff --git a/.github/workflows/wpfdotnet-core.yml b/.github/workflows/wpfdotnet-core.yml new file mode 100644 index 0000000..80ec3e5 --- /dev/null +++ b/.github/workflows/wpfdotnet-core.yml @@ -0,0 +1,115 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +# This workflow will build, test and package a WPF desktop application +# built on .NET Core. +# To learn how to migrate your existing WPF application to .NET Core, +# refer to https://docs.microsoft.com/en-us/dotnet/desktop-wpf/migration/convert-project-from-net-framework +# +# To configure this workflow: +# +# 1. Configure environment variables +# GitHub sets default environment variables for every workflow run. +# Replace the variables relative to your project in the "env" section below. +# +# 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. +# +# For more information on GitHub Actions, refer to https://github.com/features/actions +# For a complete CI/CD sample to get started with GitHub Action workflows for Desktop Applications, +# refer to https://github.com/microsoft/github-actions-for-desktop-apps + +name: WPF .NET Core + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + + build: + + strategy: + matrix: + configuration: [Debug, Release] + + runs-on: windows-latest # For a list of available runner types, refer to + # https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on + + env: + Solution_Name: your-solution-name # Replace with your solution name, i.e. MyWpfApp.sln. + Test_Project_Path: your-test-project-path # Replace with the path to your test project, i.e. MyWpfApp.Tests\MyWpfApp.Tests.csproj. + Wap_Project_Directory: your-wap-project-directory-name # Replace with the Wap project directory relative to the solution, i.e. MyWpfApp.Package. + Wap_Project_Path: your-wap-project-path # Replace with the path to your Wap project, i.e. MyWpf.App.Package\MyWpfApp.Package.wapproj. + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + # Install the .NET Core workload + - name: Install .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.1.101 + + # Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild + - name: Setup MSBuild.exe + uses: microsoft/setup-msbuild@2008f912f56e61277eefaac6d1888b750582aa16 + + # Execute all unit tests in the solution + - name: Execute unit tests + run: dotnet test + + # Restore the WPF application to populate the obj folder with RuntimeIdentifiers + - name: Restore the WPF application + run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration + env: + Configuration: ${{ matrix.configuration }} + + # Decode the base 64 encoded pfx and save the Signing_Certificate + - name: Decode the pfx + 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) + + # Create the app package by building and packaging the Windows Application Packaging project + - name: Create the app package + 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 /p:PackageCertificatePassword=${{ secrets.Pfx_Key }} + env: + Appx_Bundle: Always + Appx_Bundle_Platforms: x86|x64 + Appx_Package_Build_Mode: StoreUpload + Configuration: ${{ matrix.configuration }} + + # Remove the pfx + - name: Remove the pfx + run: Remove-Item -path $env:Wap_Project_Directory\$env:Signing_Certificate + + # Upload the MSIX package: https://github.com/marketplace/actions/upload-artifact + - name: Upload build artifacts + uses: actions/upload-artifact@v1 + with: + name: MSIX Package + path: ${{ env.Wap_Project_Directory }}\AppPackages From 0dc80f6a85ea42f21156157a18736b4260945ff4 Mon Sep 17 00:00:00 2001 From: Daniel B Date: Mon, 11 May 2020 15:24:44 -0400 Subject: [PATCH 2/8] Update wpfdotnet-core.yml --- .github/workflows/wpfdotnet-core.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wpfdotnet-core.yml b/.github/workflows/wpfdotnet-core.yml index 80ec3e5..8cdd742 100644 --- a/.github/workflows/wpfdotnet-core.yml +++ b/.github/workflows/wpfdotnet-core.yml @@ -50,7 +50,7 @@ jobs: strategy: matrix: - configuration: [Debug, Release] + configuration: [Release] runs-on: windows-latest # For a list of available runner types, refer to # https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on From 3ee1dcd8704d94d9f2508242b268d779c9885271 Mon Sep 17 00:00:00 2001 From: Daniel B Date: Mon, 11 May 2020 15:32:44 -0400 Subject: [PATCH 3/8] disable unit test for now --- .github/workflows/wpfdotnet-core.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/wpfdotnet-core.yml b/.github/workflows/wpfdotnet-core.yml index 8cdd742..1a16ef0 100644 --- a/.github/workflows/wpfdotnet-core.yml +++ b/.github/workflows/wpfdotnet-core.yml @@ -78,8 +78,8 @@ jobs: uses: microsoft/setup-msbuild@2008f912f56e61277eefaac6d1888b750582aa16 # Execute all unit tests in the solution - - name: Execute unit tests - run: dotnet test + #- name: Execute unit tests + # run: dotnet test # Restore the WPF application to populate the obj folder with RuntimeIdentifiers - name: Restore the WPF application From 460e026f980b77afaa6dd7e7e9bfa435259efb54 Mon Sep 17 00:00:00 2001 From: Daniel B Date: Mon, 11 May 2020 15:33:23 -0400 Subject: [PATCH 4/8] disable unit test for now From e1f3c6b4d345dac14f83216db2d08f62ac450ed5 Mon Sep 17 00:00:00 2001 From: Daniel B Date: Mon, 11 May 2020 15:42:04 -0400 Subject: [PATCH 5/8] Update wpfdotnet-core.yml --- .github/workflows/wpfdotnet-core.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/wpfdotnet-core.yml b/.github/workflows/wpfdotnet-core.yml index 1a16ef0..00d8ac9 100644 --- a/.github/workflows/wpfdotnet-core.yml +++ b/.github/workflows/wpfdotnet-core.yml @@ -56,10 +56,10 @@ jobs: # https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on env: - Solution_Name: your-solution-name # Replace with your solution name, i.e. MyWpfApp.sln. - Test_Project_Path: your-test-project-path # Replace with the path to your test project, i.e. MyWpfApp.Tests\MyWpfApp.Tests.csproj. - Wap_Project_Directory: your-wap-project-directory-name # Replace with the Wap project directory relative to the solution, i.e. MyWpfApp.Package. - Wap_Project_Path: your-wap-project-path # Replace with the path to your Wap project, i.e. MyWpf.App.Package\MyWpfApp.Package.wapproj. + Solution_Name: SnackMachineApp.sln # Replace with your solution name, i.e. MyWpfApp.sln. + Test_Project_Path: SnackMachineApp.Domain.Tests/SnackMachineApp.Domain.Tests.csproj # Replace with the path to your test project, i.e. MyWpfApp.Tests\MyWpfApp.Tests.csproj. + Wap_Project_Directory: SnackMachineApp.WinUI # Replace with the Wap project directory relative to the solution, i.e. MyWpfApp.Package. + Wap_Project_Path: SnackMachineApp.WinUI/SnackMachineApp.WinUI.csproj # Replace with the path to your Wap project, i.e. MyWpf.App.Package\MyWpfApp.Package.wapproj. steps: - name: Checkout From 00e533db6c5feaa0f3d9a0e5f34cbb9eef44dad2 Mon Sep 17 00:00:00 2001 From: Daniel B Date: Mon, 11 May 2020 15:51:57 -0400 Subject: [PATCH 6/8] Update wpfdotnet-core.yml --- .github/workflows/wpfdotnet-core.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/wpfdotnet-core.yml b/.github/workflows/wpfdotnet-core.yml index 00d8ac9..3754b43 100644 --- a/.github/workflows/wpfdotnet-core.yml +++ b/.github/workflows/wpfdotnet-core.yml @@ -88,11 +88,11 @@ jobs: Configuration: ${{ matrix.configuration }} # Decode the base 64 encoded pfx and save the Signing_Certificate - - name: Decode the pfx - 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) + #- name: Decode the pfx + # 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) # Create the app package by building and packaging the Windows Application Packaging project - name: Create the app package @@ -104,8 +104,8 @@ jobs: Configuration: ${{ matrix.configuration }} # Remove the pfx - - name: Remove the pfx - run: Remove-Item -path $env:Wap_Project_Directory\$env:Signing_Certificate + #- name: Remove the pfx + # run: Remove-Item -path $env:Wap_Project_Directory\$env:Signing_Certificate # Upload the MSIX package: https://github.com/marketplace/actions/upload-artifact - name: Upload build artifacts From cb8275bf6a3734120d87bda73f0f793c531a6a78 Mon Sep 17 00:00:00 2001 From: Daniel B Date: Mon, 11 May 2020 16:01:48 -0400 Subject: [PATCH 7/8] Update wpfdotnet-core.yml --- .github/workflows/wpfdotnet-core.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wpfdotnet-core.yml b/.github/workflows/wpfdotnet-core.yml index 3754b43..717175d 100644 --- a/.github/workflows/wpfdotnet-core.yml +++ b/.github/workflows/wpfdotnet-core.yml @@ -58,7 +58,7 @@ jobs: env: Solution_Name: SnackMachineApp.sln # Replace with your solution name, i.e. MyWpfApp.sln. Test_Project_Path: SnackMachineApp.Domain.Tests/SnackMachineApp.Domain.Tests.csproj # Replace with the path to your test project, i.e. MyWpfApp.Tests\MyWpfApp.Tests.csproj. - Wap_Project_Directory: SnackMachineApp.WinUI # Replace with the Wap project directory relative to the solution, i.e. MyWpfApp.Package. + #Wap_Project_Directory: SnackMachineApp.WinUI # Replace with the Wap project directory relative to the solution, i.e. MyWpfApp.Package. Wap_Project_Path: SnackMachineApp.WinUI/SnackMachineApp.WinUI.csproj # Replace with the path to your Wap project, i.e. MyWpf.App.Package\MyWpfApp.Package.wapproj. steps: From 0ae13da965d33dbf5512eb6ac4b5dcfcdfbea830 Mon Sep 17 00:00:00 2001 From: Daniel B Date: Mon, 11 May 2020 18:07:24 -0400 Subject: [PATCH 8/8] Update wpfdotnet-core.yml --- .github/workflows/wpfdotnet-core.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wpfdotnet-core.yml b/.github/workflows/wpfdotnet-core.yml index 717175d..1906c5e 100644 --- a/.github/workflows/wpfdotnet-core.yml +++ b/.github/workflows/wpfdotnet-core.yml @@ -58,7 +58,7 @@ jobs: env: Solution_Name: SnackMachineApp.sln # Replace with your solution name, i.e. MyWpfApp.sln. Test_Project_Path: SnackMachineApp.Domain.Tests/SnackMachineApp.Domain.Tests.csproj # Replace with the path to your test project, i.e. MyWpfApp.Tests\MyWpfApp.Tests.csproj. - #Wap_Project_Directory: SnackMachineApp.WinUI # Replace with the Wap project directory relative to the solution, i.e. MyWpfApp.Package. + Wap_Project_Directory: Packages # Replace with the Wap project directory relative to the solution, i.e. MyWpfApp.Package. Wap_Project_Path: SnackMachineApp.WinUI/SnackMachineApp.WinUI.csproj # Replace with the path to your Wap project, i.e. MyWpf.App.Package\MyWpfApp.Package.wapproj. steps: