forked from PnX-SI/GeoNature
-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (128 loc) · 4.18 KB
/
cypress.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
name: Tests frontend
on:
push:
branches:
- master
- hotfixes
- develop
- fixtestfront
pull_request:
branches:
- master
- hotfixes
- develop
jobs:
mount_app_and_run_cypress:
runs-on: ubuntu-latest
strategy:
fail-fast: false
services:
postgres:
image: postgis/postgis:13-3.2
env:
POSTGRES_DB: geonature2db
POSTGRES_PASSWORD: geonatpasswd
POSTGRES_USER: geonatadmin
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Add postgis_raster database extension
run: |
psql -h localhost -U geonatadmin -d geonature2db -tc 'CREATE EXTENSION "postgis_raster";'
env:
PGPASSWORD: geonatpasswd
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Add database extensions
run: |
psql -h localhost -U geonatadmin -d geonature2db -f install/assets/db/add_pg_extensions.sql
env:
PGPASSWORD: geonatpasswd
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
# cache: 'pip'
- name: Install GDAL
run: |
sudo apt update
sudo apt install -y libgdal-dev
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install \
pytest-cov \
-e ..[tests] \
-r requirements-dev.txt
working-directory: ./backend
- name: Install database
run: |
install/03b_populate_db_for_test.sh
env:
GEONATURE_CONFIG_FILE: config/test_config.toml
# FRONTEND
- name: Cache node modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: generate frontend config
run: |
cp ./config/settings.ini.sample ./config/settings.ini
geonature generate_frontend_config
./install/05_install_frontend.sh --ci
env:
GEONATURE_CONFIG_FILE: "${{ github.workspace }}/config/test_config.toml"
- name: Show generated frontend config
run: |
cat ./frontend/src/conf/app.config.ts
- name: Install core modules
run: |
geonature install-gn-module contrib/occtax OCCTAX --build=false
geonature db upgrade occtax-samples-test@head
geonature install-gn-module contrib/gn_module_occhab OCCHAB --build=false
geonature db upgrade occhab-samples@head
geonature install-gn-module contrib/gn_module_validation VALIDATION --build=false
geonature permissions supergrant --group --nom "Grp_admin" --yes
env:
GEONATURE_CONFIG_FILE: config/test_config.toml
- name: Run GeoNature backend
run: geonature dev_back &
env:
GEONATURE_CONFIG_FILE: config/test_config.toml
- name: Run TaxHub backend
run: flask run --host=0.0.0.0 &
working-directory: ./backend/dependencies/TaxHub/
env:
TAXHUB_SETTINGS: test_config.py
TAXHUB_SQLALCHEMY_DATABASE_URI: "postgresql://geonatadmin:[email protected]:5432/geonature2db"
- name: Cypress run
uses: cypress-io/github-action@v5
with:
record: false
working-directory: ./frontend
start: npm run start
wait-on: http://127.0.0.1:4200
headless: true
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}