Add dev guide and enforce code quality in github actions (#371)

* Add dev guide and enforce code quality in github actions

* Loosen minor version

* Rename file to align with index

* Change subsubsection for sphinx

* Fix dockerfile env

* Remove redundant exclude
This commit is contained in:
Chris Mitchell 2023-05-20 10:35:03 -04:00 committed by GitHub
parent 25c6bb6d2a
commit eae834a369
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 77 additions and 7 deletions

25
.github/workflows/code-quality.yml vendored Normal file
View File

@ -0,0 +1,25 @@
name: Code-Quality
on: [push]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 4
matrix:
python-version: [3.9]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install pre-commit
run: |
python -m pip install pre-commit
- name: Check pre-commit
run: |
pre-commit run -a

1
.gitignore vendored
View File

@ -52,6 +52,7 @@ coverage.xml
# Sphinx documentation
docs/_build/
docs/html/
# PyBuilder
target/

View File

@ -11,7 +11,6 @@ repos:
- id: black
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v2.7.1"
exclude: .*\.html
hooks:
- id: prettier
- repo: https://github.com/rtts/djhtml
@ -20,4 +19,4 @@ repos:
- id: djhtml
default_language_version:
python: python3.9.7
python: python3.9

View File

@ -26,6 +26,7 @@ USER wooey
RUN wooify -p ${WOOEY_PROJECT}
WORKDIR ${BUILD_DIR}/${WOOEY_PROJECT}
ENV PYTHONPATH=${BUILD_DIR}/${WOOEY_PROJECT}:${PYTHONPATH}
COPY docker/scripts/run-server run-server

View File

@ -6,7 +6,8 @@ services:
wooey:
volumes: &package-volumes
- ../wooey:$BUILD_DIR/wooey
- ../../clinto/clinto:/usr/local/lib/python3.6/site-packages/clinto
# Mount over the clinto parser install if desired.
# - ../../clinto/clinto:/usr/local/lib/python3.6/site-packages/clinto
ports:
- 8080:8080

View File

@ -1,2 +1,2 @@
#!/bin/bash
docker-compose run --rm wooey python manage.py "$@"
docker-compose run --rm wooey django-admin "$@"

43
docs/dev_setup.rst Normal file
View File

@ -0,0 +1,43 @@
Developer Setup
===============
Dev Environment
---------------
Docker
~~~~~~
The `docker` folder contains the Docker setup. Wooey can be built and run by simply
running
::
docker-compose up --build
To mount the local installation directory in the docker container, create a local version
of the docker-compose overrides by running
::
cp docker-compose.override.template.yml docker-compose.override.yml
Several convenience scripts exist for common scenarios:
* manage -- run a django-admin command
* run -- run a command in the wooey container. For example, a bash shell can be started by `run bash`
* run-server -- run the Django server that is locally accessible. This offers some advantages over `docker-compose up` such as allowing debugging via `pdb`
* test -- run all unit tests.
System
~~~~~~
For developers not using Docker, dependenices can be installed via
::
pip install .[dev]
Style
-----
`Pre-commit <https://pre-commit.com/>`_ is used to standardize the tools used for linting and code formatting.

View File

@ -44,10 +44,10 @@ Getting Started
security
Developers
==========
Contributing
============
.. toctree::
:maxdepth: 2
dev_install
dev_setup