-
-
Notifications
You must be signed in to change notification settings - Fork 807
163 lines (143 loc) · 5.18 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
name: OctoBot-CI
on:
push:
branches:
- 'master'
- 'dev'
tags:
- '*'
pull_request:
jobs:
lint:
name: ${{ matrix.os }}${{ matrix.arch }} - Python ${{ matrix.version }} - lint
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
arch: [ x64 ]
version: [ "3.10.x" ]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.version }}
architecture: ${{ matrix.arch }}
- 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 ${{ matrix.version }} - tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macos-13, windows-latest, ubuntu-latest ]
arch: [ x64 ]
version: [ "3.10.x" ]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.version }}
architecture: ${{ matrix.arch }}
- name: Wait for tentacles
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: fountainhead/[email protected]
id: wait-for-build
with:
token: ${{ secrets.AUTH_TOKEN }}
checkName: "ubuntu-latestx64 - Python - 3.10 - Upload"
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: Pytests
env:
DISABLE_SENTRY: True
run: |
pytest --cov=. --cov-config=.coveragerc --durations=0 -rw tests
pytest --durations=0 -rw --ignore=tentacles/Trading/Exchange tentacles
- name: Publish coverage
if: github.event_name == 'push'
run: coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build_sdist:
needs: tests
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
name: Source distribution - Python ${{ matrix.version }} - Deploy
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
arch: [ x64 ]
version: [ "3.10.x" ]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.version }}
architecture: ${{ matrix.arch }}
- 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 __token__ -p ${{ secrets.PYPI_TOKEN }} --skip-existing dist/*
notify:
if: ${{ failure() }}
needs:
- lint
- tests
- build_sdist
uses: Drakkar-Software/.github/.github/workflows/failure_notify_workflow.yml@master
secrets:
DISCORD_GITHUB_WEBHOOK: ${{ secrets.DISCORD_GITHUB_WEBHOOK }}