Skip to content

Commit

Permalink
Merge pull request #2 from MrHamedi/root
Browse files Browse the repository at this point in the history
github actions added
  • Loading branch information
MrHamedi authored Nov 20, 2023
2 parents cf0e550 + 7f83edc commit 5d7677d
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 4 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---

name: checks
on: [push]
jobs:
test:
name: unit tests
runs-on: ubuntu-20.04
services:
db:
image: postgres:15-alpine
env:
POSTGRES_DB: ${{ secrets.DB_NAME }}
POSTGRES_USER: ${{ secrets.DB_USER }}
POSTGRES_PASSWORD: ${{ secrets.DB_PASSWORD }}
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3


steps:
- name: Login with actions
uses: docker/login-action@v1
with:
username: ${{secrets.DOCKERHUB_USER}}
password: ${{secrets.DOCKERHUB_TOKEN}}

- name: check out
uses: actions/checkout@v2

- name: Set up project secrets
env:
SECRET_KEY: ${{ secrets.SECRET_KEY }}
DB_USER: ${{ secrets.DB_USER }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
DB_NAME: ${{ secrets.DB_NAME }}
run: |
echo "SECRET_KEY=${SECRET_KEY}" >> $GITHUB_ENV
echo "DB_USER=${DB_USER}" >> $GITHUB_ENV
echo "DB_PASSWORD=${DB_PASSWORD}" >> $GITHUB_ENV
echo "DB_NAME=${DB_NAME}" >> $GITHUB_ENV
- name: Test
run: docker compose run --rm gap sh -c "python3 manage.py test"
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ services:
- DB_HOST=${DB_HOST}
- DB_PASSWORD=${DB_PASSWORD}
- DB_PORT=${DB_PORT}
- DEBUG=${DEBUG}
command: >
sh -c "python manage.py makemigrations &&
python manage.py migrate &&
gunicorn gap.wsgi:application --bind 0.0.0.0:8000 --reload"
depends_on:
- db
tty: true
db:
image: postgres:15-alpine
volumes:
Expand Down
3 changes: 1 addition & 2 deletions src/gap/settings/dev.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from .base import *


ALLOWED_HOSTS = ["0.0.0.0", "localhost"]
DEBUG=True
2 changes: 1 addition & 1 deletion src/gap/settings/production.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .base import *

ALLOWED_HOSTS = ["127.0.0.1:8000"]
ALLOWED_HOSTS = ["localhost"]
DEBUG=False

0 comments on commit 5d7677d

Please sign in to comment.