Skip to content

Add param USER_CAN_CANCEL #154

Add param USER_CAN_CANCEL

Add param USER_CAN_CANCEL #154

Workflow file for this run

name: pytest
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
env:
DEBIAN_FRONTEND: noninteractive
jobs:
build:
runs-on: ubuntu-20.04
strategy:
matrix:
os: [ubuntu-20.04]
tests-env: ['tests', 'tests_nds']
include:
- os: ubuntu-20.04
python-version: 3.8 # default python version in 20.04
name: ${{ matrix.name }}
services:
postgres:
image: postgis/postgis:12-2.5
env:
POSTGRES_DB: geotrekdb
POSTGRES_PASSWORD: geotrek
POSTGRES_USER: geotrek
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Add postgis_raster database extension
if: ${{ matrix.postgis-version >= 3 }}
run: |
psql -h localhost -U geotrek -d geotrekdb -tc 'CREATE EXTENSION "postgis_raster";'
env:
PGPASSWORD: geotrek
- name: Add database extensions
run: |
psql -h localhost -U geotrek -d geotrekdb -tc 'CREATE EXTENSION "hstore";'
psql -h localhost -U geotrek -d geotrekdb -tc 'CREATE EXTENSION "uuid-ossp";'
psql -h localhost -U geotrek -d geotrekdb -tc 'CREATE EXTENSION "pg_trgm";'
psql -h localhost -U geotrek -d geotrekdb -tc 'CREATE EXTENSION "unaccent";'
env:
PGPASSWORD: geotrek
- uses: actions/checkout@v2
with:
submodules: true
- name: Install Geotrek
run: |
echo "deb [arch=amd64] https://packages.geotrek.fr/ubuntu $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/geotrek.list
wget -O- "https://packages.geotrek.fr/geotrek.gpg.key" | sudo apt-key add -
sudo apt update
sudo apt install debconf-utils
cat << EOF | sudo debconf-set-selections
geotrek-admin geotrek-admin/POSTGRES_PASSWORD password geotrek
geotrek-admin geotrek-admin/SERVER_NAME string localhost
geotrek-admin geotrek-admin/SRID string 2154
geotrek-admin geotrek-admin/POSTGRES_HOST string localhost
geotrek-admin geotrek-admin/TIMEOUT string 300
geotrek-admin geotrek-admin/MANAGE_DB boolean false
geotrek-admin geotrek-admin/LANGUAGES string fr en
geotrek-admin geotrek-admin/POSTGRES_USER string geotrek
geotrek-admin geotrek-admin/POSTGRES_DB string geotrekdb
geotrek-admin geotrek-admin/POSTGRES_PORT string 5432
geotrek-admin geotrek-admin/DEFAULT_STRUCTURE string TEST
geotrek-admin geotrek-admin/RANDO_SERVER_NAME string *
geotrek-admin geotrek-admin/TIME_ZONE string Etc/GMT-1
geotrek-admin geotrek-admin/WORKERS string 4
EOF
sudo apt-get --quiet --yes install geotrek-admin
- name: Install database
run: |
psql -h localhost -d geotrekdb -U geotrek --set ON_ERROR_STOP=on -f create_db_structure.sql
working-directory: ./db
env:
PGPASSWORD: geotrek
VERBOSITY: verbose
- name: Install backend dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install pytest
python -m pip install pytest-flask
python -m pip install pytest-cov
working-directory: ./backend
- name: Install backend
run: |
cp -n config/conftest.py config/config.py
working-directory: ./backend
- name: Run pytests
run: |
pytest -v --cov --cov-report xml
working-directory: ./backend
env:
MAIL_SERVER: ${{secrets.MAIL_SERVER}}
MAIL_PORT: ${{secrets.MAIL_PORT}}
MAIL_USERNAME: ${{secrets.MAIL_USERNAME}}
MAIL_PASSWORD: ${{secrets.MAIL_PASSWORD}}
MAIL_DEFAULT_SENDER: ${{secrets.MAIL_USERNAME}}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
flags: pytest