diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml new file mode 100644 index 0000000..76b48f5 --- /dev/null +++ b/.github/workflows/python-app.yml @@ -0,0 +1,37 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Python application + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + uvicorn main:app + pytest -v diff --git a/assets/database.py b/assets/database.py index 45c7fd7..df018eb 100644 --- a/assets/database.py +++ b/assets/database.py @@ -1,5 +1,13 @@ +import importlib import mysql.connector -import env as e +try: + import env as e +found_env = importlib.util.find_spec("env") + +if found_env is not None: + import dummy_env as e + + # env (enviorment) is the env.py file where all of the # variables are stored for the database access create # your own file with all the needed variables (see below) diff --git a/dummy_env.py b/dummy_env.py new file mode 100644 index 0000000..72e6e76 --- /dev/null +++ b/dummy_env.py @@ -0,0 +1,22 @@ +# DB + +db_host = "" +db_username = "" +db_password = "" +db_database = "" + +# GenericAPI Key + +key = "" + +# OAuth2 + +SECRET_KEY = "" + +# Mail + +mail_host = "" +mail_sender = "" +mail_username = "" +mail_password = "" +mail_port = 465