-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
133 lines (118 loc) · 4.09 KB
/
.gitlab-ci.yml
File metadata and controls
133 lines (118 loc) · 4.09 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
image: python:3.10
stages:
- linting
- testing
- security
- docs
- package
- release
# 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"
before_script:
#- python --version # For debugging
- export PIP_ROOT_USER_ACTION=ignore # surpress the warning
- pip install --upgrade pip
- pip install --user --no-warn-script-location -r requirements.txt # install dependencies from file
PEP8:
stage: linting
needs: []
script:
- pip install flake8
- flake8 --count --max-line-length=88 .
Pylint:
stage: linting
needs: []
script:
- mkdir -p public/badges public/lint
- echo undefined > public/badges/$CI_JOB_NAME.score
- pip install pylint-gitlab
- pylint --rcfile='plotid/.pylintrc' --output-format=text $(find -type f -name "*.py" ! -path "**/env*/**") | tee /tmp/pylint.txt
- sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' /tmp/pylint.txt > public/badges/$CI_JOB_NAME.score
- pylint --rcfile='plotid/.pylintrc' --output-format=pylint_gitlab.GitlabCodeClimateReporter $(find -type f -name "*.py" ! -path "**/env*/**") > codeclimate.json
- pylint --rcfile='plotid/.pylintrc' --output-format=pylint_gitlab.GitlabPagesHtmlReporter $(find -type f -name "*.py" ! -path "**/env*/**") > public/lint/index.html
after_script:
- anybadge --overwrite --label $CI_JOB_NAME --value=$(cat public/badges/$CI_JOB_NAME.score) --file=public/badges/$CI_JOB_NAME.svg 4=red 6=orange 8=yellow 10=green
- anybadge --overwrite --label="code style" --value=black --file=public/badges/code_style.svg --color=black
artifacts:
paths:
- public
reports:
codequality: codeclimate.json
when: always
Autoformatting:
stage: linting
needs: []
script:
- pip install black
- black --check --verbose --diff --color .
Typechecker:
stage: linting
needs: []
script:
- pip install mypy
- mypy --ignore-missing-imports --strict plotid examples
allow_failure: true
test:
stage: testing
needs: []
tags:
- docker
script:
- python tests/runner_tests.py
coverage: "/TOTAL.*\\s+(\\d+\\.\\d+%)$/"
pages:
stage: docs
script:
- pip install -U sphinx sphinx-autoapi sphinx_rtd_theme myst-parser # sphinx_panels
- cd docs
- make html
- mv build/html/* ../public/
artifacts:
paths:
- public
rules:
- if: "$CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH"
sast:
before_script:
- echo "No before script pls"
variables:
SAST_EXCLUDED_PATHS: spec, tests, tmp
stage: security
tags:
- docker
dependency_scanning:
before_script:
- echo "No before script pls"
stage: security
include:
- template: Security/SAST.gitlab-ci.yml
- template: Security/Dependency-Scanning.gitlab-ci.yml
build_and_upload:
stage: package
script:
- pip install build twine
- python3 -m build
- TWINE_PASSWORD=${CI_PYPI_TOKEN} TWINE_USERNAME=__token__ python3 -m twine upload dist/*
rules:
- if: $CI_COMMIT_TAG
release_job:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG # Run this job when a tag is created
before_script:
- echo "No before script pls"
script:
- echo "running release_job"
release: # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties
tag_name: '$CI_COMMIT_TAG'
description: '$CI_COMMIT_TAG'
# You can override the included template(s) by including variable overrides
# SAST customization: https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings
# Secret Detection customization: https://docs.gitlab.com/ee/user/application_security/secret_detection/#customizing-settings
# Dependency Scanning customization: https://docs.gitlab.com/ee/user/application_security/dependency_scanning/#customizing-the-dependency-scanning-settings
# Container Scanning customization: https://docs.gitlab.com/ee/user/application_security/container_scanning/#customizing-the-container-scanning-settings
# Note that environment variables can be set in several places
# See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence