Removing old settings from previous eCRVS integration #46
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Automated CI 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: | |
mssql: | |
image: mcr.microsoft.com/mssql/server:2017-latest | |
env: | |
ACCEPT_EULA: Y | |
SA_PASSWORD: GitHub999 | |
ports: | |
- 1433:1433 | |
# needed because the mssql container does not provide a health check | |
options: --health-interval=10s --health-timeout=3s --health-start-period=10s --health-retries=10 --health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P ${SA_PASSWORD} -Q 'SELECT 1' || exit 1" | |
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_ms_sqlserver.git ./sql | |
cd sql/ && bash concatenate_files.sh && cd .. | |
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - | |
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list | |
sudo apt-get update | |
sudo apt-get install mssql-tools unixodbc-dev jq | |
- name: Initialize DB | |
run: | | |
/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P $SA_PASSWORD -Q 'DROP DATABASE IF EXISTS imis' | |
/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P $SA_PASSWORD -Q 'CREATE DATABASE imis' | |
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -d imis -i sql/output/fullDemoDatabase.sql | grep . | uniq -c | |
env: | |
SA_PASSWORD: GitHub999 | |
- name: migrate DB | |
run: | | |
cd openIMIS | |
python manage.py migrate | |
python init_test_db.py | grep . | uniq -c | |
env: | |
SECRET_KEY: secret | |
DEBUG: true | |
#DJANGO_SETTINGS_MODULE: hat.settings | |
DB_HOST: localhost | |
DB_PORT: 1433 | |
DB_NAME: imis | |
DB_USER: sa | |
DB_PASSWORD: GitHub999 | |
#DEV_SERVER: true | |
SITE_ROOT: api | |
REMOTE_USER_AUTHENTICATION: True | |
- 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 | |
#DJANGO_SETTINGS_MODULE: hat.settings | |
DB_HOST: localhost | |
DB_PORT: 1433 | |
DB_NAME: imis | |
DB_USER: sa | |
DB_PASSWORD: GitHub999 | |
#DEV_SERVER: true | |
SITE_ROOT: api | |
REMOTE_USER_AUTHENTICATION: False |