-
Notifications
You must be signed in to change notification settings - Fork 12
154 lines (148 loc) · 6.42 KB
/
openmis-module-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
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:
pull_request:
workflow_dispatch:
inputs:
comment:
description: Just a simple comment to know the purpose of the manual build
required: false
jobs:
run_test:
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:
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: copy current branch
uses: actions/checkout@v2
with:
path: './new'
- name: generate new files
working-directory: ./new
run: bash script/concatenate_files.sh
- name: install linux packages
run: |
mkdir ./oldMain
git clone --depth 1 --branch main https://github.com/openimis/database_ms_sqlserver ./oldMain
cd oldMain
bash concatenate_files.sh
cd ..
mkdir ./1.42
wget https://raw.githubusercontent.com/openimis/database_ms_sqlserver/v1.4.2/Empty%20databases/openIMIS_ONLINE.sql -O 1.42/openIMIS_ONLINE.sql
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 ACCEPT_EULA=Y apt-get install -y mssql-tools build-essential dialog apt-utils unixodbc-dev jq -y
python -m pip install --upgrade pip
- name: DB migration 1.4.2
run: |
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -Q 'DROP DATABASE IF EXISTS imis_1_4_2'
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -Q 'CREATE DATABASE imis_1_4_2'
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -d imis_1_4_2 -i 1.42/openIMIS_ONLINE.sql | grep . | uniq -c
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -d imis_1_4_2 -i "new/output/fullMigrationScipt.sql" | grep . | uniq -c
env:
SA_PASSWORD: GitHub999
ACCEPT_EULA: Y
- name: Initialize DB latest
run: |
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -Q 'DROP DATABASE IF EXISTS imis'
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -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 "new/output/fullDemoDatabase.sql" | grep . | uniq -c
env:
SA_PASSWORD: GitHub999
ACCEPT_EULA: Y
- name: DB migration prev main
run: |
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -Q 'DROP DATABASE IF EXISTS imis_main'
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -Q 'CREATE DATABASE imis_main'
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -d imis_main -i "oldMain/output/fullDemoDatabase.sql" | grep . | uniq -cc
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -d imis_main -i "new/output/fullMigrationScipt.sql" | grep . | uniq -c
env:
SA_PASSWORD: GitHub999
ACCEPT_EULA: Y
- name: pull openimis backend
run: |
rm ./openimis -rf
git clone --depth 1 --branch develop https://github.com/openimis/openimis-be_py.git ./openimis
- name: Install openIMIS Python dependencies
working-directory: ./openimis
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
python modules-requirements.py openimis.json > modules-requirements.txt
cat modules-requirements.txt
pip install -r modules-requirements.txt
- name: Django tests latest
working-directory: ./openimis
run: |
python -V
ls -l
cd openIMIS
mkdir staticfiles
python manage.py migrate
python init_test_db.py | grep . | uniq -c
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
- name: Django tests 1.4.2
working-directory: ./openimis
run: |
python -V
ls -l
cd openIMIS
python manage.py migrate
python init_test_db.py | grep . | uniq -c
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_1_4_2
DB_USER: sa
DB_PASSWORD: GitHub999
#DEV_SERVER: true
SITE_ROOT: api
- name: Django tests last main
working-directory: ./openimis
run: |
python -V
ls -l
cd openIMIS
python manage.py migrate
python init_test_db.py | grep . | uniq -c
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_main
DB_USER: sa
DB_PASSWORD: GitHub999
#DEV_SERVER: true
SITE_ROOT: api