time out #51
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 Integration Test | |
| on: [push] | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| 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: | | |
| # Start installer with /auto and /portable, with timeout protection | |
| $process = Start-Process -FilePath ".\mt5setup.exe" -ArgumentList "/auto", "/portable" -PassThru | |
| $process.WaitForExit(300000) # Wait max 5 minutes | |
| if (-not $process.HasExited) { | |
| Write-Host "MT5 installer stuck, killing..." | |
| Stop-Process -Id $process.Id -Force | |
| exit 1 | |
| } | |
| shell: powershell | |
| - name: Kill any existing MT5 processes | |
| run: | | |
| Get-Process terminal64 -ErrorAction SilentlyContinue | Stop-Process -Force | |
| shell: powershell | |
| - name: Launch MetaTrader5 Terminal in portable mode | |
| run: | | |
| Start-Process "C:\Program Files\MetaTrader 5\terminal64.exe" -ArgumentList "/portable" | |
| Start-Sleep -Seconds 15 | |
| shell: powershell | |
| - name: Install MetaTrader5 Python package | |
| run: pip install MetaTrader5 | |
| - name: Run your Python script | |
| run: | | |
| python - << 'EOF' | |
| import MetaTrader5 as mt5 | |
| if not mt5.initialize(path=r"C:/Program Files/MetaTrader 5/terminal64.exe", timeout=300000): | |
| print("initialize() failed, error code:", mt5.last_error()) | |
| exit(1) | |
| # Example: print account info | |
| print(mt5.account_info()) | |
| mt5.shutdown() | |
| EOF | |
| shell: pwsh |