-
Notifications
You must be signed in to change notification settings - Fork 75
162 lines (146 loc) · 5.88 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
name: OctoBot-Tentacles-CI
on: push
jobs:
tests:
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, x86 ]
type: [sources, cython]
exclude:
- os: macos-latest # currently not supported
arch: x86
- os: ubuntu-latest # currently not supported
arch: x86
- os: windows-latest # don't test 'sources' twice on windows
arch: x86
type: sources
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 OctoBot on Unix
if: matrix.os != 'windows-latest'
env:
OCTOBOT_GH_REPO: https://github.com/Drakkar-Software/OctoBot.git
OCTOBOT_DEFAULT_BRANCH: dev
run: |
git clone -q $OCTOBOT_GH_REPO -b ${GITHUB_REF##*/} || git clone -q $OCTOBOT_GH_REPO -b $OCTOBOT_DEFAULT_BRANCH
cd OctoBot
git status
pip install --prefer-binary -r dev_requirements.txt -r requirements.txt
cd ..
mkdir new_tentacles
cp -r Backtesting Evaluator Services Trading new_tentacles
cd OctoBot
python start.py tentacles -d "../new_tentacles" -p "../../new_tentacles.zip"
python start.py tentacles --install --location "../new_tentacles.zip" --all
- name: Install OctoBot on Windows
if: matrix.os == 'windows-latest'
env:
OCTOBOT_GH_REPO: https://github.com/Drakkar-Software/OctoBot.git
OCTOBOT_DEFAULT_BRANCH: dev
run: |
If ($env:GITHUB_REF -notcontains "refs/tags/") {
$env:TENTACLES_URL_TAG = "latest"
}
git clone -q $env:OCTOBOT_GH_REPO -b $env:GITHUB_REF.Replace('refs/heads/','')
if ($LastExitCode -ne 0) {
git clone -q $env:OCTOBOT_GH_REPO -b $env:OCTOBOT_DEFAULT_BRANCH
}
cd OctoBot
git status
pip install --upgrade pip setuptools wheel
pip install --prefer-binary -r dev_requirements.txt -r requirements.txt
cd ..
mkdir new_tentacles
xcopy Backtesting new_tentacles\\Backtesting /E/H/I
xcopy Evaluator new_tentacles\\Evaluator /E/H/I
xcopy Services new_tentacles\\Services /E/H/I
xcopy Trading new_tentacles\\Trading /E/H/I
cd OctoBot
python start.py tentacles -d "../new_tentacles" -p "../../new_tentacles.zip"
python start.py tentacles --install --location "../new_tentacles.zip" --all
shell: powershell
- name: Compile project
if: matrix.type == 'cython'
run: |
cd OctoBot
python setup.py build_ext --inplace
python setup.py install
- name: Pytests
if: matrix.type == 'cython'
env:
CYTHON_IGNORE: True
run: |
cd OctoBot
pytest --cov=. --cov-config=.coveragerc --durations=0 -rw tentacles
- name: Pytests
if: matrix.type != 'cython'
run: |
cd OctoBot
pytest --cov=. --cov-config=.coveragerc --durations=0 -rw tentacles
- name: Publish coverage
if: matrix.type == 'sources'
run: coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
upload_tentacles:
needs: tests
name: ubuntu-latest - Python 3.8 - upload tentacles
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set Environment Variables
run: |
echo "NEXUS_USERNAME=${{ secrets.NEXUS_USERNAME }}" >> $GITHUB_ENV
echo "NEXUS_PASSWORD=${{ secrets.NEXUS_PASSWORD }}" >> $GITHUB_ENV
echo "NEXUS_URL=${{ secrets.NEXUS_URL }}" >> $GITHUB_ENV
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: '3.8.x'
architecture: 'x64'
- name: Produce tentacles package
env:
OCTOBOT_GH_REPO: https://github.com/Drakkar-Software/OctoBot.git
OCTOBOT_DEFAULT_BRANCH: dev
run: |
git clone -q $OCTOBOT_GH_REPO -b ${GITHUB_REF##*/} || git clone -q $OCTOBOT_GH_REPO -b $OCTOBOT_DEFAULT_BRANCH
cd OctoBot
git status
pip install --prefer-binary -r dev_requirements.txt -r requirements.txt
cd ..
mkdir new_tentacles
cp -r Backtesting Evaluator Services Trading new_tentacles
- name: Publish tag tentacles
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
run: |
cd OctoBot && python start.py tentacles -d "../new_tentacles" -p "../../new_tentacles.zip" -ite -ute ${{ secrets.NEXUS_OFFICIAL_PATH }}/tentacles -upe ${{ secrets.NEXUS_OFFICIAL_PATH }}/packages/full/${{ secrets.TENTACLES_REPOSITORY_NAME }} ${GITHUB_REF#refs/*/}.zip
- name: Publish latest tentacles
if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags') && github.ref == 'refs/heads/dev'
run: |
cd OctoBot && python start.py tentacles -d "../new_tentacles" -p "../../new_tentacles.zip" -upe ${{ secrets.NEXUS_OFFICIAL_PATH }}/packages/full/${{ secrets.TENTACLES_REPOSITORY_NAME }} ${{ secrets.LATEST_TAG }}.zip
- name: Publish cleaned branch tentacles
if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags')
run: |
branch="${GITHUB_REF##*/}"
cd OctoBot && python start.py tentacles -d "../new_tentacles" -p "../../new_tentacles.zip" -upe ${{ secrets.NEXUS_DEV_PATH }}/packages/full ${branch////_}.zip
notify:
name: Notify
runs-on: ubuntu-latest
needs:
- tests
- upload_tentacles
if: ${{ failure() }}
steps:
- name: Notify discord
uses: sarisia/actions-status-discord@v1
with:
status: Failure
webhook: ${{ secrets.DISCORD_GITHUB_WEBHOOK }}