Merge branch 'poetry' into 'master'

Add missing dependencies and improve pipeline

* Use black version specified in requirements for checking with black
* Check if pyproject.toml file is valid at CI level
* Build documentation in CI
* Add missing postgres dependencie

See merge request ae/Sith!284
This commit is contained in:
Théo | Ailé 2022-03-26 21:27:22 +00:00
commit 489a9378c5
2 changed files with 19 additions and 4 deletions

View File

@ -1,20 +1,30 @@
stages: stages:
- test - test
test: # Installs and launch unittests
unittests:
stage: test stage: test
script: script:
- env # Install dependencies
- apt-get update - apt-get update
- apt-get install -y gettext libxapian-dev libgraphviz-dev - apt-get install -y gettext libxapian-dev libgraphviz-dev
- pip install poetry - pip install poetry
- poetry install -E testing # Check pyproject.toml validity
- poetry check
# Install project
- poetry install -E testing -E docs
# Setup xapian index
- mkdir -p /dev/shm/search_indexes - mkdir -p /dev/shm/search_indexes
- ln -s /dev/shm/search_indexes sith/search_indexes - ln -s /dev/shm/search_indexes sith/search_indexes
# Setup project
- poetry run ./manage.py compilemessages - poetry run ./manage.py compilemessages
# Run tests and export report
- poetry run coverage run ./manage.py test - poetry run coverage run ./manage.py test
- poetry run coverage html - poetry run coverage html
- poetry run coverage report - poetry run coverage report
# Build documentation
- cd doc
- poetry run make html
variables: variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip_tests" PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip_tests"
cache: cache:
@ -23,11 +33,14 @@ test:
artifacts: artifacts:
paths: paths:
- coverage_report/ - coverage_report/
- docs/_build
# Check black
black: black:
stage: test stage: test
script: script:
- pip install -U black - version=$(cat pyproject.toml | grep --color=never black | grep --color=never -oE '[0-9]([0-9.a-z]+)')
- pip install black==$version
- black --check . - black --check .
variables: variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip_black" PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip_black"

View File

@ -38,8 +38,10 @@ libsass = "^0.21.0"
django-ordered-model = "^3.4.3" django-ordered-model = "^3.4.3"
django-simple-captcha = "^0.5.14" django-simple-captcha = "^0.5.14"
python-dateutil = "^2.8.2" python-dateutil = "^2.8.2"
psycopg2-binary = "^2.9.1"
sentry-sdk = "^1.4.3" sentry-sdk = "^1.4.3"
graphviz = "^0.17" graphviz = "^0.17"
Jinja2 = "<=3.0.3"
# Extra optional dependencies # Extra optional dependencies
mysqlclient = { version = "^2.0.3", optional = true } mysqlclient = { version = "^2.0.3", optional = true }