Skip to content

Commit

Permalink
TESTING gh actions workflow
Browse files Browse the repository at this point in the history
Co-authored-by: Marcus Baw <[email protected]>

Signed-off-by: anchit-chandran <[email protected]>
  • Loading branch information
anchit-chandran committed Jul 11, 2023
1 parent e4dc273 commit 68da38a
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 19 deletions.
36 changes: 25 additions & 11 deletions .github/workflows/test-workflow-temp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,56 @@ name: Temp workflow to test Pytest Suite
on:
push:
branches:
- "*"
- "add-cicd-auto-pytest"
workflow_dispatch:

jobs:
build-and-deploy:
runs-on: ubuntu-latest

environment:
name: 'development'
name: "development"
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: github_actions
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v3

- name: List all files
run: ls -al

- name: Set up Python version
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: "3.10"

- name: Install PostGIS dependencies
run: sudo apt-get install -y binutils libproj-dev gdal-bin libgdal-dev python3-gdal

- name: Create and start virtual environment
run: |
python -m venv venv
source venv/bin/activate
# python dependencies
- name: Install dependencies
run: pip install -r requirements.txt
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
# Run Pytests
- name: Run migrations
run: python manage.py migrate
- name: Pytest Suite
run: pytest



21 changes: 13 additions & 8 deletions rcpch-audit-engine/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,6 @@
# Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases


# Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases


DATABASES = {
"default": {
"ENGINE": "django.contrib.gis.db.backends.postgis",
Expand All @@ -139,12 +134,22 @@
"PASSWORD": os.environ.get("E12_POSTGRES_DB_PASSWORD"),
"HOST": os.environ.get("E12_POSTGRES_DB_HOST"),
"PORT": os.environ.get("E12_POSTGRES_DB_PORT"),
"TEST": {
"NAME": "e12TestDb",
},
}
}

# TO SET UP TESTDB DURING GITHUB ACTIONS WORKFLOW
if os.environ.get('GITHUB_WORKFLOW'):
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'github_actions',
'USER': 'postgres',
'PASSWORD': 'postgres',
'HOST': '127.0.0.1',
'PORT': '5432',
}
}


# Password validation
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
Expand Down

0 comments on commit 68da38a

Please sign in to comment.