Pamela Fox commited on
Commit
43c3bf3
·
1 Parent(s): 50baa51
Files changed (4) hide show
  1. .coverage +0 -0
  2. .github/workflows/check.yaml +31 -0
  3. README.md +10 -2
  4. requirements-dev.txt +3 -2
.coverage ADDED
Binary file (53.2 kB). View file
 
.github/workflows/check.yaml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Python checks
2
+ on: [push, pull_request]
3
+
4
+ jobs:
5
+ build:
6
+ runs-on: ubuntu-latest
7
+ steps:
8
+ - uses: actions/checkout@v3
9
+ - name: Set up Python 3
10
+ uses: actions/setup-python@v3
11
+ with:
12
+ python-version: 3.9
13
+ - name: Install dependencies
14
+ run: |
15
+ python -m pip install --upgrade pip
16
+ pip install -r requirements-dev.txt
17
+ - name: Lint with flake8
18
+ run: |
19
+ # stop the build if there are Python syntax errors or undefined names
20
+ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
21
+ # exit-zero treats all errors as warnings.
22
+ flake8 . --count --exit-zero --statistics
23
+ - name: Check formatting with black
24
+ uses: psf/black@stable
25
+ with:
26
+ src: ". quizsite/ quizzes/"
27
+ options: "--check --verbose"
28
+ - name: Run unit tests
29
+ run: |
30
+ coverage run --source='.' manage.py test quizzes
31
+ coverage report
README.md CHANGED
@@ -12,10 +12,11 @@ https://django-example-quizsite.azurewebsites.net/quizzes/
12
 
13
  ## Local development
14
 
15
- Install the requirements:
16
 
17
  ```
18
  pip install -r requirements-dev.txt
 
19
  ```
20
 
21
  Create a local PostGreSQL database called "quizsite"
@@ -33,6 +34,13 @@ Run the local server:
33
  python manage.py runserver
34
  ```
35
 
 
 
 
 
 
 
 
36
  ## Deployment
37
 
38
  The app is currently hosted on Microsoft Azure. Specifically:
@@ -42,4 +50,4 @@ The app is currently hosted on Microsoft Azure. Specifically:
42
 
43
  To deploy your own instance, follow the [tutorial for Django app + PostGreSQL deployment](https://docs.microsoft.com/en-us/azure/app-service/tutorial-python-postgresql-app?tabs=django%2Cwindows%2Cvscode-aztools%2Cterminal-bash%2Cazure-portal-access%2Cvscode-aztools-deploy%2Cdeploy-instructions-azportal%2Cdeploy-instructions--zip-azcli%2Cdeploy-instructions-curl-bash) but using this app instead of the sample app.
44
 
45
- Make sure you specify the following environment variables in the App Service configuration: `DBHOST`, `DBNAME`, `DBPASS`, `DBUSER`. The previously linked tutorial shows how to set these.
 
12
 
13
  ## Local development
14
 
15
+ Install the requirements and Git hooks:
16
 
17
  ```
18
  pip install -r requirements-dev.txt
19
+ pre-commit install
20
  ```
21
 
22
  Create a local PostGreSQL database called "quizsite"
 
34
  python manage.py runserver
35
  ```
36
 
37
+ Run tests:
38
+
39
+ ```
40
+ coverage run --source='.' manage.py test quizzes
41
+ coverage report
42
+ ```
43
+
44
  ## Deployment
45
 
46
  The app is currently hosted on Microsoft Azure. Specifically:
 
50
 
51
  To deploy your own instance, follow the [tutorial for Django app + PostGreSQL deployment](https://docs.microsoft.com/en-us/azure/app-service/tutorial-python-postgresql-app?tabs=django%2Cwindows%2Cvscode-aztools%2Cterminal-bash%2Cazure-portal-access%2Cvscode-aztools-deploy%2Cdeploy-instructions-azportal%2Cdeploy-instructions--zip-azcli%2Cdeploy-instructions-curl-bash) but using this app instead of the sample app.
52
 
53
+ Make sure you specify the following environment variables in the App Service configuration: `DBHOST`, `DBNAME`, `DBPASS`, `DBUSER`. The previously linked tutorial shows how to set these.
requirements-dev.txt CHANGED
@@ -1,4 +1,5 @@
1
  -r requirements.txt
2
- black==22.3.0
3
  pre-commit
4
- flake8
 
 
1
  -r requirements.txt
2
+ black
3
  pre-commit
4
+ flake8
5
+ coverage