[IndexTrading] allow intra-day update #3811
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: OctoBot-Tentacles-CI | |
on: | |
push: | |
branches: | |
- 'master' | |
- 'dev' | |
- 'beta' | |
tags: | |
- '*' | |
pull_request: | |
jobs: | |
tests: | |
name: ${{ matrix.os }}${{ matrix.arch }} - Python - ${{ matrix.python }} - Tests | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ macos-13, windows-latest, ubuntu-latest ] | |
arch: [ x64 ] | |
python: [ '3.10' ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
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: | | |
echo "GITHUB_REF=$GITHUB_REF" | |
TARGET_BRANCH=$([ "$GITHUB_HEAD_REF" == "" ] && echo ${GITHUB_REF##*/} || echo "$GITHUB_HEAD_REF") | |
git clone -q $OCTOBOT_GH_REPO -b ${TARGET_BRANCH} || 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 Automation Backtesting Evaluator Meta Services Trading profiles new_tentacles | |
cd OctoBot | |
python start.py tentacles -d "../new_tentacles" -p "../../any_platform.zip" | |
python start.py tentacles --install --location "../any_platform.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: | | |
echo "GITHUB_REF=$env:GITHUB_REF" | |
$env:TARGET_BRANCH = $env:GITHUB_REF | |
If ((Test-Path env:GITHUB_HEAD_REF) -and -not ([string]::IsNullOrWhiteSpace($env:GITHUB_HEAD_REF))) { | |
echo "using GITHUB_HEAD_REF" | |
$env:TARGET_BRANCH = $env:GITHUB_HEAD_REF | |
} | |
echo "TARGET_BRANCH=$env:TARGET_BRANCH" | |
If ($env:TARGET_BRANCH -notcontains "refs/tags/") { | |
$env:TENTACLES_URL_TAG = "latest" | |
} | |
echo "cleaned TARGET_BRANCH=$env:TARGET_BRANCH" | |
git clone -q $env:OCTOBOT_GH_REPO -b $env:TARGET_BRANCH.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 Automation new_tentacles\\Automation /E/H/I | |
xcopy Backtesting new_tentacles\\Backtesting /E/H/I | |
xcopy Evaluator new_tentacles\\Evaluator /E/H/I | |
xcopy Meta new_tentacles\\Meta /E/H/I | |
xcopy Services new_tentacles\\Services /E/H/I | |
xcopy Trading new_tentacles\\Trading /E/H/I | |
xcopy profiles new_tentacles\\profiles /E/H/I | |
cd OctoBot | |
python start.py tentacles -d "../new_tentacles" -p "../../any_platform.zip" | |
python start.py tentacles --install --location "../any_platform.zip" --all | |
shell: powershell | |
- name: Pytests | |
run: | | |
cd OctoBot | |
pytest --cov=. --cov-config=.coveragerc --durations=0 -rw --ignore=tentacles/Trading/Exchange tentacles | |
- name: Publish coverage | |
if: github.event_name == 'push' | |
continue-on-error: true | |
run: coveralls | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | |
upload_tentacles: | |
needs: tests | |
name: ${{ matrix.os }}${{ matrix.arch }} - Python - ${{ matrix.python }} - Upload | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest ] | |
arch: [ x64 ] | |
python: [ '3.10' ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set Environment Variables | |
run: | | |
echo "S3_API_KEY=${{ secrets.S3_API_KEY }}" >> $GITHUB_ENV | |
echo "S3_API_SECRET_KEY=${{ secrets.S3_API_SECRET_KEY }}" >> $GITHUB_ENV | |
echo "S3_REGION_NAME=${{ secrets.S3_REGION_NAME }}" >> $GITHUB_ENV | |
echo "S3_ENDPOINT_URL=${{ secrets.S3_ENDPOINT_URL }}" >> $GITHUB_ENV | |
echo "CLOUDFLARE_TOKEN=${{ secrets.CLOUDFLARE_TOKEN }}" >> $GITHUB_ENV | |
echo "CLOUDFLARE_ZONE=${{ secrets.CLOUDFLARE_ZONE }}" >> $GITHUB_ENV | |
TARGET_BRANCH=$([ "$GITHUB_HEAD_REF" == "" ] && echo ${GITHUB_REF##*/} || echo "$GITHUB_HEAD_REF") | |
echo "TARGET_BRANCH=${TARGET_BRANCH}" >> $GITHUB_ENV | |
- name: Set up Python ${{ matrix.python }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
architecture: ${{ matrix.arch }} | |
- 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 ${TARGET_BRANCH} || 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 Automation Backtesting Evaluator Meta Services Trading profiles new_tentacles | |
- name: Publish tag tentacles | |
if: startsWith(github.ref, 'refs/tags') | |
env: | |
S3_BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }} | |
run: | | |
sed -i "s/VERSION_PLACEHOLDER/${TARGET_BRANCH#refs/*/}/g" metadata.yaml | |
cd OctoBot | |
python start.py 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 ../scripts/clear_cloudflare_cache.py ${TARGET_BRANCH#refs/*/} | |
- name: Publish latest tentacles | |
if: github.ref == 'refs/heads/dev' && startsWith(github.ref, 'refs/tags') != true | |
env: | |
S3_BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }} | |
run: | | |
sed -i "s/VERSION_PLACEHOLDER/latest/g" metadata.yaml | |
cd OctoBot | |
python start.py tentacles -m "../metadata.yaml" -d "../new_tentacles" -p "../../any_platform.zip" -upe ${{ secrets.TENTACLES_OFFICIAL_PATH }}/packages/full/${{ secrets.TENTACLES_REPOSITORY_NAME }}/ | |
python ../scripts/clear_cloudflare_cache.py latest | |
- name: Publish stable tentacles | |
if: github.ref == 'refs/heads/master' | |
env: | |
S3_BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }} | |
run: | | |
sed -i "s/VERSION_PLACEHOLDER/stable/g" metadata.yaml | |
cd OctoBot | |
python start.py tentacles -m "../metadata.yaml" -d "../new_tentacles" -p "../../any_platform.zip" -upe ${{ secrets.TENTACLES_OFFICIAL_PATH }}/packages/full/${{ secrets.TENTACLES_REPOSITORY_NAME }}/ | |
python ../scripts/clear_cloudflare_cache.py stable | |
- name: Publish cleaned branch tentacles | |
if: startsWith(github.ref, 'refs/tags') != true && github.ref != 'refs/heads/master' | |
env: | |
S3_BUCKET_NAME: ${{ secrets.S3_DEV_BUCKET_NAME }} | |
run: | | |
branch="${TARGET_BRANCH##*/}" | |
sed -i "s/VERSION_PLACEHOLDER/$branch/g" metadata.yaml | |
sed -i "s/base/$branch/g" metadata.yaml | |
sed -i "s/officials/dev/g" metadata.yaml | |
cd OctoBot | |
python start.py tentacles -m "../metadata.yaml" -d "../new_tentacles" -p "../../any_platform.zip" -upe ${{ secrets.TENTACLES_OFFICIAL_PATH }}/packages/full/${{ secrets.TENTACLES_REPOSITORY_NAME }}/ | |
python ../scripts/clear_cloudflare_cache.py $branch | |
notify: | |
if: ${{ failure() }} | |
needs: | |
- tests | |
- upload_tentacles | |
uses: Drakkar-Software/.github/.github/workflows/failure_notify_workflow.yml@master | |
secrets: | |
DISCORD_GITHUB_WEBHOOK: ${{ secrets.DISCORD_GITHUB_WEBHOOK }} |