Skip to content

Commit 1cf8486

Browse files
committed
different version
1 parent ff0d647 commit 1cf8486

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

.github/workflows/test-metatrader5-integration.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,34 @@ jobs:
2525
run: |
2626
# Start installer with /auto and /portable, with timeout protection
2727
$process = Start-Process -FilePath ".\mt5setup.exe" -ArgumentList "/auto", "/portable" -PassThru
28-
$process.WaitForExit(300000) # Wait max 5 minutes
28+
$process.WaitForExit(300) # 300 seconds = 5 minutes
2929
if (-not $process.HasExited) {
3030
Write-Host "MT5 installer stuck, killing..."
3131
Stop-Process -Id $process.Id -Force
3232
exit 1
3333
}
34-
shell: powershell
34+
shell: pwsh
3535

3636
- name: Kill any existing MT5 processes
3737
run: |
3838
Get-Process terminal64 -ErrorAction SilentlyContinue | Stop-Process -Force
39-
shell: powershell
39+
shell: pwsh
4040

4141
- name: Launch MetaTrader5 Terminal in portable mode
4242
run: |
43-
Start-Process "C:\Program Files\MetaTrader 5\terminal64.exe" -ArgumentList "/portable"
43+
$mt5Paths = @(
44+
"C:\Program Files\MetaTrader 5\terminal64.exe",
45+
".\MetaTrader 5\terminal64.exe"
46+
)
47+
foreach ($path in $mt5Paths) {
48+
if (Test-Path $path) {
49+
Start-Process -FilePath $path -ArgumentList "/portable"
50+
Write-Host "Launched MT5 from $path"
51+
break
52+
}
53+
}
4454
Start-Sleep -Seconds 15
45-
shell: powershell
55+
shell: pwsh
4656

4757
- name: Install MetaTrader5 Python package
4858
run: pip install MetaTrader5
@@ -51,13 +61,16 @@ jobs:
5161
run: |
5262
python -c "
5363
import MetaTrader5 as mt5
64+
import time
65+
5466
print('Testing MT5 initialization...')
67+
time.sleep(5) # Extra sleep to ensure MT5 ready
68+
5569
if not mt5.initialize():
5670
print('Failed to initialize:', mt5.last_error())
5771
exit(1)
5872
else:
5973
print('MT5 initialized successfully')
6074
mt5.shutdown()
61-
"
75+
"
6276
shell: pwsh
63-

0 commit comments

Comments
 (0)