Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: re-organize test app #324

Merged
merged 2 commits into from
May 13, 2023
Merged
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
22 changes: 13 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,29 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
tests/requirements.txt

- name: Install Dependencies
run: |
pip install -r requirements.txt
pip install .
cd tests
python -m pip install --upgrade pip
python -m pip install -r requirements.txt

- name: Install Wagtail package
if: ${{ matrix.wagtail-version != 'main' }}
run: |
pip install wagtail==${{ matrix.wagtail-version }}
python -m pip install wagtail==${{ matrix.wagtail-version }}

- name: Install Wagtail main
if: ${{ matrix.wagtail-version == 'main' }}
run: |
git clone https://github.com/wagtail/wagtail.git
pip install ./wagtail
python -m pip install ./wagtail

- name: Run Tests
run: |
cd example
cd tests
python manage.py migrate
python manage.py test

Expand All @@ -76,15 +79,16 @@ jobs:
python-version: 3.8
cache: 'pip'
cache-dependency-path: |
requirements-channels.txt
tests/requirements-channels.txt

- name: Install Dependencies
run: |
pip install -r requirements-channels.txt
pip install .
cd tests
python -m pip install --upgrade pip
python -m pip install -r requirements-channels.txt

- name: Run Tests
run: |
cd example
cd tests
python manage.py migrate
python manage.py test
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
### Django ###
*.log
*.pot
*.pyc
__pycache__/
local_settings.py
media
Expand Down Expand Up @@ -139,3 +138,7 @@ Temporary Items
*.sublime-workspace
.vscode
.idea


# wagtail
tests/static/
10 changes: 4 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,20 @@ ENV DJANGO_ENV dev
COPY ./grapple /code/grapple
COPY ./setup.cfg /code/setup.cfg
COPY ./setup.py ./code/setup.py
COPY ./requirements-channels.txt /code/requirements-channels.txt
COPY ./requirements.txt /code/requirements.txt

# copy example site requires file
COPY ./example/requirements.txt /code/example/requirements.txt
COPY ./example/requirements-channels.txt /code/example/requirements-channels.txt
COPY ./tests/requirements.txt /code/tests/requirements.txt
COPY ./tests/requirements-channels.txt /code/tests/requirements-channels.txt

WORKDIR /code/example
WORKDIR /code/tests

RUN pip install --upgrade pip
# Install any needed packages specified in requirements.txt
RUN pip install -r ./requirements-channels.txt
RUN pip install gunicorn

# Copy the current directory contents into the container at /code/
COPY ./example /code/example
COPY ./tests /code/tests
# Set the working directory to /code/

RUN python manage.py migrate
Expand Down
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,23 +175,22 @@ Any contributions [you make](https://github.com/torchbox/wagtail-grapple/graphs/

### Local development

#### With SQLite
- In the Python environment of your choice, navigate to `/example`
- Run `pip install -r requirements.txt`
- Run `./manage.py migrate`
- Run server `./manage.py runserver`
- Run tests `./manage.py test`
- In the Python environment of your choice, navigate to `tests/`
- Run `python -m pip install -r requirements.txt`
- Run `python manage.py migrate`
- Run server `python manage.py runserver`
- Run tests `python manage.py test`

#### With Postgres

- In the Python environment of your choice, navigate to `/example`
- Run `pip install -r requirements.txt`
- Ensure you have docker and docker compose
- Run `docker compose up`
- Run `export DATABASE_URL="postgres://postgres:postgres@localhost/postgres"`
- Run `./manage.py migrate`
- Run server `./manage.py runserver`
- Run tests `./manage.py test`
- In the Python environment of your choice, navigate to `tests/`
- Run `python -m pip install -r requirements.txt`
- Run `python manage.py migrate`
- Run server `python manage.py runserver`
- Run tests `python manage.py test`

## Compatibility

Expand Down
83 changes: 0 additions & 83 deletions example/documents/migrations/0001_initial.py

This file was deleted.

12 changes: 0 additions & 12 deletions example/documents/models.py

This file was deleted.

Empty file removed example/example/__init__.py
Empty file.
Empty file.
18 changes: 0 additions & 18 deletions example/example/settings/dev.py

This file was deleted.

8 changes: 0 additions & 8 deletions example/example/settings/production.py

This file was deleted.

Empty file.
Empty file.
Empty file removed example/example/tests/__init__.py
Empty file.
Empty file removed example/home/__init__.py
Empty file.
Loading