-
Notifications
You must be signed in to change notification settings - Fork 11
80 lines (68 loc) · 2.52 KB
/
database_ws.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
name: Create Giswater Schema SAMPLE (WS)
on:
push:
branches: [dev-3.6-manage-views]
pull_request:
branches: [dev-3.6-manage-views]
jobs:
setup-and-test-db:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r test/requirements.txt
- name: Setup PostgreSQL and PostGIS for Linux/macOS/Windows
uses: nyurik/action-setup-postgis@v2.1
with:
database: giswater_test_db
- name: Install pgrouting & postgis_raster
env:
PGPASSWORD: postgres
run: |
sudo apt-get install postgresql-14-pgrouting
psql -h localhost -U postgres -d giswater_test_db -c 'CREATE EXTENSION pgrouting;'
psql -h localhost -U postgres -d giswater_test_db -c 'CREATE EXTENSION postgis_raster;'
- name: Replace variables in SQL files
run: python test/replace_vars.py ws
- name: Create sample schema
env:
PGPASSWORD: postgres
run: python test/execute_sql_files.py ws
- name: Verify Database
env:
PGPASSWORD: postgres
run: |
# Check PostGIS version
postgis_version=$(psql -h localhost -U postgres -d giswater_test_db -t -c "SELECT postgis_full_version();")
if [ -z "$postgis_version" ]; then
echo "PostGIS extension not found or not installed correctly."
exit 1
else
echo "PostGIS version:"
echo "$postgis_version"
fi
# Check pgRouting version
pgrouting_version=$(psql -h localhost -U postgres -d giswater_test_db -t -c "SELECT * FROM pgr_version();")
if [ -z "$pgrouting_version" ]; then
echo "pgRouting extension not found or not installed correctly."
exit 1
else
echo "pgRouting version:"
echo "$pgrouting_version"
fi
# Check features
arcs=$(psql -h localhost -U postgres -d giswater_test_db -t -c "SELECT count(*) FROM ws_36.v_edit_arc;")
if [ -z "$arcs" ]; then
echo "No arcs found in the v_edit_arc table."
exit 1
else
echo "Arcs found:"
echo "$arcs"
fi