Skip to content

Commit e55f648

Browse files
committed
Add some github workflows, needs cleaning
1 parent f2de83c commit e55f648

File tree

4 files changed

+113
-0
lines changed

4 files changed

+113
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Deploy | Semantic Release
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
jobs:
8+
release:
9+
runs-on: windows-latest
10+
concurrency: release
11+
permissions:
12+
contents: write
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Python Release
21+
uses: python-semantic-release/python-semantic-release@v9.20.0
22+
with:
23+
github_token: ${{ secrets.GITHUB_TOKEN }}
24+
push: "true"
25+
changelog: "true"
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Test |Test MetaTrader5 Integration
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: windows-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.11'
20+
21+
- name: Download MetaTrader 5
22+
run: |
23+
Invoke-WebRequest -Uri "https://download.mql5.com/cdn/web/metaquotes.software.corp/mt5/mt5setup.exe" -OutFile mt5setup.exe
24+
25+
- name: Install MetaTrader 5 silently
26+
run: |
27+
Start-Process -FilePath .\mt5setup.exe -ArgumentList "/auto" -Wait
28+
29+
- name: Install Python dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install MetaTrader5
33+
34+
- name: Test MetaTrader5 connection
35+
run: |
36+
python tests/integration/test_mt5_connection.py
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Test | Pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
pre-commit:
11+
permissions: write-all
12+
runs-on: windows-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Run Pre-commit
19+
uses: pre-commit/action@v3.0.1
20+
with:
21+
extra_args: --all-files
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import os
2+
import sys
3+
import MetaTrader5 as mt5
4+
5+
def test_mt5_connection():
6+
"""Test basic connection to MetaTrader 5 terminal."""
7+
8+
print(f"MetaTrader5 package version: {mt5.__version__}")
9+
10+
# Initialize MetaTrader 5
11+
if not mt5.initialize():
12+
print(f"initialize() failed, error code = {mt5.last_error()}")
13+
sys.exit(1)
14+
15+
print(mt5.terminal_info())
16+
print(f"MetaTrader5 terminal copyright: {mt5.terminal_info().copyright}")
17+
print(f"MetaTrader5 terminal name: {mt5.terminal_info().name}")
18+
print(f"MetaTrader5 terminal path: {mt5.terminal_info().path}")
19+
20+
authorized = mt5.login()
21+
if authorized:
22+
print(f"Connected to account: {mt5.account_info().login}")
23+
print(f"Balance: {mt5.account_info().balance}")
24+
25+
mt5.shutdown()
26+
27+
print("Test completed successfully")
28+
return True
29+
30+
if __name__ == "__main__":
31+
test_mt5_connection()

0 commit comments

Comments
 (0)