-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
763 lines (676 loc) · 26.9 KB
/
Copy pathmain.yml
File metadata and controls
763 lines (676 loc) · 26.9 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
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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
name: OctoBot-CI
on:
push:
branches:
- 'master'
- 'dev'
tags:
- '*'
pull_request:
permissions: read-all
jobs:
build:
name: ${{ matrix.os }}${{ matrix.arch }} - Python ${{ matrix.version }} - Build wheel
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
arch: [ x64 ]
version: [ "3.13.x" ]
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.version }}
architecture: ${{ matrix.arch }}
- name: Install Pants
uses: pantsbuild/actions/init-pants@v11
with:
gha-cache-key: ${{ runner.os }}-pants-build
named-caches-hash: ${{ hashFiles('pants.toml') }}
- uses: actions/setup-node@v6
with:
node-version: 22
- name: Install Rust toolchain
if: hashFiles('packages/*/crates/*/Cargo.toml') != ''
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Rust lint & tests
if: hashFiles('packages/*/crates/*/Cargo.toml') != ''
run: |
cargo clippy --workspace -- -D warnings
cargo test --workspace
- name: Install maturin
if: hashFiles('packages/*/crates/*/pyproject.toml') != ''
run: pip install maturin
- name: Build wheels
run: pants package :OctoBot $(pants list --filter-target-type=package_shell_command ::)
- name: Upload wheel artifacts
uses: actions/upload-artifact@v7
with:
name: octobot-wheel
path: dist/*.whl
if-no-files-found: error
tests:
needs: [ build ]
name: ${{ matrix.os }}${{ matrix.arch }} - Python ${{ matrix.version }} - ${{ matrix.package }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
arch: [ x64 ]
version: [ "3.13.x" ]
package:
- octobot
- packages/agents
- packages/async_channel
- packages/backtesting
- packages/commons
- packages/evaluators
- packages/node
- packages/flow
- packages/copy
- packages/protocol
- packages/services
- packages/sync
- packages/tentacles_manager
- packages/trading
- packages/trading_backend
env:
USES_TENTACLES: ${{ matrix.package == 'octobot' || matrix.package == 'packages/node' || matrix.package == 'packages/flow' || matrix.package == 'packages/copy' }}
steps:
- uses: actions/checkout@v6
- name: Detect package features
id: detect
run: |
if ls ${{ matrix.package }}/crates/*/Cargo.toml 1>/dev/null 2>&1; then
echo "has_rust=true" >> $GITHUB_OUTPUT
else
echo "has_rust=false" >> $GITHUB_OUTPUT
fi
- name: Set up Python ${{ matrix.version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.version }}
architecture: ${{ matrix.arch }}
- name: Set up Node.js
if: matrix.package == 'octobot'
uses: actions/setup-node@v6
with:
node-version: 22
- name: Download build wheel artifact
uses: actions/download-artifact@v8
with:
name: octobot-wheel
path: dist/
- name: Install OctoBot
run: |
pip3 install -r dev_requirements.txt
pip3 install dist/*.whl
- name: Lint package
run: |
if [ -f "${{ matrix.package }}/standard.rc" ]; then
pylint --rcfile=${{ matrix.package }}/standard.rc ${{ matrix.package }}/
rc=$?
else
pylint --rcfile=standard.rc ${{ matrix.package }}/
rc=$?
fi
if [ $rc -eq 1 ]; then exit 1; fi
- name: Install Rust toolchain
if: steps.detect.outputs.has_rust == 'true'
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Lint Rust crates
if: steps.detect.outputs.has_rust == 'true'
run: |
for crate in ${{ matrix.package }}/crates/*/; do
cargo clippy --manifest-path "$crate/Cargo.toml" -- -D warnings
done
- name: Install tentacles
if: env.USES_TENTACLES == 'true'
env:
ALLOW_UNSIGNED_TENTACLES: "true"
run: |
mkdir -p output
OctoBot tentacles -d packages/tentacles -p any_platform.zip
OctoBot tentacles --install --location output/any_platform.zip --all
- name: Run tests
run: |
if [ "${{ matrix.package }}" = "octobot" ]; then
pytest tests -n auto --dist loadfile
pytest --ignore=tentacles/Trading/Exchange tentacles -n auto --dist loadfile
else
if [ "${{ matrix.package }}" = "packages/node" ] || [ "${{ matrix.package }}" = "packages/flow" ] || [ "${{ matrix.package }}" = "packages/copy" ]; then
echo "Running tests from root dir to allow tentacles import"
PYTHONPATH=.:$PYTHONPATH pytest ${{ matrix.package }}/tests -n auto --dist loadfile
else
cd ${{ matrix.package }}
if [ "${{ matrix.package }}" = "packages/tentacles_manager" ]; then
pytest tests
else
if [ "${{ matrix.package }}" = "packages/protocol" ]; then
pytest test
else
pytest tests -n auto --dist loadfile
fi
fi
fi
fi
env:
DISABLE_SENTRY: True
- name: Run Rust backend tests
if: steps.detect.outputs.has_rust == 'true'
run: |
cd ${{ matrix.package }}
pytest tests --backend=rust -v
- name: Run frontend tests
if: matrix.package == 'octobot'
run: |
find packages/tentacles -name "package.json" -not -path "*/node_modules/*" | while read pkg; do
cd "$(dirname "$pkg")"
npm ci
npm test
cd - > /dev/null
done
docker:
name: Build & Push Docker images
needs: [ build, tests ]
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/')
permissions:
contents: read
packages: write
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
steps:
- uses: actions/checkout@v6
- name: Run hadolint
uses: reviewdog/action-hadolint@v1
with:
github_token: ${{ secrets.github_token }}
hadolint_ignore: DL3013 DL3008
- name: Set Environment Variables
run: |
OWNER="$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]' | tr -d '-')"
IMG=octobot
echo "VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
echo "IMAGE=${OWNER}/${IMG}" >> $GITHUB_ENV
echo "LATEST=latest" >> $GITHUB_ENV
echo "STAGING=staging" >> $GITHUB_ENV
echo "STABLE=stable" >> $GITHUB_ENV
echo "TEST=test" >> $GITHUB_ENV
echo "SHA=${GITHUB_SHA}" >> $GITHUB_ENV
echo "CONTAINER_NAME=octobot" >> $GITHUB_ENV
echo "CHECK_TENTACLE_CONTAINER_TIME=10" >> $GITHUB_ENV
echo "WAIT_CONTAINER_TIME=80" >> $GITHUB_ENV
- name: Set up Python ${{ matrix.version }}
uses: actions/setup-python@v6
with:
python-version: "3.13.x"
architecture: x64
- name: Set up QEMU
id: qemu-setup
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Print available platforms
run: echo ${{ steps.qemu.outputs.platforms }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
use: true
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to Docker Hub
if: github.event_name == 'push'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Download build wheel artifact
uses: actions/download-artifact@v8
with:
name: octobot-wheel
path: dist/
- name: Install OctoBot & tentacles
env:
ALLOW_UNSIGNED_TENTACLES: "true"
run: |
pip3 install -r dev_requirements.txt
pip3 install dist/octobot-*.whl
mkdir -p output
OctoBot tentacles -d packages/tentacles -p any_platform.zip
OctoBot tentacles --install --location output/any_platform.zip --all
- name: Build latest
if: github.event_name != 'push'
uses: docker/build-push-action@v6
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64
# Using "load: true" forces the docker driver.
# Unfortunately, the "docker" driver does not support
# multi-platform builds.
load: true
push: false
tags: ${{ env.IMAGE }}:${{ env.SHA }}
build-args: |
TENTACLES_URL_TAG=${{ env.LATEST }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Docker build test container
if: github.event_name != 'push'
run: |
docker build -f ./tests/Dockerfile --build-arg OCTOBOT_IMAGE=${{ env.IMAGE }}:${{ env.SHA }} -t ${{ env.IMAGE }}:${{ env.TEST }} .
- name: run tests in docker
if: github.event_name != 'push'
run: |
docker run -i -v $(pwd)/tentacles:/octobot/tentacles -e DISABLE_SENTRY=True ${{ env.IMAGE }}:${{ env.TEST }}
- name: run and check health after start
if: github.event_name != 'push'
run: |
echo Start OctoBot docker container with tentacles...
docker run -id -v $(pwd)/tentacles:/octobot/tentacles -e DISABLE_SENTRY=True --name ${{ env.CONTAINER_NAME }} ${{ env.IMAGE }}:${{ env.LATEST }}
sleep ${{ env.WAIT_CONTAINER_TIME }}
docker logs ${{ env.CONTAINER_NAME }}
docker inspect ${{ env.CONTAINER_NAME }} | jq '.[].State.Health.Status' | grep "healthy"
- name: Build and push latest
if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags') && github.ref == 'refs/heads/dev'
uses: docker/build-push-action@v6
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.IMAGE }}:${{ env.LATEST }}
build-args: |
TENTACLES_URL_TAG=${{ env.LATEST }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Build and push staging
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: docker/build-push-action@v6
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.IMAGE }}:${{ env.STAGING }}
build-args: |
TENTACLES_URL_TAG=${{ env.STABLE }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Build and push on tag
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.IMAGE }}:${{ env.LATEST }}
${{ env.IMAGE }}:${{ env.STABLE }}
${{ env.IMAGE }}:${{ env.VERSION }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
tentacles:
needs: [ build, tests ]
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/')
name: ${{ matrix.os }}${{ matrix.arch }} - Python ${{ matrix.version }} - Upload Tentacles
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
arch: [ x64 ]
version: [ "3.13.x" ]
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.version }}
architecture: ${{ matrix.arch }}
- name: Download build wheel artifact
uses: actions/download-artifact@v8
with:
name: octobot-wheel
path: dist/
- name: Install OctoBot
run: |
pip3 install -r dev_requirements.txt
pip3 install dist/octobot-*.whl
- name: Prepare tentacles package
run: |
mkdir -p ../new_tentacles
cp -r packages/tentacles/Agent packages/tentacles/Automation packages/tentacles/Backtesting packages/tentacles/Evaluator packages/tentacles/Meta packages/tentacles/Services packages/tentacles/Trading packages/tentacles/profiles ../new_tentacles/
- name: Publish tag tentacles
if: startsWith(github.ref, 'refs/tags')
env:
S3_API_KEY: ${{ secrets.S3_API_KEY }}
S3_API_SECRET_KEY: ${{ secrets.S3_API_SECRET_KEY }}
S3_REGION_NAME: ${{ secrets.S3_REGION_NAME }}
S3_ENDPOINT_URL: ${{ secrets.S3_ENDPOINT_URL }}
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }}
S3_BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }}
TENTACLES_SIGNING_PRIVATE_KEY: ${{ secrets.TENTACLES_SIGNING_PRIVATE_KEY }}
run: |
echo "Publishing tentacles for tag: ${GITHUB_REF_NAME}"
cp packages/tentacles/metadata.yaml ../metadata.yaml
sed -i "s/VERSION_PLACEHOLDER/${GITHUB_REF_NAME}/g" ../metadata.yaml
OctoBot tentacles -m "../metadata.yaml" -d "../new_tentacles" -p "../any_platform.zip" -ite -ute ${{ secrets.TENTACLES_OFFICIAL_PATH }}/tentacles -upe ${{ secrets.TENTACLES_OFFICIAL_PATH }}/packages/full/${{ secrets.TENTACLES_REPOSITORY_NAME }}/
python packages/tentacles/scripts/clear_cloudflare_cache.py ${GITHUB_REF_NAME}
- name: Publish latest tentacles
if: github.ref == 'refs/heads/dev' && startsWith(github.ref, 'refs/tags') != true
env:
S3_API_KEY: ${{ secrets.S3_API_KEY }}
S3_API_SECRET_KEY: ${{ secrets.S3_API_SECRET_KEY }}
S3_REGION_NAME: ${{ secrets.S3_REGION_NAME }}
S3_ENDPOINT_URL: ${{ secrets.S3_ENDPOINT_URL }}
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }}
S3_BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }}
TENTACLES_SIGNING_PRIVATE_KEY: ${{ secrets.TENTACLES_SIGNING_PRIVATE_KEY }}
run: |
cp packages/tentacles/metadata.yaml ../metadata.yaml
sed -i "s/VERSION_PLACEHOLDER/latest/g" ../metadata.yaml
OctoBot tentacles -m "../metadata.yaml" -d "../new_tentacles" -p "../any_platform.zip" -upe ${{ secrets.TENTACLES_OFFICIAL_PATH }}/packages/full/${{ secrets.TENTACLES_REPOSITORY_NAME }}/
python packages/tentacles/scripts/clear_cloudflare_cache.py latest
- name: Publish stable tentacles
if: github.ref == 'refs/heads/master'
env:
S3_API_KEY: ${{ secrets.S3_API_KEY }}
S3_API_SECRET_KEY: ${{ secrets.S3_API_SECRET_KEY }}
S3_REGION_NAME: ${{ secrets.S3_REGION_NAME }}
S3_ENDPOINT_URL: ${{ secrets.S3_ENDPOINT_URL }}
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }}
S3_BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }}
TENTACLES_SIGNING_PRIVATE_KEY: ${{ secrets.TENTACLES_SIGNING_PRIVATE_KEY }}
run: |
cp packages/tentacles/metadata.yaml ../metadata.yaml
sed -i "s/VERSION_PLACEHOLDER/stable/g" ../metadata.yaml
OctoBot tentacles -m "../metadata.yaml" -d "../new_tentacles" -p "../any_platform.zip" -upe ${{ secrets.TENTACLES_OFFICIAL_PATH }}/packages/full/${{ secrets.TENTACLES_REPOSITORY_NAME }}/
python packages/tentacles/scripts/clear_cloudflare_cache.py stable
docs:
name: Build & Deploy Docs
needs: [build, tests]
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
lfs: true
- uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
cache-dependency-path: docs/package-lock.json
- name: Install dependencies
run: cd docs && npm ci
- name: Build docs
run: cd docs && npm run build
- name: Upload version (preview URL)
uses: cloudflare/wrangler-action@v3
with:
wranglerVersion: "4"
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
workingDirectory: docs
command: versions upload
- name: Deploy to production
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: cloudflare/wrangler-action@v3
with:
wranglerVersion: "4"
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
workingDirectory: docs
command: versions deploy --yes
version:
needs: [ build, 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.13.x" ]
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.version }}
architecture: ${{ matrix.arch }}
- name: Download build wheel artifact
uses: actions/download-artifact@v8
with:
name: octobot-wheel
path: dist/
- name: Publish packages
run: |
pip install twine
python -m twine upload --repository-url ${{ secrets.PYPI_OFFICIAL_UPLOAD_URL }} -u __token__ -p ${{ secrets.PYPI_TOKEN }} --skip-existing dist/*
binary:
needs: [ build, tests ]
name: ${{ matrix.os }} - ${{ matrix.arch }} - binary
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
arch: [ x64, arm64 ]
exclude:
- os: windows-latest
arch: arm64
- os: macos-latest
arch: x64
steps:
- uses: actions/checkout@v6
- name: Download wheel artifact
uses: actions/download-artifact@v8
with:
name: octobot-wheel
path: dist/
- name: Set up Python 3.13
uses: actions/setup-python@v6
with:
python-version: '3.13.x'
architecture: x64
- name: Build OctoBot Binary on Linux arm64
if: matrix.os == 'ubuntu-latest' && matrix.arch == 'arm64'
uses: uraimo/run-on-arch-action@v3.0.1
with:
arch: aarch64
distro: ubuntu24.04
githubToken: ${{ github.token }}
dockerRunArgs: |
--volume "${PWD}/dist:/dist"
env: |
OCTOBOT_REPOSITORY_DIR: OctoBot
NLTK_DATA: nltk_data
BUILD_ARCH: ${{ matrix.arch }}
run: |
apt-get update
apt-get install -y --no-install-recommends python3.12 python3-pip python3-dev python3-venv git gcc musl-dev libc-dev build-essential zlib1g zlib1g-dev
python3 -m venv /opt/octobot_venv
source /opt/octobot_venv/bin/activate
python -m pip install -U pip setuptools wheel
python -m pip install -r packages/binary/requirements.txt
python -m pip install /dist/octobot-*.whl
bash ./packages/binary/build_scripts/unix.sh
- name: Build OctoBot Binary on Linux
if: matrix.os == 'ubuntu-latest' && matrix.arch == 'x64'
env:
OCTOBOT_REPOSITORY_DIR: OctoBot
NLTK_DATA: nltk_data
BUILD_ARCH: ${{ matrix.arch }}
run: |
python3 -m pip install -U pip setuptools wheel
python3 -m pip install -r packages/binary/requirements.txt
pip3 install dist/octobot-*.whl
bash ./packages/binary/build_scripts/unix.sh
- name: Build OctoBot Binary on MacOS
if: matrix.os == 'macos-latest'
env:
OCTOBOT_REPOSITORY_DIR: OctoBot
NLTK_DATA: nltk_data
BUILD_ARCH: ${{ matrix.arch }}
run: |
python3 -m pip install -U pip setuptools wheel
python3 -m pip install -r packages/binary/requirements.txt
pip3 install dist/octobot-*.whl
bash ./packages/binary/build_scripts/unix.sh
- name: Build OctoBot Binary on Windows
if: matrix.os == 'windows-latest'
env:
OCTOBOT_REPOSITORY_DIR: OctoBot
NLTK_DATA: nltk_data
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -r packages\binary\requirements.txt
python -m pip install (Get-Item dist/octobot-*.whl).FullName
.\packages\binary\build_scripts\windows.ps1
shell: powershell
- name: Upload OctoBot Binary on MacOS
uses: actions/upload-artifact@v7
if: matrix.os == 'macos-latest'
with:
name: OctoBot_macos_${{ matrix.arch }}
path: OctoBot_${{ matrix.arch }}
if-no-files-found: error
- name: Upload OctoBot Binary on Linux
uses: actions/upload-artifact@v7
if: matrix.os == 'ubuntu-latest'
with:
name: OctoBot_linux_${{ matrix.arch }}
path: OctoBot_${{ matrix.arch }}
if-no-files-found: error
- name: Upload OctoBot Binary on Windows
uses: actions/upload-artifact@v7
if: matrix.os == 'windows-latest'
with:
name: OctoBot_windows_${{ matrix.arch }}.exe
path: OctoBot_windows.exe
if-no-files-found: error
release:
name: Create Release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [ binary, docker, tentacles ]
permissions:
contents: write
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
steps:
- name: Download artifacts
uses: actions/download-artifact@v8
with:
pattern: OctoBot_*
- name: Set version as environement var
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Clean artifact names
run: |
mkdir bin
mv OctoBot_linux_x64/OctoBot_x64 bin/OctoBot_linux_x64
mv OctoBot_windows_x64.exe/OctoBot_windows.exe bin/OctoBot_windows_x64.exe
mv OctoBot_linux_arm64/OctoBot_arm64 bin/OctoBot_linux_arm64
mv OctoBot_macos_arm64/OctoBot_arm64 bin/OctoBot_macos_arm64
- name: Compute hashes
id: hashes
run: |
echo ::set-output name=octobot_linux_x64_hash::$(openssl sha256 ./bin/OctoBot_linux_x64 | awk '{print $2}')
echo ::set-output name=octobot_linux_arm64_hash::$(openssl sha256 ./bin/OctoBot_linux_arm64 | awk '{print $2}')
echo ::set-output name=octobot_macos_arm64_hash::$(openssl sha256 ./bin/OctoBot_macos_arm64 | awk '{print $2}')
echo ::set-output name=octobot_windows_x64_hash::$(openssl sha256 ./bin/OctoBot_windows_x64.exe | awk '{print $2}')
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.AUTH_TOKEN }}
with:
tag_name: ${{ steps.vars.outputs.tag }}
release_name: Release - ${{ steps.vars.outputs.tag }}
owner: ${{ github.repository_owner }}
repo: OctoBot
draft: true
prerelease: false
commitish: master
body: |
| Binary | Download link | SHA256 |
| ------------- |:-------------:|:-------------:|
| Windows x64 | [Download](https://github.com/${{ github.repository_owner }}/OctoBot/releases/download/${{ steps.vars.outputs.tag }}/OctoBot_windows_x64.exe) | ${{ steps.hashes.outputs.octobot_windows_x64_hash }} |
| Linux x64 | [Download](https://github.com/${{ github.repository_owner }}/OctoBot/releases/download/${{ steps.vars.outputs.tag }}/OctoBot_linux_x64) | ${{ steps.hashes.outputs.octobot_linux_x64_hash }} |
| Linux arm64 | [Download](https://github.com/${{ github.repository_owner }}/OctoBot/releases/download/${{ steps.vars.outputs.tag }}/OctoBot_linux_arm64) | ${{ steps.hashes.outputs.octobot_linux_arm64_hash }} |
| MacOS arm64 | [Download](https://github.com/${{ github.repository_owner }}/OctoBot/releases/download/${{ steps.vars.outputs.tag }}/OctoBot_macos_arm64) | ${{ steps.hashes.outputs.octobot_macos_arm64_hash }} |
- name: Upload Release Asset - OctoBot_windows_x64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.AUTH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/OctoBot_windows_x64.exe
asset_name: OctoBot_windows_x64.exe
asset_content_type: application/x-binary
- name: Upload Release Asset - OctoBot_linux_x64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.AUTH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/OctoBot_linux_x64
asset_name: OctoBot_linux_x64
asset_content_type: application/x-binary
- name: Upload Release Asset - OctoBot_linux_arm64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.AUTH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/OctoBot_linux_arm64
asset_name: OctoBot_linux_arm64
asset_content_type: application/x-binary
- name: Upload Release Asset - OctoBot_macos_arm64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.AUTH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/OctoBot_macos_arm64
asset_name: OctoBot_macos_arm64
asset_content_type: application/x-binary
notify:
if: ${{ failure() }}
needs:
- build
- tests
- docker
- binary
- tentacles
- release
- version
- docs
uses: Drakkar-Software/.github/.github/workflows/failure_notify_workflow.yml@master
secrets:
DISCORD_GITHUB_WEBHOOK: ${{ secrets.DISCORD_GITHUB_WEBHOOK }}