Skip to content

Update migrations to avoid breaking change #175

Update migrations to avoid breaking change

Update migrations to avoid breaking change #175

# Your workflow name.
name: test-build-execution-app
# Run workflow on every push to master branch.
on:
repository_dispatch:
types: [on-demand-run]
push:
paths:
- 'execution/**'
- 'shared/**'
- 'database/model/migrations/**'
- '.github/workflows/build-deploy-execution.yml'
env:
DIRECTORY: execution
HEROKU_PROCESS: web
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
HEROKU_EMAIL: ${{ secrets.HEROKU_EMAIL }}
HEROKU_APP_NAME: ${{ secrets.HEROKU_EXECUTION_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 }}
SECRET_KEY: ${{ secrets.SECRET_KEY}}
jobs:
test:
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.2.0
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=execution --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: test
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: test
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,\
BINANCE_API_KEY_TEST=$BINANCE_API_KEY_TEST,BINANCE_API_SECRET_TEST=$BINANCE_API_SECRET_TEST,\
APP_NAME=$HEROKU_APP_NAME,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