-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
67 lines (60 loc) · 2.65 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
image: python:3.10-buster
# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
# Pip's cache doesn't store the python packages
# https://pip.pypa.io/en/stable/reference/pip_install/#caching
#
# If you want to also cache the installed packages, you have to install
# them in a virtualenv and cache it as well.
cache:
paths:
- .cache/pip
- venv/
stages:
- static-analysis
- test
- deploy
before_script:
- apt update && apt upgrade -y
- python -m venv venv && source venv/bin/activate && python --version
- pip install --upgrade pip && pip install -r requirements.txt
- pip install pdoc3 pytest flake8 flake8-bugbear pep8-naming flake8-builtins flake8-comprehensions
# We decide to not comply with PEP 8 on the following standards:
#
# - Line too long (E501): PEP 8 recommends line lengths to be no longer than 79 characters. I quote:
# Limiting the required editor window width makes it possible to have several files open side-by-side,
# and works well when using code review tools that present the two versions in adjacent columns.
# Since we are all adults with big HD monitors we conform with JetBrains standard of 120 characters.
# - Do not assign a lambda expression, use a def (E731): I think most of pythons beauty comes from the conciseness
# of the language. On the one hand, if a function is a one_liner, which is neither semantically part of the class
# nor used outside of single function, I don't want to assign it to another function. On the other hand,
# some predicates (a -> Bool) can be nontrivial. A variable name can fill the semantics gap.
# - Continuation line with same indent as next logical line (E125): PyCharms formatter doesn't implement that, therefore
# it will always break as we don't have any pre-commit stuff.
# - Name may be undefined, or defined from star imports: module (F405): This is just flake8 struggling, not an error
# - 'from module import *' used; unable to detect undefined names (F403): This is just flake8 struggling, not an error
flake8:
stage: static-analysis
script:
flake8 --version && flake8 --count --statistics --max-line-length=120 --ignore=E731,E125,F405,F403 --exclude=curvepy/tests/data curvepy
only:
- master
- merge_requests
unit-tests:
stage: test
script:
python -m pytest -s -v curvepy/tests
only:
- master
- merge_requests
pages:
stage: deploy
script:
- pdoc3 --html --config latex_math=True --force --output-dir public curvepy && mv public/curvepy/* public/ && rm -d public/curvepy
artifacts:
paths:
- public
only:
- master