Skip to content

hotfix: fixed cache issue #145

hotfix: fixed cache issue

hotfix: fixed cache issue #145

Workflow file for this run

name: Automated CI PSQL testing
# This workflow run automatically for every commit on github it checks the syntax and launch the tests.
# | grep . | uniq -c filters out empty lines and then groups consecutive lines together with the number of occurrences
on:
push:
workflow_dispatch:
inputs:
comment:
description: Just a simple comment to know the purpose of the manual build
required: false
jobs:
build:
runs-on: ubuntu-20.04
services:
pgsql:
image: postgres
env:
DB_HOST: localhost
DB_PORT: 5432
POSTGRES_DB: imis
POSTGRES_USER: postgres
POSTGRES_PASSWORD: GitHub999
ports:
- 5432:5432
# needed because the mssql container does not provide a health check
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
python modules-requirements.py openimis.json > modules-requirements.txt
pip install -r modules-requirements.txt
- name: Environment info
run: |
pip list
export DBBRANCH="$([ $GITHUB_REF == 'main' ] && echo "main" || echo "develop")"
if [ ${GITHUB_REF##*/} = "develop" ]; then export DBBRANCH="main"; else export DBBRANCH="develop"; fi
echo "Branch ${GITHUB_REF##*/}, usign ${DBBRANCH} branch for database"
git clone --depth 1 --branch $DBBRANCH https://github.com/openimis/database_postgresql.git ./sql
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/postgresql-pgdg.list > /dev/null
sudo apt-get install postgresql-client
- name: Initialize DB
run: |
echo 'set search_path to public' >> ~/.psqlrc
PGPASSWORD=GitHub999 psql -U postgres -h localhost -d imis -U postgres -f ./sql/database\ scripts/00_dump.sql | grep . | uniq -c
PGPASSWORD=GitHub999 psql -U postgres -h localhost -d imis -U postgres -f ./sql/database\ scripts/02_aux_functions.sql | grep . | uniq -c
PGPASSWORD=GitHub999 psql -U postgres -h localhost -d imis -U postgres -f ./sql/database\ scripts/03_views.sql | grep . | uniq -c
PGPASSWORD=GitHub999 psql -U postgres -h localhost -d imis -U postgres -f ./sql/database\ scripts/04_functions.sql | grep . | uniq -c
PGPASSWORD=GitHub999 psql -U postgres -h localhost -d imis -U postgres -f ./sql/database\ scripts/05_stored_procs.sql | grep . | uniq -c
PGPASSWORD=GitHub999 psql -U postgres -h localhost -d imis -U postgres -f ./sql/database\ scripts/demo_db.sql | grep . | uniq -c
- name: Django tests
run: |
python -V
ls -l
cd openIMIS
ls -l
python manage.py test --keepdb $(jq -r '(.modules[]|.name)' ../openimis.json)
env:
SECRET_KEY: secret
DEBUG: true
DB_ENGINE: django.db.backends.postgresql
#DJANGO_SETTINGS_MODULE: hat.settings
DB_HOST: localhost
DB_PORT: 5432
DB_NAME: imis
DB_USER: postgres
DB_PASSWORD: GitHub999
#DEV_SERVER: true
SITE_ROOT: api