Skip to content

Commit 056d7f5

Browse files
committed
with config
1 parent 9ecad41 commit 056d7f5

File tree

1 file changed

+11
-23
lines changed

1 file changed

+11
-23
lines changed

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

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -67,36 +67,24 @@ jobs:
6767
- name: Install MetaTrader5 Python package
6868
run: pip install MetaTrader5
6969

70-
- name: Run MT5 Test
70+
- name: Configure Server for MT5 (Headless)
7171
shell: pwsh
7272
run: |
73-
$mt5Path = Resolve-Path "C:\Program Files\MetaTrader 5\terminal64.exe"
74-
75-
# Launch with diagnostics
76-
Start-Process $mt5Path -ArgumentList @(
77-
"/portable",
78-
"/headless",
79-
"/config:config",
80-
"/noreport"
81-
) -NoNewWindow
82-
83-
# Verify process start
84-
$attempts = 0
85-
while ($attempts -lt 10) {
86-
if (Get-Process terminal64 -ErrorAction SilentlyContinue) {
87-
Write-Host "MT5 process detected"
88-
break
89-
}
90-
$attempts++
91-
Start-Sleep 5
92-
}
73+
$configPath = ".\MetaTrader 5\config"; New-Item -Path $configPath -ItemType Directory -Force; $serverConfig = @"FreeDemoServer,Demo,demo.server.com,443"@; Set-Content "$configPath\servers.dat" -Value $serverConfig; $accountConfig = @"demouser,demo_password,demo.server.com,443"@; Set-Content "$configPath\accounts.dat" -Value $accountConfig
9374
75+
- name: Launch MT5 Headless
76+
shell: pwsh
77+
run: |
78+
$mt5Path = Resolve-Path "C:\Program Files\MetaTrader 5\terminal64.exe"
79+
Start-Process $mt5Path -ArgumentList @("/portable", "/headless", "/config:config", "/noreport") -NoNewWindow
80+
Start-Sleep -Seconds 15
9481
if (-not (Get-Process terminal64 -ErrorAction SilentlyContinue)) {
95-
Get-Content ".\MetaTrader 5\logs\*.log" | Write-Host
9682
throw "MT5 failed to start"
9783
}
9884
99-
85+
- name: Run MT5 Test
86+
shell: pwsh
87+
run: |
10088
python -c "import os, MetaTrader5 as mt5
10189
print('Python version:', os.sys.version)
10290
print('MetaTrader5 version:', mt5.__version__)

0 commit comments

Comments
 (0)