Skip to content

Commit 802d53b

Browse files
committed
use reusable pytest action from geonature
1 parent ef10ffa commit 802d53b

1 file changed

Lines changed: 9 additions & 108 deletions

File tree

.github/workflows/pytest.yml

Lines changed: 9 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -7,123 +7,24 @@ on:
77
branches:
88
- main
99
- hotfixes
10-
- develop
10+
- develop
1111
pull_request:
1212
paths:
1313
- 'backend/**'
1414
branches:
1515
- main
1616
- hotfixes
17-
- develop
17+
- develop
1818

1919
jobs:
2020
build:
21-
22-
runs-on: ubuntu-latest
23-
2421
strategy:
2522
fail-fast: false
2623
matrix:
27-
include:
28-
- debian-version: '11'
29-
python-version: '3.9'
30-
postgres-version: '13'
31-
postgis-version: '3.2'
32-
- debian-version: '12'
33-
python-version: '3.11'
34-
postgres-version: '15'
35-
postgis-version: '3.3'
36-
37-
name: ${{ matrix.name }}
38-
39-
services:
40-
postgres:
41-
image: postgis/postgis:${{ matrix.postgres-version }}-${{ matrix.postgis-version }}
42-
env:
43-
POSTGRES_DB: geonature2db
44-
POSTGRES_PASSWORD: geonatpasswd
45-
POSTGRES_USER: geonatadmin
46-
ports:
47-
- 5432:5432
48-
options: >-
49-
--health-cmd pg_isready
50-
--health-interval 10s
51-
--health-timeout 5s
52-
--health-retries 5
53-
redis:
54-
image: redis
55-
ports:
56-
- 6379:6379
57-
options: >-
58-
--health-cmd "redis-cli ping"
59-
--health-interval 10s
60-
--health-timeout 5s
61-
--health-retries 5
62-
63-
steps:
64-
- name: Add postgis_raster database extension
65-
if: ${{ matrix.postgis-version >= 3 }}
66-
run: |
67-
psql -h localhost -U geonatadmin -d geonature2db -tc 'CREATE EXTENSION "postgis_raster";'
68-
env:
69-
PGPASSWORD: geonatpasswd
70-
- name: Add database extensions
71-
run: |
72-
psql -h localhost -U geonatadmin -d geonature2db -tc 'CREATE EXTENSION "hstore";'
73-
psql -h localhost -U geonatadmin -d geonature2db -tc 'CREATE EXTENSION "uuid-ossp";'
74-
psql -h localhost -U geonatadmin -d geonature2db -tc 'CREATE EXTENSION "pg_trgm";'
75-
psql -h localhost -U geonatadmin -d geonature2db -tc 'CREATE EXTENSION "unaccent";'
76-
psql -h localhost -U geonatadmin -d geonature2db -tc 'CREATE EXTENSION "ltree";'
77-
env:
78-
PGPASSWORD: geonatpasswd
79-
- uses: actions/checkout@v2
80-
with:
81-
submodules: recursive
82-
- name: Set up Python ${{ matrix.python-version }}
83-
uses: actions/setup-python@v2
84-
with:
85-
python-version: ${{ matrix.python-version }}
86-
- name: Install GDAL
87-
run: |
88-
sudo apt update
89-
sudo apt install -y libgdal-dev
90-
- name: Install dependencies
91-
run: |
92-
python -m pip install --upgrade pip
93-
python -m pip install \
94-
-e ..[tests] \
95-
-r requirements-dev.txt
96-
working-directory: ./dependencies/GeoNature/backend
97-
- name: Install monitoring module
98-
run: |
99-
python -m pip install -e .
100-
working-directory: .
101-
- name: Install database
102-
run: |
103-
dependencies/GeoNature/install/03b_populate_db.sh
104-
env:
105-
GEONATURE_CONFIG_FILE: dependencies/GeoNature/config/test_config.toml
106-
srid_local: 2154
107-
install_bdc_statuts: false
108-
taxref_region: fr
109-
add_sample_data: true
110-
install_sig_layers: true
111-
install_grid_layer_5: false
112-
install_grid_layer_10: false
113-
install_ref_sensitivity: false
114-
- name: Install monitoring module database
115-
run: |
116-
geonature upgrade-modules-db MONITORINGS
117-
env:
118-
GEONATURE_CONFIG_FILE: dependencies/GeoNature/config/test_config.toml
119-
- name: Test with pytest
120-
run: |
121-
pytest -v --cov --cov-report xml
122-
env:
123-
GEONATURE_CONFIG_FILE: dependencies/GeoNature/config/test_config.toml
124-
- name: Upload coverage to Codecov
125-
if: ${{ matrix.debian-version == '12' }}
126-
uses: codecov/codecov-action@v4
127-
with:
128-
flags: pytest
129-
token: ${{ secrets.CODECOV_TOKEN }}
24+
geonature_ref: ["develop"] # Mettre version compatible
25+
uses: pnx-si/geonature/.github/workflows/gn-module-pytest.yml@develop
26+
with:
27+
geonature_ref: ${{ matrix.geonature_ref }}
28+
upload_coverage: true
29+
secrets:
30+
codecov_token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)