Streamline MAUI app build and add E2E test workflow#212
Merged
StuartFerguson merged 2 commits intoJun 24, 2025
Conversation
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
Show autofix suggestion
Hide autofix suggestion
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
| @@ -7,2 +7,5 @@ | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: |
Copilot is powered by AI and may make mistakes. Always verify output.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updated
windows_navigation_tests.ymlto 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.ymlto 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