Skip to content

Streamline MAUI app build and add E2E test workflow#212

Merged
StuartFerguson merged 2 commits into
mainfrom
task/#208_windows_e2e_tests_after_net9_upgrade
Jun 24, 2025
Merged

Streamline MAUI app build and add E2E test workflow#212
StuartFerguson merged 2 commits into
mainfrom
task/#208_windows_e2e_tests_after_net9_upgrade

Conversation

@StuartFerguson
Copy link
Copy Markdown
Member

Updated windows_navigation_tests.yml to simplify the build and publish process for the MAUI app on Windows by removing unnecessary commented-out steps and adding a PFX decryption step for signing.

Introduced windows_e2e_tests.yml to set up a new job for running end-to-end tests, including repository checkout, MSBuild and .NET setup, MAUI workload installation, and Appium test execution, with proper handling of logs and artifacts on failure.

Closes #208

Updated `windows_navigation_tests.yml` to simplify the build and publish process for the MAUI app on Windows by removing unnecessary commented-out steps and adding a PFX decryption step for signing.

Introduced `windows_e2e_tests.yml` to set up a new job for running end-to-end tests, including repository checkout, MSBuild and .NET setup, MAUI workload installation, and Appium test execution, with proper handling of logs and artifacts on failure.
Comment on lines +10 to +79
runs-on: windows-2022
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.1
with:
vs-prerelease: true

- name: Set up .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '9.0.x'

- name: Install MAUI workloads
run: |
dotnet workload install maui

- name: Install Appium and Drivers
run: |
npm install -g appium --unsafe-perm=true --allow-root
appium driver install --source=npm appium-windows-driver

- name: Start Appium Server
run: |
nohup appium --log appium.log &

- name: Restore MAUI App for Windows
run: dotnet restore TransactionProcessor.Mobile.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }} --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json

- name: Build Code
run: dotnet build TransactionProcessor.Mobile/TransactionProcessor.Mobile.csproj -f net9.0-android -c Release --no-restore

- name: Decrypt PFX File
run: |
echo "${{ secrets.WINDOWSSIGNINGCERT }}" > cert.pfx.asc
certutil -decode cert.pfx.asc cert.pfx

- name: Add Cert to Store
run: certutil -user -q -p ${{ secrets.WINDOWSSIGNINGCERTPWD }} -importpfx cert.pfx NoRoot

- name: Publish App
run: |
dotnet publish TransactionProcessor.Mobile/TransactionProcessor.Mobile.csproj -c Release -f net9.0-windows10.0.19041.0 /p:AppxPackageSigningEnabled=true /p:PackageCertificateThumbprint="${{ secrets.WINDOWSSIGNINGCERTTHUMBPRINT }}"

- name: Install App
shell: powershell
run: |
Import-Module Appx
.\TransactionProcessor.Mobile/bin/Release\net9.0-windows10.0.19041.0\win10-x64\AppPackages\TransactionProcessor.Mobile_1.0.0.1_Test\Install.ps1 -Force

- name: Run Windows End To End Tests
run: dotnet test TransactionProcessor.Mobile.UiTests/TransactionProcessor.Mobile.UiTests.csproj --filter "(Category=PRTest)&(Category=Windows)" --no-restore

- name: Upload Logs on Failure
if: failure() # Runs only if a previous step fails
uses: actions/upload-artifact@v4
with:
name: windows-e2e_tests
path: C:\\Users\\runneradmin\\txnproc

- name: Upload Appium Logs on Failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: windows-e2e_tests_appium
path: appium.log


No newline at end of file

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 11 months ago

To fix the issue, add a permissions block at the root level of the workflow file. This block will explicitly define the permissions required for the workflow, limiting the GITHUB_TOKEN to the least privilege necessary. Based on the workflow's operations, the contents: read permission is sufficient for most steps, while secrets access is implicitly required for steps that use ${{ secrets.* }}. No write permissions are needed.

Suggested changeset 1
.github/workflows/windows_e2e_tests.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/windows_e2e_tests.yml b/.github/workflows/windows_e2e_tests.yml
--- a/.github/workflows/windows_e2e_tests.yml
+++ b/.github/workflows/windows_e2e_tests.yml
@@ -7,2 +7,5 @@
 
+permissions:
+  contents: read
+
 jobs:
EOF
@@ -7,2 +7,5 @@

permissions:
contents: read

jobs:
Copilot is powered by AI and may make mistakes. Always verify output.
@StuartFerguson StuartFerguson merged commit c12ba90 into main Jun 24, 2025
12 checks passed
@github-actions github-actions Bot deleted the task/#208_windows_e2e_tests_after_net9_upgrade branch August 24, 2025 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows End to End Tests after Net 9 Upgrade

2 participants