Skip to content

Commit 087ecff

Browse files
authored
refactor: Re-arrange the project to make improvements (#34)
### Description This PR adds a few things: - [x] Documentation page - [x] Pre-commit CI - [ ] Pytest CI - [x] Integration test CI Fixes #29 This is a breaking changes.
1 parent 63de899 commit 087ecff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+4840
-1248
lines changed

.codespell-ignore

Whitespace-only changes.

.github/ISSUE_TEMPLATE/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ body:
1010
label: "Where?"
1111
description: "Provide path from the root of the repository."
1212
placeholder: "mqpy/"
13-
13+
1414
- type: textarea
1515
id: requested_change
1616
attributes:

.github/ISSUE_TEMPLATE/feat.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ body:
1616
attributes:
1717
label: Task Description
1818
description: Provide a clear and concise description of what needs to be done.
19-
placeholder: Describe the problem or proposed solution.
19+
placeholder: Describe the problem or proposed solution.

.github/ISSUE_TEMPLATE/perf.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,3 @@ body:
1717
label: Area for Performance Improvement
1818
description: Specify the part of the codebase or system that requires optimization. Explain why it needs improvement and describe the current performance issue as the proposed solution.
1919
placeholder: e.g., "The sorting algorithm in module X is slow when handling large datasets."
20-

.github/workflows/deploy-mkdocs.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Deploy | Deploy MkDocs
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: ['main']
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
jobs:
14+
deploy:
15+
runs-on: windows-latest
16+
environment:
17+
name: github-pages
18+
url: ${{ steps.deployment.outputs.page_url }}
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Install uv and set the python version
24+
uses: astral-sh/setup-uv@v5
25+
with:
26+
python-version: "3.11"
27+
28+
- name: Install the project
29+
run: uv sync --locked --group docs
30+
31+
- name: Build MkDocs
32+
run: mkdocs build --site-dir ./deploy
33+
34+
- name: Setup Pages
35+
uses: actions/configure-pages@v4
36+
37+
- name: Upload artifact
38+
uses: actions/upload-pages-artifact@v3
39+
with:
40+
path: './deploy'
41+
42+
- name: Deploy to GitHub Pages
43+
id: deployment
44+
uses: actions/deploy-pages@v4
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Deploy | Semantic Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
release:
8+
runs-on: windows-latest
9+
concurrency: release
10+
permissions:
11+
contents: write
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Python Release
20+
uses: python-semantic-release/python-semantic-release@v9.20.0
21+
with:
22+
github_token: ${{ secrets.GITHUB_TOKEN }}
23+
push: "true"
24+
changelog: "true"

.github/workflows/deploy.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ name: Publish distributions
22

33
on:
44
push:
5-
branches:
6-
- '*'
5+
branches: ['main']
76
tags:
87
- v*
98

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Test | Integration Test
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: windows-latest
8+
timeout-minutes: 15
9+
steps:
10+
- name: Checkout repository
11+
uses: actions/checkout@v4
12+
13+
- name: Set up Python
14+
uses: actions/setup-python@v4
15+
with:
16+
python-version: '3.11'
17+
18+
- name: Download MetaTrader5 Installer
19+
shell: pwsh
20+
run: |
21+
$url = "https://download.mql5.com/cdn/web/metaquotes.software.corp/mt5/mt5setup.exe"
22+
$output = "$env:GITHUB_WORKSPACE\mt5setup.exe"
23+
Invoke-WebRequest -Uri $url -OutFile $output
24+
Write-Host "Download completed. File size: $((Get-Item $output).Length) bytes"
25+
26+
- name: Install MetaTrader5
27+
run: |
28+
$process = Start-Process -FilePath ".\mt5setup.exe" -ArgumentList "/auto", "/portable" -PassThru
29+
$process.WaitForExit(300000)
30+
if (-not $process.HasExited) {
31+
Write-Host "MT5 installer stuck, killing..."
32+
Stop-Process -Id $process.Id -Force
33+
exit 1
34+
}
35+
shell: pwsh
36+
37+
- name: Launch MT5
38+
shell: pwsh
39+
run: |
40+
$mt5Path = Resolve-Path "C:\Program Files\MetaTrader 5\terminal64.exe"
41+
42+
# Launch with diagnostics
43+
Start-Process $mt5Path -ArgumentList @(
44+
"/portable",
45+
"/headless",
46+
"/config:config",
47+
"/noreport"
48+
) -NoNewWindow
49+
50+
# Verify process start
51+
$attempts = 0
52+
while ($attempts -lt 10) {
53+
if (Get-Process terminal64 -ErrorAction SilentlyContinue) {
54+
Write-Host "MT5 process detected"
55+
break
56+
}
57+
$attempts++
58+
Start-Sleep 5
59+
}
60+
61+
if (-not (Get-Process terminal64 -ErrorAction SilentlyContinue)) {
62+
Get-Content ".\MetaTrader 5\logs\*.log" | Write-Host
63+
throw "MT5 failed to start"
64+
}
65+
66+
- name: Install MetaTrader5 Python package
67+
run: pip install MetaTrader5
68+
69+
- name: Run MT5 Test
70+
env:
71+
MT5_LOGIN: ${{ secrets.MT5_LOGIN }}
72+
MT5_PASSWORD: ${{ secrets.MT5_PASSWORD }}
73+
MT5_SERVER: "MetaQuotes-Demo"
74+
MT5_PATH: "C:\\Program Files\\MetaTrader 5\\terminal64.exe"
75+
run: |
76+
python tests/integration/test_mt5_connection.py
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Test | Pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: ['*']
7+
8+
jobs:
9+
pre-commit:
10+
permissions: write-all
11+
runs-on: windows-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Run Pre-commit
18+
uses: pre-commit/action@v3.0.1
19+
with:
20+
extra_args: --all-files

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
.env
2-
*.pyc
2+
*.pyc

0 commit comments

Comments
 (0)