forked from Drakkar-Software/OctoBot
-
Notifications
You must be signed in to change notification settings - Fork 0
253 lines (220 loc) · 7.84 KB
/
main.yml
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
name: OctoBot-CI
on:
push:
branches:
- 'master'
- 'dev'
tags:
- '*'
pull_request:
jobs:
lint:
name: ubuntu-latest - Python 3.8 - lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: '3.8.x'
architecture: 'x64'
- name: Install dependencies
run: pip install wheel && pip install --prefer-binary -r dev_requirements.txt -r requirements.txt
# - name: Black lint
# run: black ${{ secrets.PACKAGE_FOLDER }} --diff --check
- name: Pylint
run: |
pylint --rcfile=standard.rc octobot
if [ $? -ne 1 ]; then exit 0; fi
tests:
needs: lint
name: ${{ matrix.os }}${{ matrix.arch }} - Python 3.8 - ${{ matrix.type }} - tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
arch: [ x64 ]
type: [sources, cython]
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: '3.8.x'
architecture: ${{ matrix.arch }}
- name: Wait for tentacles
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: fountainhead/action-wait-for-check@v1.0.0
id: wait-for-build
with:
token: ${{ secrets.AUTH_TOKEN }}
checkName: "ubuntu-latest - Python 3.8 - upload tentacles"
ref: ${{ github.ref }}
repo: OctoBot-Tentacles
timeoutSeconds: 3600
- name: Trigger fail when Tentacles failed
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && steps.wait-for-build.outputs.conclusion == 'failure'
run: exit 1
- name: Install dependencies
run: pip install wheel && pip install --prefer-binary -r dev_requirements.txt -r requirements.txt
- name: Install tentacles on Unix
env:
DISABLE_SENTRY: True
if: matrix.os != 'windows-latest'
run: |
mkdir user
cp ./octobot/config/default_config.json ./user/config.json
branch="${GITHUB_HEAD_REF}"
echo "Trying to download tentacles package ${branch////_}.zip ..."
TENTACLES_REPOSITORY=dev-tentacles TENTACLES_URL_TAG=${branch////_} python3 start.py tentacles -q --install --all || TENTACLES_URL_TAG=latest python3 start.py tentacles --install --all
- name: Install tentacles on Windows
env:
DISABLE_SENTRY: True
if: matrix.os == 'windows-latest'
run: |
mkdir user
copy octobot\config\default_config.json user\config.json
$Env:TENTACLES_REPOSITORY = "dev-tentacles"
$Env:TENTACLES_URL_TAG = $env:GITHUB_HEAD_REF -replace "/", "_"
echo "Trying to download tentacles package $Env:TENTACLES_URL_TAG.zip ..."
python start.py tentacles -q --install --all
if ($LastExitCode -ne 0)
{
$Env:TENTACLES_URL_SUBCATEGORY = ""
If ($env:GITHUB_REF -like "*refs/tags/*") {
$Env:TENTACLES_URL_TAG = ""
$Env:TENTACLES_REPOSITORY = ""
} else {
$Env:TENTACLES_URL_TAG = "latest"
$Env:TENTACLES_REPOSITORY = ""
}
echo "Failed to download branch tentacles, trying to download tentacles package $Env:TENTACLES_URL_TAG.zip ..."
python start.py tentacles --install --all
}
shell: powershell
- name: Compile project
env:
DISABLE_SENTRY: True
if: matrix.type == 'cython'
run: |
python setup.py install
- name: Pytests
if: matrix.type == 'cython'
env:
CYTHON_IGNORE: true
DISABLE_SENTRY: True
run: |
pytest --cov=. --cov-config=.coveragerc --durations=0 -rw tests
pytest --durations=0 -rw --ignore=tentacles/Trading/Exchange tentacles
- name: Pytests
env:
DISABLE_SENTRY: True
if: matrix.type != 'cython'
run: |
pytest --cov=. --cov-config=.coveragerc --durations=0 -rw tests
pytest --durations=0 -rw --ignore=tentacles/Trading/Exchange tentacles
- name: Publish coverage
if: matrix.type == 'sources' && github.event_name == 'push'
run: coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build_wheels:
needs: tests
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
name: ${{ matrix.os }}-${{ matrix.arch }} - Python 3.8 - deploy
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
arch: [ x64 ]
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: '3.8.x'
architecture: ${{ matrix.arch }}
- name: Install dependencies
if: matrix.os != 'ubuntu-latest'
run: pip install wheel && pip install --prefer-binary -r dev_requirements.txt -r requirements.txt
- name: Build wheel
if: matrix.os != 'ubuntu-latest'
run: python setup.py bdist_wheel
- name: Install cibuildwheel
if: matrix.os == 'ubuntu-latest'
run: pip install cibuildwheel twine
- name: set up qemu
if: matrix.os == 'ubuntu-latest'
uses: docker/setup-qemu-action@v1
with:
platforms: arm64
- name: Build wheels
if: matrix.os == 'ubuntu-latest'
run: |
python -m cibuildwheel --output-dir wheelhouse
env:
# build for python 3.8
CIBW_BUILD: cp38-*
CIBW_SKIP: "*-manylinux_i686" # temporary skip i386 wheels
CIBW_BUILD_VERBOSITY_LINUX: 0
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_I686_IMAGE: manylinux2014
CIBW_ARCHS_LINUX: 'auto aarch64'
CIBW_BEFORE_BUILD_LINUX: >
python -m pip install --upgrade pip
pip install --prefer-binary auditwheel -r dev_requirements.txt -r requirements.txt
CIBW_BEFORE_ALL_LINUX: >
yum install -y libffi libffi-devel openssl-devel wget unzip blas-devel lapack-devel libxml2-devel libxslt-devel
- name: Publish package
if: matrix.os == 'ubuntu-latest'
run: |
python -m twine upload --repository-url ${{ secrets.PYPI_OFFICIAL_UPLOAD_URL }} -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/*
- name: Publish package
if: matrix.os != 'ubuntu-latest'
run: |
python -m twine upload --repository-url ${{ secrets.PYPI_OFFICIAL_UPLOAD_URL }} -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing dist/*
build_sdist:
needs: tests
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
name: Source distribution - Python 3.8 - deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: '3.8.x'
- name: Install dependencies
run: pip install --prefer-binary -r dev_requirements.txt -r requirements.txt
- name: Build sdist
run: python setup.py sdist
- name: Publish package
run: |
python -m twine upload --repository-url ${{ secrets.PYPI_OFFICIAL_UPLOAD_URL }} -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing dist/*
done:
name: Done
runs-on: ubuntu-latest
needs:
- lint
- tests
- build_wheels
- build_sdist
steps:
- name: Job completed
run: ls
notify:
name: Notify
runs-on: ubuntu-latest
needs:
- lint
- tests
- build_wheels
- build_sdist
- done
if: ${{ failure() }}
steps:
- name: Notify discord
uses: sarisia/actions-status-discord@v1
with:
status: Failure
webhook: ${{ secrets.DISCORD_GITHUB_WEBHOOK }}