-
Notifications
You must be signed in to change notification settings - Fork 3
144 lines (121 loc) · 4.37 KB
/
Copy pathpython.yml
File metadata and controls
144 lines (121 loc) · 4.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Build and Publish
on:
push:
tags:
- "v*"
pull_request:
branches:
- main
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/cibuildwheel@v2.16.5
env:
# 1. CONFIGURATION
CIBW_BUILD: "cp312-* cp313-*"
# Skip 32-bit builds
CIBW_ARCHS: "auto64"
# 2. LINUX
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_MUSLLINUX_X86_64_IMAGE: musllinux_1_2
# Install deps
CIBW_BEFORE_ALL_MANYLINUX_X86_64: "yum install -y openblas-devel pkgconf-pkg-config gcc-toolset-11"
CIBW_BEFORE_ALL_MUSLLINUX_X86_64: "apk add --no-cache openblas-dev pkgconfig g++"
CIBW_ENVIRONMENT_LINUX: 'PATH="/opt/rh/gcc-toolset-11/root/usr/bin:$PATH"'
# 3. MACOS
CIBW_BEFORE_ALL_MACOS: "brew install openblas pkg-config"
# Help the compiler find OpenBLAS on Mac
CIBW_ENVIRONMENT_MACOS: >
PKG_CONFIG_PATH="/usr/local/opt/openblas/lib/pkgconfig:/opt/homebrew/opt/openblas/lib/pkgconfig"
LDFLAGS="-L/usr/local/opt/openblas/lib -L/opt/homebrew/opt/openblas/lib"
CPPFLAGS="-I/usr/local/opt/openblas/include -I/opt/homebrew/opt/openblas/include"
# 4. TESTING
CIBW_TEST_REQUIRES: "pytest pytest-mock spacy"
CIBW_TEST_REQUIRES_WINDOWS: "pytest pytest-mock spacy MetaTrader5"
CIBW_TEST_COMMAND: "pip install -e {project} && python -m spacy download en_core_web_sm && pytest {project}/tests -k 'not test_metatrader_client'"
CIBW_TEST_COMMAND_WINDOWS: "pip install -e {project} && python -m spacy download en_core_web_sm && pytest {project}/tests -k \"not test_metatrader_client\""
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build Source Distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build SDist
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
build_installer:
name: Build Windows Installer
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install dependencies
run: |
pip install pyinstaller
pip install .[MT5]
- name: Build executable
run: pyinstaller tcopier.spec
- name: Replace version in Inno Setup script
run: |
$version = "${{ github.ref_name }}".Substring(1)
(Get-Content tcopier.iss) -replace '__VERSION__', $version | Set-Content tcopier.iss
- name: Install Inno Setup (via Chocolatey)
run: |
choco install innosetup --no-progress
echo "C:\Program Files (x86)\Inno Setup 6" >> $env:GITHUB_PATH
- name: Compile installer
run: iscc tcopier.iss
- name: Upload installer artifact
uses: actions/upload-artifact@v4
with:
name: installer
path: "**/TradeCopier.exe"
publish:
needs: [build_wheels, build_sdist, build_installer]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.BBSTRADER_PYPI_API_TOKEN }}
release:
name: Create GitHub Release
needs: [publish]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: dist/*