Skip to content

Commit

Permalink
fixing run_ci.bat path
Browse files Browse the repository at this point in the history
  • Loading branch information
ksuchitra532 committed Jan 23, 2025
1 parent efa6e99 commit 88df489
Showing 1 changed file with 27 additions and 19 deletions.
46 changes: 27 additions & 19 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,35 @@ jobs:
shell: cmd
- name: Testing on PR
run: |
$startTime = Get-Date
$timeoutMinutes = 5
$maxTime = $startTime.AddMinutes($timeoutMinutes)
@echo on
setlocal enabledelayedexpansion
set "startTime=%time%"
set "timeoutMinutes=5"
echo Starting build...
Write-Host "Starting build..."
run_ci.bat ${{ github.workspace }}/../../configs/${{ github.event.inputs.CONFIG_FILE }} ${{ github.event.inputs.RSS_Feed }} ${{ github.event.inputs.EXTRA_PARAMS }}
# Monitor process for looping
while ($true) {
if ((Get-Date) -gt $maxTime) {
# If looping exceeds 5 minutes, send a Slack notification and exit
$slackPayload = @{
text = "Build is stuck in a loop for more than 5 minutes. Exiting process."
} | ConvertTo-Json -Depth 10
Invoke-RestMethod -Uri "${{ secrets.SLACK_WEBHOOK_URL }}" -Method POST -ContentType "application/json" -Body $slackPayload
throw "Test Framework Build exceeded the 5-minute timeout and was terminated."
}
Start-Sleep -Seconds 10 # Check every 10 seconds
}
start "" /b run_ci.bat C:\GM-TestFramework\configs\${{ github.event.inputs.CONFIG_FILE }} ${{ github.event.inputs.RSS_Feed }} ${{ github.event.inputs.EXTRA_PARAMS }}
set /a "timeoutSeconds=timeoutMinutes*60"
set "elapsedTime=0"
:loop
timeout /t 10 >nul
set /a "elapsedTime+=10"
if !elapsedTime! geq !timeoutSeconds! (
echo Build is stuck in a loop for more than %timeoutMinutes% minutes. Exiting process.
powershell -Command "Invoke-RestMethod -Uri '%SLACK_WEBHOOK_URL%' -Method POST -ContentType 'application/json' -Body '{\"text\":\"Build is stuck in a loop for more than %timeoutMinutes% minutes. Exiting process.\"}'"
taskkill /im run_ci.bat /f
exit /b 1
)
tasklist /fi "imagename eq run_ci.bat" | find /i "run_ci.bat" >nul
if errorlevel 1 (
echo Build completed successfully.
exit /b 0
)
goto :loop
shell: cmd
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
working-directory: GM-TF
shell: pwsh
- name: Upload Results Artifacts
if: always()
uses: actions/upload-artifact@v4
Expand Down

0 comments on commit 88df489

Please sign in to comment.