Skip to content

Commit

Permalink
Adds sonarcloud and coverage reporting. Removes duplicate config file.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajlouie committed Jun 16, 2020
1 parent 67b0503 commit e2aa7c3
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 48 deletions.
7 changes: 7 additions & 0 deletions .sonarcloud.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
sonar.organization=sartography
sonar.projectKey=sartography_protocol-builder-mock
sonar.host.url=https://sonarcloud.io
sonar.exclusions=docs/**,config/**,instance/**,migrations/**,postgres/**,readme_images/**,schema/**,templates/**
sonar.sources=pb
sonar.test.inclusions=tests
sonar.python.coverage.reportPaths=coverage.xml
27 changes: 19 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
language: python

python:
- "3.7"

services:
- postgresql
- docker

python:
- "3.7"
addons:
chrome: stable
sonarcloud:
organization: "sartography"

before_install:
- cp config/travis-testing.py config/testing.py
- psql -c 'create database pb_test;' -U postgres

install:
- pip install pipenv pytest
- pip install pipenv pytest coverage
- export PATH=$PATH:$HOME/.local/bin;
- pipenv install
- pytest # <== This runs in Pipenv (a/k/a virtualenv)
- pipenv install --dev

env:
global:
- TESTING=true
- SQLALCHEMY_DATABASE_URI="postgresql://postgres:@localhost:5432/crc_test"

# command to run tests
script:
- pytest
- pipenv run coverage run -m pytest
- pipenv run coverage xml -i

after_success:
- sonar-scanner

deploy:
provider: script
Expand Down
53 changes: 29 additions & 24 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions config/testing.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import re
import os
from os import environ

basedir = os.path.abspath(os.path.dirname(__file__))

NAME = "CR Connect Protocol Builder Mock"
CORS_ENABLED = False
CORS_ALLOW_ORIGINS = re.split(r',\s*', environ.get('CORS_ALLOW_ORIGINS', default="localhost:5000"))
DEVELOPMENT = True
TESTING = True
SQLALCHEMY_DATABASE_URI = 'sqlite:///app.db'
SQLALCHEMY_DATABASE_URI = environ.get('SQLALCHEMY_DATABASE_URI', default="sqlite:///app.db")
SECRET_KEY = 'a really really really really long secret key'

print('### USING TESTING CONFIG: ###')
print('SQLALCHEMY_DATABASE_URI = ', SQLALCHEMY_DATABASE_URI)
print('TESTING = ', TESTING)
14 changes: 0 additions & 14 deletions config/travis-testing.py

This file was deleted.

0 comments on commit e2aa7c3

Please sign in to comment.