feat(CI) add ci for eval perf #3359
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: 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.sh | |
env: | |
GEONATURE_CONFIG_FILE: config/test_config.toml | |
srid_local: 2154 | |
install_bdc_statuts: true | |
add_sample_data: true | |
install_sig_layers: true | |
install_grid_layer_5: true | |
install_grid_layer_10: true | |
install_ref_sensitivity: true | |
# 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 | |
./install/05_install_frontend.sh --ci | |
env: | |
GEONATURE_CONFIG_FILE: "${{ github.workspace }}/config/test_config.toml" | |
- 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:geonatpasswd@127.0.0.1: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 | |
env: | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |