Pre-commit indicator_connector.py part 1 #6
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 |Test MetaTrader5 Integration | |
| on: | |
| push: | |
| branches: ['*'] # <<<<<<<<<<<<<<<<<<<<<<<<<< Return to main before merging | |
| pull_request: | |
| jobs: | |
| test: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Download MetaTrader 5 | |
| run: | | |
| Invoke-WebRequest -Uri "https://download.mql5.com/cdn/web/metaquotes.software.corp/mt5/mt5setup.exe" -OutFile mt5setup.exe | |
| # Verify download was successful | |
| if (!(Test-Path "mt5setup.exe")) { | |
| Write-Error "MetaTrader 5 download failed." | |
| exit 1 | |
| } | |
| - name: Install MetaTrader 5 silently | |
| run: | | |
| Start-Process -FilePath .\mt5setup.exe -ArgumentList "/auto" -Wait | |
| # Give installation some time to complete | |
| Start-Sleep -Seconds 60 | |
| - name: Verify MetaTrader 5 Installation and Start Terminal | |
| run: | | |
| $mtPath = "C:\Program Files\MetaTrader 5\terminal64.exe" | |
| if (!(Test-Path $mtPath)) { | |
| Write-Error "MetaTrader 5 installation failed. Terminal executable not found." | |
| exit 1 | |
| } | |
| Write-Host "MetaTrader 5 found at: $mtPath" | |
| # List installation directory contents for debugging | |
| Write-Host "Listing MetaTrader 5 installation directory:" | |
| Get-ChildItem "C:\Program Files\MetaTrader 5" | |
| # Start MT5 terminal and give it time to initialize | |
| Start-Process -FilePath $mtPath -ArgumentList "/portable" -PassThru | |
| Write-Host "Started MetaTrader 5 terminal" | |
| Start-Sleep -Seconds 30 | |
| # Verify MT5 process is running | |
| $process = Get-Process "terminal64" -ErrorAction SilentlyContinue | |
| if ($process) { | |
| Write-Host "MetaTrader 5 terminal is running with PID: $($process.Id)" | |
| } else { | |
| Write-Error "MetaTrader 5 terminal is not running." | |
| } | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install MetaTrader5 | |
| - name: Test MetaTrader5 connection | |
| run: | | |
| # Print environment information | |
| Write-Host "Environment variables:" | |
| Get-ChildItem Env: | Format-Table -AutoSize | |
| # Run the test with diagnostic info | |
| python tests/integration/test_mt5_connection.py |