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

test: docker test #60

Merged
merged 5 commits into from
Jan 13, 2024
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
52 changes: 52 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Docker test suite

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

jobs:
pytest:
name: Docker test build
# List of supported runners:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Pre-build container images
run: |
docker network create djangocmsnet
docker compose build --force-rm

- name: Run the containers
run: |
docker compose build web
docker compose up database_default -d
sleep 2s
docker compose run web python manage.py migrate
docker compose up -d

- name: 'debug: Display state and logs'
if: always()
run: |
docker compose ps
docker compose logs web
docker compose logs database_default

- name: Execute django check
run: docker compose exec -w /app web python manage.py check --deploy

- name: Execute test suite
run: docker compose exec -w /app web python manage.py test

- name: Terminate all components
if: always()
run: docker compose down -v
61 changes: 0 additions & 61 deletions .github/workflows/pythonpackage.yml

This file was deleted.

10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
FROM python:3.11

WORKDIR /app
COPY . /app
RUN pip install -r requirements.txt

COPY . .

RUN python -m pip install --upgrade pip
RUN python -m pip install -r requirements.txt

RUN python manage.py collectstatic --noinput

CMD uwsgi --http=0.0.0.0:80 --module=backend.wsgi