Skip to content

[Dépôt de besoin] Permettre aux admin d'indiquer que le besoin n'a PA… #4325

[Dépôt de besoin] Permettre aux admin d'indiquer que le besoin n'a PA…

[Dépôt de besoin] Permettre aux admin d'indiquer que le besoin n'a PA… #4325

Workflow file for this run

name: Test & Lint tasks
on: [push]
jobs:
linting_check:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.10.6]
env:
DJANGO_SETTINGS_MODULE: config.settings.test
DJANGO_SECRET_KEY: ministryofsillywalks
PYTHONPATH: .
POSTGRESQL_ADDON_HOST: localhost
POSTGRESQL_ADDON_DB: postgres
POSTGRESQL_ADDON_USER: postgres
POSTGRESQL_ADDON_PASSWORD: postgres
CELLAR_ADDON_KEY_ID: TheMeaningOfLife
CELLAR_ADDON_KEY_SECRET: "42"
CELLAR_ADDON_HOST: example.com
services:
postgres:
# Docker Hub image
image: postgis/postgis:14-3.1
env:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v3
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.10.6
#----------------------------------------------
# install & configure poetry
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/[email protected]
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install Python dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Install System dependencies
run: |
sudo apt-get update
sudo apt-get -y install gdal-bin
#----------------------------------------------
# install your root project
#----------------------------------------------
- name: 📥 Install dependencies
run: poetry install --no-interaction
#----------------------------------------------
# migration checks
#----------------------------------------------
# - name: 💾 Create a database to check migrations
# run: |
# psql <<SQL
# CREATE DATABASE marche;
# SQL
- name: 🚧 Check pending migrations
run: |
source .venv/bin/activate
python manage.py makemigrations --check --dry-run --noinput
#----------------------------------------------
# run lint suite
# Why not install default flake8 or pylint ?
# Because we use pyproject.toml config file, and
# prefer locally reproducible tests.
#----------------------------------------------
- name: ✨ Run Linters
run: |
source .venv/bin/activate
echo "flake8"
pflake8 "./lemarche"
echo "black"
black . --check
echo "isort"
isort ./lemarche/*.py --check-only
#----------------------------------------------
# run tests
# collectstatic needed for selenium tests
#----------------------------------------------
- name: 🤹‍ Run Tests
run: |
source .venv/bin/activate
python manage.py collectstatic
coverage run --source='./lemarche' ./manage.py test --parallel
coverage report