Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# FLASK_ENV="development"
# FLASK_DEBUG="1"
# LEARNERS_CONFIG="config.yml"
# MAIL="True"
# REMOVE_DB="True"
# TESTING="False"
# PROPAGATE_EXCEPTIONS="None"
# PRESERVE_CONTEXT_ON_EXCEPTION="None"
# SECRET_KEY="None"
# PERMANENT_SESSION_LIFETIME="datetime.timedelta(days=31)"
# USE_X_SENDFILE="False"
# SERVER_NAME="None"
# APPLICATION_ROOT="/"
# SESSION_COOKIE_NAME="session"
# SESSION_COOKIE_DOMAIN="None"
# SESSION_COOKIE_PATH="None"
# SESSION_COOKIE_HTTPONLY="True"
# SESSION_COOKIE_SECURE="False"
# SESSION_COOKIE_SAMESITE="None"
# SESSION_REFRESH_EACH_REQUEST="True"
# MAX_CONTENT_LENGTH="None"
# SEND_FILE_MAX_AGE_DEFAULT="None"
# TRAP_BAD_REQUEST_ERRORS="None"
# TRAP_HTTP_EXCEPTIONS="False"
# EXPLAIN_TEMPLATE_LOADING="False"
# PREFERRED_URL_SCHEME="http"
# JSON_AS_ASCII="True"
# JSON_SORT_KEYS="True"
# JSONIFY_PRETTYPRINT_REGULAR="False"
# JSONIFY_MIMETYPE="application/json"
# TEMPLATES_AUTO_RELOAD="None"
# MAX_COOKIE_SIZE="4093"
1 change: 1 addition & 0 deletions .flaskenv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FLASK_APP="backend"
84 changes: 84 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: build

on:
push:
tags:
- '**'

env:
LEARNERS_VERSION: ${{ github.ref_name }}

jobs:
lint:
name: lint & check formatting
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.10']
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt update -y
sudo apt install python3-venv -y
sudo apt purge python3-blinker -y
curl https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py
python /tmp/get-pip.py
python -m pip install --upgrade pip setuptools wheel
python -m pip install .
- name: Lint with flake8
run: |
flake8 backend --count --exit-zero --max-complexity=10 --max-line-length=142 --statistics
- name: lint with black
uses: rickstaa/action-black@v1
with:
black_args: 'backend --check'
build_wheel:
name: build wheel
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v3
- name: build
run: |
sudo apt update -y
sudo apt install python3-venv -y
sudo apt purge python3-blinker -y
curl https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py
python /tmp/get-pip.py
python -m pip install --upgrade pip setuptools wheel build
python -m build
- name: Release to GitHub
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
dist/*.whl
dist/*.tar.gz
# - name: Release to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# password: ${{ secrets.PYPI_API_TOKEN }}

build_container:
name: build container
needs: build_wheel
runs-on: ubuntu-latest
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: get ghcr owner repository
run: |
echo "GHCR_OWNER=${GITHUB_REPOSITORY_OWNER,,}" >>${GITHUB_ENV}
- name: Build and push image
uses: docker/build-push-action@v3
with:
file: Containerfile
push: true
tags: |
ghcr.io/${{ env.GHCR_OWNER }}/learners:latest
ghcr.io/${{ env.GHCR_OWNER }}/learners:${{ github.ref_name }}
34 changes: 34 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: lint

on:
push:
paths:
- 'learners/**'
branches:
- master
pull_request:
jobs:
lint:
name: lint & check formatting
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.10']
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt update -y
sudo apt install python3-venv -y
sudo apt purge python3-blinker -y
curl https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py
python /tmp/get-pip.py
python -m pip install --upgrade pip setuptools wheel
python -m pip install .
- name: Lint with flake8
run: |
flake8 backend --count --exit-zero --max-complexity=10 --max-line-length=142 --statistics
- name: lint with black
uses: rickstaa/action-black@v1
with:
black_args: 'backend --check'
152 changes: 151 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,151 @@
.DS_Store
*.retry
.idea/
.envrc
backend/data.db
develop_config.yml
backend/statics/gen
backend/statics/hugo
backend/statics/uploads/*
backend/statics/documentation
backend/statics/exercises
rendered_hugo_content/
frontend/node_modules/
frontend/node_modules/
frontend/public
frontend/dist
frontend/.DS_Store
public

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# DOCKER
docker/backend/__data/data.db
docker/backend/__templates/*
docker/backend/__webroot/*

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
.db

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/


# Flask
.DS_Store
.env
*.pyc
*.pyo
env/
venv/
.venv/
env*
dist/
build/
*.egg
*.egg-info/
_mailinglist
.tox/
.cache/
.pytest_cache/
.idea/
docs/_build/
.vscode

# Coverage reports
htmlcov/
.coverage
.coverage.*
*,cover
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

repos:
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
1 change: 1 addition & 0 deletions backend/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def main():
app.register_blueprint(routes.stream_api)
app.register_blueprint(routes.questionnaires_api)
app.register_blueprint(routes.executions_api)
app.register_blueprint(routes.results_api)
app.register_blueprint(routes.comments_api)
app.register_blueprint(routes.cache_api)
app.register_blueprint(routes.callback_api)
Expand Down
Loading
Loading