Skip to content

Dont stop pipeline at restart if SYMBOL_ALREADY_TRADED #363

Dont stop pipeline at restart if SYMBOL_ALREADY_TRADED

Dont stop pipeline at restart if SYMBOL_ALREADY_TRADED #363

# Your workflow name.
name: test-build-data-app
# Run workflow on every push to master branch.
on:
repository_dispatch:
types: [on-demand-run]
push:
paths:
- 'data/**'
- 'dashboard/**'
- 'shared/**'
- 'database/model/migrations/**'
- '.github/workflows/build-deploy-data.yml'
env:
DIRECTORY: data
HEROKU_PROCESS: web
HEROKU_CLOCK_PROCESS: clock
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
HEROKU_EMAIL: ${{ secrets.HEROKU_EMAIL }}
HEROKU_APP_NAME: ${{ secrets.HEROKU_DATA_APP_NAME }}
BINANCE_API_KEY: ${{ secrets.BINANCE_API_KEY }}
BINANCE_API_SECRET: ${{ secrets.BINANCE_API_SECRET }}
BINANCE_API_KEY_TEST: ${{ secrets.BINANCE_API_KEY_TEST }}
BINANCE_API_SECRET_TEST: ${{ secrets.BINANCE_API_SECRET_TEST }}
MODEL_APP_URL: https://${{ secrets.HEROKU_MODEL_APP_NAME }}.herokuapp.com
EXECUTION_APP_URL: https://${{ secrets.HEROKU_EXECUTION_APP_NAME }}.herokuapp.com
SECRET_KEY: ${{ secrets.SECRET_KEY}}
jobs:
testing:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install and configure Poetry
uses: snok/install-poetry@v1.3.3
with:
version: 1.7.1
virtualenvs-create: false
- name: Install dependencies
run: |
cd $DIRECTORY/
poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi
- name: Test with pytest
env:
TEST: true
run: |
python -m pytest $DIRECTORY/ --ds=database.settings --verbose --cov=data --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
test-build:
runs-on: ubuntu-latest
needs: testing
if: github.ref != 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- name: Build Docker image
run: docker build -f $DIRECTORY/Dockerfile -t $DIRECTORY-app .
build:
runs-on: ubuntu-latest
needs: testing
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- name: Login to heroku container registry
run: |
echo ${{ secrets.HEROKU_API_KEY }} | docker login --username=${{ secrets.HEROKU_EMAIL }} registry.heroku.com --password-stdin
- name: Build and push
run: |
cd $DIRECTORY/
heroku container:push $HEROKU_PROCESS --app $HEROKU_APP_NAME --context-path=../ \
--arg BINANCE_API_KEY=$BINANCE_API_KEY,BINANCE_API_SECRET=$BINANCE_API_SECRET,\
MODEL_APP_URL=$MODEL_APP_URL,EXECUTION_APP_URL=$EXECUTION_APP_URL,APP_NAME=$HEROKU_APP_NAME,\
BINANCE_API_KEY_TEST=$BINANCE_API_KEY_TEST,BINANCE_API_SECRET_TEST=$BINANCE_API_SECRET_TEST,\
SECRET_KEY=$SECRET_KEY
deploy:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- name: Login to heroku container registry
run: |
echo ${{ secrets.HEROKU_API_KEY }} | docker login --username=${{ secrets.HEROKU_EMAIL }} registry.heroku.com --password-stdin
- name: Deploy
run: heroku container:release $HEROKU_PROCESS --app $HEROKU_APP_NAME
- name: Run database migrations
run: |
heroku run python database/manage.py migrate --app $HEROKU_APP_NAME