Commit 89c89f31 authored by Jibril Mammeri's avatar Jibril Mammeri
Browse files

Black, Flake8, gitlab ci

parent f9749468
Pipeline #45427 passed with stage
# Workflow determines rules for the entire pipeline
# here pipeline runs for MASTER branch
workflow:
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
- if: '$CI_COMMIT_BRANCH == "44-improve-doc"'
default:
before_script:
# /dev/random is super slow
# https://www.tango-controls.org/community/forum/c/platforms/gnu-linux/device-server-gets-stuck-then-works-as-expected/
# https://stackoverflow.com/questions/26021181/not-enough-entropy-to-support-dev-random-in-docker-containers-running-in-boot2d
- rm /dev/random
- ln -s /dev/urandom /dev/random
# set pip cache to the Docker volume
- echo ${CI_PROJECT_DIR}
- export PIP_CACHE_DIR="/opt/cache/pip"
- /opt/conda/bin/conda init && source /root/.bashrc
- conda config --prepend channels tango-controls
- conda config --prepend channels esrf-bcu
- conda config --prepend channels conda-forge
stages:
- style
- build
check_style_master:
stage: style
image: continuumio/miniconda3:latest
only:
- master
tags:
- bliss_master
script:
- pip install -r requirements-dev.txt
# run black
- LC_ALL=C.UTF-8 black --check --safe $(git diff origin/$COMPARE_BRANCH_NAME... --diff-filter=ACMR --name-only | grep \\.py$)
create_user_doc:
stage: build
image: continuumio/miniconda3:latest
script:
# install opengl libraries (needed to avoid problem with pyopengl dependency)
- apt-get update && apt-get -y install libgl1-mesa-glx
# create doc env and install all requirements
- conda create -q --yes --name mkdocsenv --file requirements-doc-conda.txt
- source activate mkdocsenv
# build of documentation (-s : strict : fail on warnings)
- cd doc && mkdocs build --site-dir site
artifacts:
paths:
- doc/site
expire_in: 7 days
needs: [] # this job has no dependency, will start without waiting for previous stages to complete
repos:
- repo: https://github.com/psf/black
rev: 18.6b4
hooks:
- id: black
language_version: python3 # Should be >= 3.6
- repo: local
hooks:
- id: flake8-diff
name: flake8-diff
description: Run flake8 linter on diff lines of stage area
language: script
entry: ./flake8-diff.sh
verbose: true # force output when the hook passes
......@@ -3,6 +3,6 @@ repo_name: 'tomo/ebs-tomo'
repo_url: 'https://gitlab.esrf.fr/tomo/ebs-tomo'
use_directory_urls: false
theme: readthedocs
pages:
nav:
- Overview: index.md
- Acquisition Scans: acq_scans.md
#!/usr/bin/env bash
# Run flake8 linter on diff lines of stage area
# - never fails (always exit 0)
# => errors are reported for information purpose only
git diff --no-ext-diff --cached -U0 | flake8 --diff --exit-zero
black==18.6b4
flake8
\ No newline at end of file
# Conda requirement file
# Documentation requirements
sphinx
graphviz
pygments
markdown-inline-graphviz
markdown>=3.2
mkdocs>=1.1
mkdocs-material==5.5.14
mkdocs-material-extensions>=1.0
pymdown-extensions>=6.3
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment