Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/windows_e2e_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Build and Run Windows End to End Tests

on:
pull_request:
branches:
- main

jobs:
software_navigation_tests:
runs-on: windows-2022
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup MSBuild
uses: microsoft/[email protected]
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


Comment on lines +10 to +79

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.
27 changes: 2 additions & 25 deletions .github/workflows/windows_navigation_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main

jobs:
software_navigation_tests:
end_to_end_tests:
runs-on: windows-2022
steps:
- name: Checkout repository
Expand Down Expand Up @@ -39,23 +39,7 @@ jobs:
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

# ✅ Restore the MAUI App separately with RID
#- name: Restore MAUI App Project
# run: dotnet restore TransactionProcessor.Mobile/TransactionProcessor.Mobile.csproj --runtime win10-x64 --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }} --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json

# ✅ Restore all other projects without RID (via .sln)
#- name: Restore Solution (excluding RID conflicts)
# 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

# ✅ Build the MAUI App with RuntimeIdentifier
#- name: Build MAUI App
# run: dotnet build TransactionProcessor.Mobile/TransactionProcessor.Mobile.csproj -f net9.0-windows10.0.19041.0 -c Release --runtime win10-x64 --no-restore

# ✅ Build all other projects (test libraries, class libs, etc.)
#- name: Build Solution (non-MAUI projects)
# run: dotnet build TransactionProcessor.Mobile.sln -c Release --no-restore
run: dotnet build TransactionProcessor.Mobile/TransactionProcessor.Mobile.csproj -f net9.0-android -c Release --no-restore

- name: Decrypt PFX File
run: |
Expand All @@ -68,16 +52,9 @@ jobs:
- 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: List published files
shell: pwsh
run: |
Get-ChildItem "D:\a\TransactionMobile\TransactionMobile\TransactionProcessor.Mobile\bin\Release\net9.0-windows10.0.19041.0" -Recurse -File | ForEach-Object { $_.FullName }

- name: Install App
shell: powershell
#run: |
# Add-AppxPackage .\TransactionProcessor.Mobile\bin\Release\net9.0-windows10.0.19041.0\win10-x64\AppPackages\TransactionProcessor.Mobile_1.0.0.1_Test\TransactionProcessor.Mobile_1.0.0.1_x64.msix
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
Expand Down
Loading