Skip to content

Add tests for StrategyCombiner class #151

Add tests for StrategyCombiner class

Add tests for StrategyCombiner class #151

# Your workflow name.
name: test-build-model-app
# Run workflow on every push to master branch.
on:
repository_dispatch:
types: [on-demand-run]
push:
paths:
- 'model/**'
- 'shared/**'
- 'database/model/migrations/**'
- '.github/workflows/build-deploy-model.yml'
env:
DIRECTORY: model
HEROKU_WEB_PROCESS: web
HEROKU_WORKER_PROCESS: worker
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
HEROKU_EMAIL: ${{ secrets.HEROKU_EMAIL }}
HEROKU_APP_NAME: ${{ secrets.HEROKU_MODEL_APP_NAME }}
EXECUTION_APP_URL: https://${{ secrets.HEROKU_EXECUTION_APP_NAME }}.herokuapp.com
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.4.2
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=model/strategies \
--cov=model/service --cov=model/backtesting --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 web Docker image
run: docker build -f $DIRECTORY/Dockerfile.$HEROKU_WEB_PROCESS -t $DIRECTORY-$HEROKU_WEB_PROCESS-app .
- name: Build worker Docker image
run: docker build -f $DIRECTORY/Dockerfile.$HEROKU_WORKER_PROCESS -t $DIRECTORY-$HEROKU_WORKER_PROCESS-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 --recursive --app $HEROKU_APP_NAME --context-path=../ --arg APP_NAME=$HEROKU_APP_NAME,\
EXECUTION_APP_URL=$EXECUTION_APP_URL,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_WEB_PROCESS $HEROKU_WORKER_PROCESS --app $HEROKU_APP_NAME