Skip to content

2025

2025 #67

name: Test | MetaTrader5 Integration Test
on: [push]
jobs:
build:
strategy:
matrix:
os: [windows-latest, windows-2025]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Download MetaTrader5 Installer
run: |
Invoke-WebRequest `
-Uri "https://download.mql5.com/cdn/web/metaquotes.software.corp/mt5/mt5setup.exe" `
-OutFile "mt5setup.exe"
shell: pwsh
- name: Install MetaTrader5
run: |
$process = Start-Process -FilePath ".\mt5setup.exe" -ArgumentList "/auto", "/portable" -PassThru
$process.WaitForExit(300000) # Wait for up to 5 minutes
if (-not $process.HasExited) {
Write-Host "MT5 installer stuck, killing..."
Stop-Process -Id $process.Id -Force
exit 1
}
shell: pwsh
- name: Kill any existing MT5 processes
run: |
Get-Process terminal64 -ErrorAction SilentlyContinue | Stop-Process -Force
shell: pwsh
- name: Launch MetaTrader5 Terminal in portable mode
run: |
$mt5Paths = @(
"C:\Program Files\MetaTrader 5\terminal64.exe",
".\MetaTrader 5\terminal64.exe",
".\MetaTrader5\terminal64.exe"
)
foreach ($path in $mt5Paths) {
if (Test-Path $path) {
Start-Process -FilePath $path -ArgumentList "/portable" -WindowStyle Hidden
Write-Host "Launched MT5 from $path"
break
}
}
Start-Sleep -Seconds 30 # Increase wait time for MT5 to fully launch
shell: pwsh
- name: Check MT5 process running
run: |
Get-Process terminal64 -ErrorAction Stop
shell: pwsh
- name: Install MetaTrader5 Python package
run: pip install MetaTrader5
- name: Run MT5 test script
run: python tests/integration/test_mt5_connection.py