test integration test #13
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test MetaTrader5 Initialization | |
| on: | |
| push: | |
| branches: ['*'] | |
| pull_request: | |
| jobs: | |
| test: | |
| runs-on: windows-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Download and Install MetaTrader 5 | |
| run: | | |
| # Download MT5 setup | |
| Invoke-WebRequest -Uri "https://download.mql5.com/cdn/web/metaquotes.software.corp/mt5/mt5setup.exe" -OutFile mt5setup.exe | |
| # Install MT5 silently with increased timeout | |
| Start-Process -FilePath .\mt5setup.exe -ArgumentList "/auto" -Wait | |
| # Verify installation and attempt to fix any issues | |
| $mtPath = "C:\Program Files\MetaTrader 5\terminal64.exe" | |
| if (Test-Path $mtPath) { | |
| Write-Host "MetaTrader 5 installed successfully" | |
| Write-Host "MetaTrader 5 found at: $mtPath" | |
| # Set explicit permissions to ensure we can access files | |
| icacls "C:\Program Files\MetaTrader 5" /grant:r "Everyone:(OI)(CI)F" /T | |
| # Set up environment for headless operation | |
| $terminalDir = "$env:APPDATA\MetaQuotes\Terminal" | |
| if (!(Test-Path $terminalDir)) { | |
| New-Item -Path $terminalDir -ItemType Directory -Force | |
| Write-Host "Created terminal directory: $terminalDir" | |
| } | |
| # List installation directory for debugging | |
| Write-Host "Listing MetaTrader 5 installation directory:" | |
| Get-ChildItem "C:\Program Files\MetaTrader 5" | |
| } else { | |
| Write-Error "MetaTrader 5 installation failed" | |
| exit 1 | |
| } | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install MetaTrader5 | |
| - name: Run headless MetaTrader5 initialization test | |
| env: | |
| # Set any environment variables that might help with headless mode | |
| MT5_HEADLESS: "1" | |
| run: | | |
| # Check running processes before test | |
| Write-Host "Currently running processes before test:" | |
| Get-Process | Where-Object { $_.ProcessName -like "*terminal*" -or $_.ProcessName -like "*meta*" } | Format-Table -AutoSize | |
| # Run the headless initialization test | |
| python tests/integration/test_headless_initialize.py | |
| # Store the exit code | |
| $exitCode = $LASTEXITCODE | |
| # Check processes after test | |
| Write-Host "Currently running processes after test:" | |
| Get-Process | Where-Object { $_.ProcessName -like "*terminal*" -or $_.ProcessName -like "*meta*" } | Format-Table -AutoSize | |
| # Return the exit code from the test | |
| exit $exitCode | |