Skip to content

Merge pull request #364 from freqtrade/dependabot/pip/ruff-0.0.287 #722

Merge pull request #364 from freqtrade/dependabot/pip/ruff-0.0.287

Merge pull request #364 from freqtrade/dependabot/pip/ruff-0.0.287 #722

Workflow file for this run

name: Technical CI
on:
push:
branches:
- main
- ci/*
tags:
release:
types: [published]
pull_request:
schedule:
- cron: '0 5 * * 4'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-20.04, ubuntu-22.04, macos-latest ]
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: Cache_dependencies
uses: actions/cache@v3
id: cache
with:
path: ~/dependencies/
key: ${{ runner.os }}-dependencies
- name: pip cache (linux)
uses: actions/cache@v3
if: startsWith(matrix.os, 'ubuntu')
with:
path: ~/.cache/pip
key: test-${{ matrix.os }}-${{ matrix.python-version }}-pip
- name: pip cache (macOS)
uses: actions/cache@v3
if: startsWith(matrix.os, 'macOS')
with:
path: ~/Library/Caches/pip
key: test-${{ matrix.os }}-${{ matrix.python-version }}-pip
- name: TA binary *nix
if: steps.cache.outputs.cache-hit != 'true'
run: |
wget https://github.com/freqtrade/freqtrade/raw/develop/build_helpers/ta-lib-0.4.0-src.tar.gz
tar zxvf ta-lib-0.4.0-src.tar.gz
cd ta-lib
./configure --prefix ${HOME}/dependencies/
make
which sudo && sudo make install || make bigip_software_install
cd ..
rm -rf ta-lib/
- name: Installation - *nix
run: |
python -m pip install --upgrade pip
export LD_LIBRARY_PATH=${HOME}/dependencies/lib:$LD_LIBRARY_PATH
export TA_LIBRARY_PATH=${HOME}/dependencies/lib
export TA_INCLUDE_PATH=${HOME}/dependencies/include
pip install -r requirements-dev.txt
pip install -e .
- name: Tests
run: |
pytest --random-order --cov=technical --cov-config=.coveragerc
- name: Run Ruff
run: |
ruff check --format=github .
- name: Sort imports (isort)
run: |
isort --check .
- uses: psf/black@stable
if: startsWith(matrix.os, 'ubuntu')
with:
args: ". --check"
- name: Discord notification
uses: rjstone/discord-webhook-notify@v1
if: failure() && ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
with:
severity: error
details: Technical CI failed on ${{ matrix.os }}
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
build_windows:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ windows-latest ]
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: Pip cache (Windows)
uses: actions/cache@v3
if: startsWith(runner.os, 'Windows')
with:
path: ~\AppData\Local\pip\Cache
key: ${{ matrix.os }}-${{ matrix.python-version }}-pip
- uses: actions/checkout@v4
with:
repository: freqtrade/freqtrade
path: './freqtrade_tmp'
- name: Installation (uses freqtrade dependencies)
run: |
cp -r ./freqtrade_tmp/build_helpers .
# mkdir build_helpers/
# TODO: Update this to not download 3 files while only needing 1.
# Invoke-WebRequest -Outfile build_helpers/install_windows.ps1 https://github.com/freqtrade/freqtrade/raw/develop/build_helpers/install_windows.ps1
# if ( ${{ matrix.python-version }} -eq "3.8" ) {
# Invoke-WebRequest -Outfile build_helpers/TA_Lib-0.4.25-cp38-cp38-win_amd64.whl https://github.com/freqtrade/freqtrade/raw/develop/build_helpers/TA_Lib-0.4.25-cp38-cp38-win_amd64.whl
# }
# if ( ${{ matrix.python-version }} -eq "3.8" ) {
# Invoke-WebRequest -Outfile build_helpers/TA_Lib-0.4.25-cp39-cp39-win_amd64.whl https://github.com/freqtrade/freqtrade/raw/develop/build_helpers/TA_Lib-0.4.25-cp39-cp39-win_amd64.whl
# }
# if ( ${{ matrix.python-version }} -eq "3.10" ) {
# Invoke-WebRequest -Outfile build_helpers/TA_Lib-0.4.25-cp310-cp310-win_amd64.whl https://github.com/freqtrade/freqtrade/raw/develop/build_helpers/TA_Lib-0.4.25-cp310-cp310-win_amd64.whl
# }
./build_helpers/install_windows.ps1
- name: Tests
run: |
pytest --random-order --cov=technical --cov-config=.coveragerc tests
- name: Run Ruff
run: |
ruff check --format=github technical tests
- name: Discord notification
uses: rjstone/discord-webhook-notify@v1
if: failure() && ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
with:
severity: error
details: Technical CI failed on ${{ matrix.os }}
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
# Notify on discord only once - when CI completes (and after deploy) in case it's successfull
notify-complete:
needs: [ build, build_windows ]
runs-on: ubuntu-latest
# Discord notification can't handle schedule events
if: (github.event_name != 'schedule')
steps:
- name: Check user permission
id: check
uses: scherermichael-oss/[email protected]
with:
required-permission: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Discord notification
uses: rjstone/discord-webhook-notify@v1
if: always() && steps.check.outputs.has-permission && ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
with:
severity: info
details: Technical CI
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
deploy:
needs: [ build, build_windows ]
runs-on: ubuntu-22.04
if: (github.event_name == 'push' || github.event_name == 'release') && github.repository == 'freqtrade/technical'
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/[email protected]
with:
python-version: 3.8
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Build distribution
run: |
pip install -U setuptools wheel
python setup.py sdist bdist_wheel
- name: Publish to PyPI (Test)
uses: pypa/gh-action-pypi-publish@master
if: (github.event_name == 'release')
with:
user: __token__
password: ${{ secrets.pypi_test_password }}
repository_url: https://test.pypi.org/legacy/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@master
if: (github.event_name == 'release')
with:
user: __token__
password: ${{ secrets.pypi_password }}
- name: Discord notification
uses: rjstone/discord-webhook-notify@v1
if: always() && ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
with:
severity: info
details: Technical CI Deploy
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}