Skip to content

Commit

Permalink
Merge 14255d5 into 9580eab
Browse files Browse the repository at this point in the history
  • Loading branch information
jashan-lco committed Nov 3, 2022
2 parents 9580eab + 14255d5 commit 43d0790
Show file tree
Hide file tree
Showing 11 changed files with 696 additions and 39 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ jobs:
- name: Install dependencies and setup
run: |
python -m pip install --upgrade pip
pip install -U coverage coveralls
pip install -r requirements.txt
python manage.py collectstatic
pip install -r .poetry-version
poetry install
poetry run python manage.py collectstatic
- name: Run tests
run: coverage run manage.py test --settings=test_settings
run: poetry run coverage run manage.py test --settings=test_settings
- name: Coveralls report
run: coveralls --service=github
run: poetry run coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/docs-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r .poetry-version
poetry install
- name: Build docs
run: |
python manage.py generateschema_mocked --file downtime.yaml --generator_class=downtime.schema.DowntimeSchemaGenerator
poetry run python manage.py generateschema_mocked --file downtime.yaml --generator_class=downtime.schema.DowntimeSchemaGenerator
npx redoc-cli bundle downtime.yaml
mkdir docs; mv redoc-static.html docs/downtime.html
- name: Deploy to GitHub Pages
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ target/
# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

Expand Down
1 change: 1 addition & 0 deletions .poetry-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
poetry==1.2.2
3 changes: 3 additions & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
3.7.13
3.8.13
3.9.13
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
FROM python:3.7-alpine
FROM python:3.9-alpine

WORKDIR /app

# Install Python dependencies
COPY requirements.txt .
RUN apk update && apk upgrade \
COPY pyproject.toml poetry.toml poetry.lock .poetry-version ./
RUN apk update && apk upgrade \
&& apk --no-cache add bash git openssh \
&& apk --no-cache add postgresql-libs \
&& apk --no-cache add --virtual .build-deps gcc postgresql-dev musl-dev \
&& pip --no-cache-dir install -U pip setuptools \
&& pip --no-cache-dir install -r .poetry-version \
&& poetry export > requirements.txt \
&& pip --no-cache-dir install -r requirements.txt \
&& apk --no-cache del .build-deps

Expand Down
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,17 @@ This project is configured using environment variables.

## Local Development

### **Set up a virtual environment**
### **Poetry**

Using a virtual environment is highly recommended. Run the following commands from the base of this project. `(env)`
is used to denote commands that should be run using your virtual environment.
Install Poetry using one of the methods described at https://python-poetry.org/docs/#installation.

python3 -m venv env
source env/bin/activate
(env) pip install -r requirements.txt
For example, using pipx:

pipx install poetry

Then install the project & its dependencies:

poetry install

### **Set up the database**

Expand All @@ -62,19 +65,19 @@ create a PostgreSQL database. Make sure that the options that you use to set up

Run database migrations to set up the tables in the database.

(env) python manage.py migrate
poetry run python manage.py migrate

### Run the tests

First collect the staticfiles since some of the tests check the admin page functionality

(env) python manage.py collectstatic
poetry run python manage.py collectstatic

(env) python manage.py test --settings=test_settings
poetry run python manage.py test --settings=test_settings

### Run the application

(env) python manage.py runserver
poetry run python manage.py runserver

The application should now be accessible from <http://127.0.0.1:8000>!

Expand All @@ -90,7 +93,7 @@ as part of an API POST.

There is also a django management command to create downtimes:

(env) python manage.py create_downtime help
poetry run python manage.py create_downtime help

## Example API queries

Expand Down
Loading

0 comments on commit 43d0790

Please sign in to comment.