|
1 | | -name: Run QA Test # Runs automated tests on a self-hosted QA machine |
2 | | - |
3 | | -on: |
4 | | - workflow_run: |
5 | | - workflows: ["Build"] |
6 | | - types: |
7 | | - - completed |
8 | | - |
9 | | -concurrency: |
10 | | - group: qa-test-run |
11 | | - cancel-in-progress: true # Cancels any queued job when a new one starts |
12 | | - |
13 | | -jobs: |
14 | | - debug-workflow: |
15 | | - runs-on: ubuntu-latest |
16 | | - steps: |
17 | | - - name: Debug Workflow Variables |
18 | | - run: | |
19 | | - echo "Workflow Conclusion: ${{ github.event.workflow_run.conclusion }}" |
20 | | - echo "Workflow Head Branch: ${{ github.event.workflow_run.head_branch }}" |
21 | | - echo "Workflow Run ID: ${{ github.event.workflow_run.id }}" |
22 | | - echo "Head Commit Message: ${{ github.event.workflow_run.head_commit.message }}" |
23 | | - echo "GitHub Ref: ${{ github.ref }}" |
24 | | - echo "GitHub Ref Name: ${{ github.ref_name }}" |
25 | | - echo "GitHub Event Name: ${{ github.event_name }}" |
26 | | - echo "GitHub Workflow Name: ${{ github.workflow }}" |
27 | | -
|
28 | | - install-viewer-and-run-tests: |
29 | | - runs-on: [self-hosted, qa-machine] |
30 | | - # Run test only on successful builds of Second_Life_X branches |
31 | | - if: > |
32 | | - github.event.workflow_run.conclusion == 'success' && |
33 | | - ( |
34 | | - startsWith(github.event.workflow_run.head_branch, 'Second_Life') |
35 | | - ) |
36 | | -
|
37 | | - steps: |
38 | | - - name: Temporarily Allow PowerShell Scripts (Process Scope) |
39 | | - run: | |
40 | | - Set-ExecutionPolicy RemoteSigned -Scope Process -Force |
41 | | -
|
42 | | - - name: Verify viewer-sikulix-main Exists |
43 | | - run: | |
44 | | - if (-Not (Test-Path -Path 'C:\viewer-sikulix-main')) { |
45 | | - Write-Host '❌ Error: viewer-sikulix not found on runner!' |
46 | | - exit 1 |
47 | | - } |
48 | | - Write-Host '✅ viewer-sikulix is already available.' |
49 | | -
|
50 | | - - name: Fetch & Download Windows Installer Artifact |
51 | | - shell: pwsh |
52 | | - run: | |
53 | | - $BUILD_ID = "${{ github.event.workflow_run.id }}" |
54 | | - $ARTIFACTS_URL = "https://api.github.com/repos/secondlife/viewer/actions/runs/$BUILD_ID/artifacts" |
55 | | -
|
56 | | - # Fetch the correct artifact URL |
57 | | - $response = Invoke-RestMethod -Headers @{Authorization="token ${{ secrets.GITHUB_TOKEN }}" } -Uri $ARTIFACTS_URL |
58 | | - $ARTIFACT_NAME = ($response.artifacts | Where-Object { $_.name -eq "Windows-installer" }).archive_download_url |
59 | | -
|
60 | | - if (-Not $ARTIFACT_NAME) { |
61 | | - Write-Host "❌ Error: Windows-installer artifact not found!" |
62 | | - exit 1 |
63 | | - } |
64 | | -
|
65 | | - Write-Host "✅ Artifact found: $ARTIFACT_NAME" |
66 | | -
|
67 | | - # Secure download path |
68 | | - $DownloadPath = "$env:TEMP\secondlife-build-$BUILD_ID" |
69 | | - New-Item -ItemType Directory -Path $DownloadPath -Force | Out-Null |
70 | | - $InstallerPath = "$DownloadPath\installer.zip" |
71 | | -
|
72 | | - # Download the ZIP |
73 | | - Invoke-WebRequest -Uri $ARTIFACT_NAME -Headers @{Authorization="token ${{ secrets.GITHUB_TOKEN }}"} -OutFile $InstallerPath |
74 | | -
|
75 | | - # Ensure download succeeded |
76 | | - if (-Not (Test-Path $InstallerPath)) { |
77 | | - Write-Host "❌ Error: Failed to download Windows-installer.zip" |
78 | | - exit 1 |
79 | | - } |
80 | | -
|
81 | | - - name: Extract Installer & Locate Executable |
82 | | - shell: pwsh |
83 | | - run: | |
84 | | - # Explicitly set BUILD_ID again (since it does not appear to persist across steps) |
85 | | - $BUILD_ID = "${{ github.event.workflow_run.id }}" |
86 | | - $ExtractPath = "$env:TEMP\secondlife-build-$BUILD_ID" |
87 | | - $InstallerZip = "$ExtractPath\installer.zip" |
88 | | -
|
89 | | - # Print paths for debugging |
90 | | - Write-Host "Extract Path: $ExtractPath" |
91 | | - Write-Host "Installer ZIP Path: $InstallerZip" |
92 | | -
|
93 | | - # Verify ZIP exists before extracting |
94 | | - if (-Not (Test-Path $InstallerZip)) { |
95 | | - Write-Host "❌ Error: ZIP file not found at $InstallerZip!" |
96 | | - exit 1 |
97 | | - } |
98 | | -
|
99 | | - Write-Host "✅ ZIP file exists and is valid. Extracting..." |
100 | | -
|
101 | | - Expand-Archive -Path $InstallerZip -DestinationPath $ExtractPath -Force |
102 | | -
|
103 | | - # Find installer executable |
104 | | - $INSTALLER_PATH = (Get-ChildItem -Path $ExtractPath -Filter '*.exe' -Recurse | Select-Object -First 1).FullName |
105 | | -
|
106 | | - if (-Not $INSTALLER_PATH -or $INSTALLER_PATH -eq "") { |
107 | | - Write-Host "❌ Error: No installer executable found in the extracted files!" |
108 | | - Write-Host "📂 Extracted Files:" |
109 | | - Get-ChildItem -Path $ExtractPath -Recurse | Format-Table -AutoSize |
110 | | - exit 1 |
111 | | - } |
112 | | -
|
113 | | - Write-Host "✅ Installer found: $INSTALLER_PATH" |
114 | | - echo "INSTALLER_PATH=$INSTALLER_PATH" | Out-File -FilePath $env:GITHUB_ENV -Append |
115 | | -
|
116 | | - - name: Install Second Life Using Task Scheduler (Bypass UAC) |
117 | | - shell: pwsh |
118 | | - run: | |
119 | | - $action = New-ScheduledTaskAction -Execute "${{ env.INSTALLER_PATH }}" -Argument "/S" |
120 | | - $principal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -LogonType ServiceAccount -RunLevel Highest |
121 | | - $task = New-ScheduledTask -Action $action -Principal $principal |
122 | | - Register-ScheduledTask -TaskName "SilentSLInstaller" -InputObject $task -Force |
123 | | - Start-ScheduledTask -TaskName "SilentSLInstaller" |
124 | | -
|
125 | | - - name: Wait for Installation to Complete |
126 | | - shell: pwsh |
127 | | - run: | |
128 | | - Write-Host "Waiting for the Second Life installer to finish..." |
129 | | - do { |
130 | | - Start-Sleep -Seconds 5 |
131 | | - $installerProcess = Get-Process | Where-Object { $_.Path -eq "${{ env.INSTALLER_PATH }}" } |
132 | | - } while ($installerProcess) |
133 | | -
|
134 | | - Write-Host "✅ Installation completed!" |
135 | | -
|
136 | | - - name: Cleanup Task Scheduler Entry |
137 | | - shell: pwsh |
138 | | - run: | |
139 | | - Unregister-ScheduledTask -TaskName "SilentSLInstaller" -Confirm:$false |
140 | | - Write-Host "✅ Task Scheduler entry removed." |
141 | | -
|
142 | | - - name: Delete Installer ZIP |
143 | | - shell: pwsh |
144 | | - run: | |
145 | | - # Explicitly set BUILD_ID again |
146 | | - $BUILD_ID = "${{ github.event.workflow_run.id }}" |
147 | | - $DeletePath = "$env:TEMP\secondlife-build-$BUILD_ID\installer.zip" |
148 | | -
|
149 | | - Write-Host "Checking if installer ZIP exists: $DeletePath" |
150 | | -
|
151 | | - # Ensure the ZIP file exists before trying to delete it |
152 | | - if (Test-Path $DeletePath) { |
153 | | - Remove-Item -Path $DeletePath -Force |
154 | | - Write-Host "✅ Successfully deleted: $DeletePath" |
155 | | - } else { |
156 | | - Write-Host "⚠️ Warning: ZIP file does not exist, skipping deletion." |
157 | | - } |
158 | | -
|
159 | | - - name: Run QA Test Script |
160 | | - run: | |
161 | | - Write-Host "Running QA Test script..." |
162 | | - python C:\viewer-sikulix-main\runTests.py |
163 | | -
|
164 | | - # - name: Upload Test Results |
165 | | - # uses: actions/upload-artifact@v3 |
166 | | - # with: |
167 | | - # name: test-results |
168 | | - # path: C:\viewer-sikulix-main\regressionTest\test_results.html |
| 1 | +name: Run QA Test # Runs automated tests on a self-hosted QA machine |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_run: |
| 5 | + workflows: ["Build"] |
| 6 | + types: |
| 7 | + - completed |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: qa-test-run |
| 11 | + cancel-in-progress: true # Cancels any queued job when a new one starts |
| 12 | + |
| 13 | +jobs: |
| 14 | + debug-workflow: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - name: Debug Workflow Variables |
| 18 | + run: | |
| 19 | + echo "Workflow Conclusion: ${{ github.event.workflow_run.conclusion }}" |
| 20 | + echo "Workflow Head Branch: ${{ github.event.workflow_run.head_branch }}" |
| 21 | + echo "Workflow Run ID: ${{ github.event.workflow_run.id }}" |
| 22 | + echo "Head Commit Message: ${{ github.event.workflow_run.head_commit.message }}" |
| 23 | + echo "GitHub Ref: ${{ github.ref }}" |
| 24 | + echo "GitHub Ref Name: ${{ github.ref_name }}" |
| 25 | + echo "GitHub Event Name: ${{ github.event_name }}" |
| 26 | + echo "GitHub Workflow Name: ${{ github.workflow }}" |
| 27 | +
|
| 28 | + install-viewer-and-run-tests: |
| 29 | + runs-on: [self-hosted, qa-machine] |
| 30 | + # Run test only on successful builds of Second_Life_X branches |
| 31 | + if: > |
| 32 | + github.event.workflow_run.conclusion == 'success' && |
| 33 | + ( |
| 34 | + startsWith(github.event.workflow_run.head_branch, 'Second_Life') |
| 35 | + ) |
| 36 | +
|
| 37 | + steps: |
| 38 | + - name: Temporarily Allow PowerShell Scripts (Process Scope) |
| 39 | + run: | |
| 40 | + Set-ExecutionPolicy RemoteSigned -Scope Process -Force |
| 41 | +
|
| 42 | + - name: Verify viewer-sikulix-main Exists |
| 43 | + run: | |
| 44 | + if (-Not (Test-Path -Path 'C:\viewer-sikulix-main')) { |
| 45 | + Write-Host '❌ Error: viewer-sikulix not found on runner!' |
| 46 | + exit 1 |
| 47 | + } |
| 48 | + Write-Host '✅ viewer-sikulix is already available.' |
| 49 | +
|
| 50 | + - name: Fetch & Download Windows Installer Artifact |
| 51 | + shell: pwsh |
| 52 | + run: | |
| 53 | + $BUILD_ID = "${{ github.event.workflow_run.id }}" |
| 54 | + $ARTIFACTS_URL = "https://api.github.com/repos/secondlife/viewer/actions/runs/$BUILD_ID/artifacts" |
| 55 | +
|
| 56 | + # Fetch the correct artifact URL |
| 57 | + $response = Invoke-RestMethod -Headers @{Authorization="token ${{ secrets.GITHUB_TOKEN }}" } -Uri $ARTIFACTS_URL |
| 58 | + $ARTIFACT_NAME = ($response.artifacts | Where-Object { $_.name -eq "Windows-installer" }).archive_download_url |
| 59 | +
|
| 60 | + if (-Not $ARTIFACT_NAME) { |
| 61 | + Write-Host "❌ Error: Windows-installer artifact not found!" |
| 62 | + exit 1 |
| 63 | + } |
| 64 | +
|
| 65 | + Write-Host "✅ Artifact found: $ARTIFACT_NAME" |
| 66 | +
|
| 67 | + # Secure download path |
| 68 | + $DownloadPath = "$env:TEMP\secondlife-build-$BUILD_ID" |
| 69 | + New-Item -ItemType Directory -Path $DownloadPath -Force | Out-Null |
| 70 | + $InstallerPath = "$DownloadPath\installer.zip" |
| 71 | +
|
| 72 | + # Download the ZIP |
| 73 | + Invoke-WebRequest -Uri $ARTIFACT_NAME -Headers @{Authorization="token ${{ secrets.GITHUB_TOKEN }}"} -OutFile $InstallerPath |
| 74 | +
|
| 75 | + # Ensure download succeeded |
| 76 | + if (-Not (Test-Path $InstallerPath)) { |
| 77 | + Write-Host "❌ Error: Failed to download Windows-installer.zip" |
| 78 | + exit 1 |
| 79 | + } |
| 80 | +
|
| 81 | + - name: Extract Installer & Locate Executable |
| 82 | + shell: pwsh |
| 83 | + run: | |
| 84 | + # Explicitly set BUILD_ID again (since it does not appear to persist across steps) |
| 85 | + $BUILD_ID = "${{ github.event.workflow_run.id }}" |
| 86 | + $ExtractPath = "$env:TEMP\secondlife-build-$BUILD_ID" |
| 87 | + $InstallerZip = "$ExtractPath\installer.zip" |
| 88 | +
|
| 89 | + # Print paths for debugging |
| 90 | + Write-Host "Extract Path: $ExtractPath" |
| 91 | + Write-Host "Installer ZIP Path: $InstallerZip" |
| 92 | +
|
| 93 | + # Verify ZIP exists before extracting |
| 94 | + if (-Not (Test-Path $InstallerZip)) { |
| 95 | + Write-Host "❌ Error: ZIP file not found at $InstallerZip!" |
| 96 | + exit 1 |
| 97 | + } |
| 98 | +
|
| 99 | + Write-Host "✅ ZIP file exists and is valid. Extracting..." |
| 100 | +
|
| 101 | + Expand-Archive -Path $InstallerZip -DestinationPath $ExtractPath -Force |
| 102 | +
|
| 103 | + # Find installer executable |
| 104 | + $INSTALLER_PATH = (Get-ChildItem -Path $ExtractPath -Filter '*.exe' -Recurse | Select-Object -First 1).FullName |
| 105 | +
|
| 106 | + if (-Not $INSTALLER_PATH -or $INSTALLER_PATH -eq "") { |
| 107 | + Write-Host "❌ Error: No installer executable found in the extracted files!" |
| 108 | + Write-Host "📂 Extracted Files:" |
| 109 | + Get-ChildItem -Path $ExtractPath -Recurse | Format-Table -AutoSize |
| 110 | + exit 1 |
| 111 | + } |
| 112 | +
|
| 113 | + Write-Host "✅ Installer found: $INSTALLER_PATH" |
| 114 | + echo "INSTALLER_PATH=$INSTALLER_PATH" | Out-File -FilePath $env:GITHUB_ENV -Append |
| 115 | +
|
| 116 | + - name: Install Second Life Using Task Scheduler (Bypass UAC) |
| 117 | + shell: pwsh |
| 118 | + run: | |
| 119 | + $action = New-ScheduledTaskAction -Execute "${{ env.INSTALLER_PATH }}" -Argument "/S" |
| 120 | + $principal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -LogonType ServiceAccount -RunLevel Highest |
| 121 | + $task = New-ScheduledTask -Action $action -Principal $principal |
| 122 | + Register-ScheduledTask -TaskName "SilentSLInstaller" -InputObject $task -Force |
| 123 | + Start-ScheduledTask -TaskName "SilentSLInstaller" |
| 124 | +
|
| 125 | + - name: Wait for Installation to Complete |
| 126 | + shell: pwsh |
| 127 | + run: | |
| 128 | + Write-Host "Waiting for the Second Life installer to finish..." |
| 129 | + do { |
| 130 | + Start-Sleep -Seconds 5 |
| 131 | + $installerProcess = Get-Process | Where-Object { $_.Path -eq "${{ env.INSTALLER_PATH }}" } |
| 132 | + } while ($installerProcess) |
| 133 | +
|
| 134 | + Write-Host "✅ Installation completed!" |
| 135 | +
|
| 136 | + - name: Cleanup Task Scheduler Entry |
| 137 | + shell: pwsh |
| 138 | + run: | |
| 139 | + Unregister-ScheduledTask -TaskName "SilentSLInstaller" -Confirm:$false |
| 140 | + Write-Host "✅ Task Scheduler entry removed." |
| 141 | +
|
| 142 | + - name: Delete Installer ZIP |
| 143 | + shell: pwsh |
| 144 | + run: | |
| 145 | + # Explicitly set BUILD_ID again |
| 146 | + $BUILD_ID = "${{ github.event.workflow_run.id }}" |
| 147 | + $DeletePath = "$env:TEMP\secondlife-build-$BUILD_ID\installer.zip" |
| 148 | +
|
| 149 | + Write-Host "Checking if installer ZIP exists: $DeletePath" |
| 150 | +
|
| 151 | + # Ensure the ZIP file exists before trying to delete it |
| 152 | + if (Test-Path $DeletePath) { |
| 153 | + Remove-Item -Path $DeletePath -Force |
| 154 | + Write-Host "✅ Successfully deleted: $DeletePath" |
| 155 | + } else { |
| 156 | + Write-Host "⚠️ Warning: ZIP file does not exist, skipping deletion." |
| 157 | + } |
| 158 | +
|
| 159 | + - name: Run QA Test Script |
| 160 | + run: | |
| 161 | + Write-Host "Running QA Test script..." |
| 162 | + python C:\viewer-sikulix-main\runTests.py |
| 163 | +
|
| 164 | + # - name: Upload Test Results |
| 165 | + # uses: actions/upload-artifact@v3 |
| 166 | + # with: |
| 167 | + # name: test-results |
| 168 | + # path: C:\viewer-sikulix-main\regressionTest\test_results.html |
0 commit comments