Skip to content

configuration

configuration #66

name: Test | MetaTrader5 Integration Test
on: [push]
jobs:
build:
strategy:
matrix:
os: [windows-latest, windows-2022]
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: Copy MT5 configuration
run: |
# Ensure the config folder exists and copy the saved config files
Copy-Item -Path ".github/mt5-config/*" -Destination ".\MetaTrader 5\config" -Recurse -Force
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 15
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