Merge pull request #2941 from freqtrade/github_actions_tests

GitHub actions tests
This commit is contained in:
hroff-1902 2020-02-19 14:58:12 +03:00 committed by GitHub
commit 2d2fd968c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 2 deletions

View File

@ -7,6 +7,8 @@ on:
- develop - develop
- github_actions_tests - github_actions_tests
tags: tags:
release:
types: [published]
pull_request: pull_request:
schedule: schedule:
- cron: '0 5 * * 4' - cron: '0 5 * * 4'
@ -191,15 +193,40 @@ jobs:
deploy: deploy:
needs: [ build, build_windows, docs_check ] needs: [ build, build_windows, docs_check ]
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
if: (github.event_name == 'push' || github.event_name == 'schedule') && github.repository == 'freqtrade/freqtrade' if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'release') && github.repository == 'freqtrade/freqtrade'
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Extract branch name - name: Extract branch name
shell: bash shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch 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: (steps.extract_branch.outputs.branch == 'master' || 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: (steps.extract_branch.outputs.branch == 'master' || github.event_name == 'release')
with:
user: __token__
password: ${{ secrets.pypi_password }}
- name: Build and test and push docker image - name: Build and test and push docker image
env: env:
IMAGE_NAME: freqtradeorg/freqtrade IMAGE_NAME: freqtradeorg/freqtrade

View File

@ -1,13 +1,27 @@
""" FreqTrade bot """ """ Freqtrade bot """
__version__ = 'develop' __version__ = 'develop'
if __version__ == 'develop': if __version__ == 'develop':
try: try:
import subprocess import subprocess
__version__ = 'develop-' + subprocess.check_output( __version__ = 'develop-' + subprocess.check_output(
['git', 'log', '--format="%h"', '-n 1'], ['git', 'log', '--format="%h"', '-n 1'],
stderr=subprocess.DEVNULL).decode("utf-8").rstrip().strip('"') stderr=subprocess.DEVNULL).decode("utf-8").rstrip().strip('"')
# from datetime import datetime
# last_release = subprocess.check_output(
# ['git', 'tag']
# ).decode('utf-8').split()[-1].split(".")
# # Releases are in the format "2020.1" - we increment the latest version for dev.
# prefix = f"{last_release[0]}.{int(last_release[1]) + 1}"
# dev_version = int(datetime.now().timestamp() // 1000)
# __version__ = f"{prefix}.dev{dev_version}"
# subprocess.check_output(
# ['git', 'log', '--format="%h"', '-n 1'],
# stderr=subprocess.DEVNULL).decode("utf-8").rstrip().strip('"')
except Exception: except Exception:
# git not available, ignore # git not available, ignore
pass pass