gitlab-projects-settings 4.2.1__tar.gz → 5.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. gitlab_projects_settings-5.2.1/.cz.yaml +188 -0
  2. gitlab_projects_settings-5.2.1/.gitlab-ci.yml +428 -0
  3. gitlab_projects_settings-5.2.1/.hooks/configurations.py +248 -0
  4. gitlab_projects_settings-5.2.1/.hooks/manage +173 -0
  5. gitlab_projects_settings-5.2.1/.hooks/prepare_commit_msg_template.py +253 -0
  6. gitlab_projects_settings-5.2.1/.pre-commit-config.yaml +74 -0
  7. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/.vscode/extensions.json +0 -2
  8. gitlab_projects_settings-5.2.1/CHANGELOG.md +399 -0
  9. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/LICENSE +1 -1
  10. {gitlab_projects_settings-4.2.1/gitlab_projects_settings.egg-info → gitlab_projects_settings-5.2.1}/PKG-INFO +94 -25
  11. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/README.md +86 -16
  12. gitlab_projects_settings-5.2.1/config/cliff.toml +100 -0
  13. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1/gitlab_projects_settings.egg-info}/PKG-INFO +94 -25
  14. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/gitlab_projects_settings.egg-info/SOURCES.txt +7 -3
  15. gitlab_projects_settings-5.2.1/requirements/quality.txt +5 -0
  16. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/setup.py +28 -16
  17. gitlab_projects_settings-5.2.1/src/__init__.py +5 -0
  18. gitlab_projects_settings-5.2.1/src/__main__.py +5 -0
  19. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/src/cli/entrypoint.py +262 -27
  20. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/src/cli/main.py +212 -23
  21. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/src/features/gitlab.py +197 -22
  22. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/src/package/bundle.py +7 -1
  23. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/src/package/settings.py +4 -0
  24. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/src/package/updates.py +33 -21
  25. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/src/package/version.py +1 -1
  26. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/src/prints/colors.py +1 -1
  27. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/src/system/platform.py +1 -1
  28. gitlab_projects_settings-5.2.1/src/types/environments.py +92 -0
  29. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/src/types/gitlab.py +36 -0
  30. gitlab_projects_settings-4.2.1/.chglog/CHANGELOG.tpl.md +0 -30
  31. gitlab_projects_settings-4.2.1/.chglog/changelog.sh +0 -50
  32. gitlab_projects_settings-4.2.1/.chglog/config.yml +0 -35
  33. gitlab_projects_settings-4.2.1/.gitlab-ci.yml +0 -333
  34. gitlab_projects_settings-4.2.1/CHANGELOG.md +0 -215
  35. gitlab_projects_settings-4.2.1/requirements/quality.txt +0 -5
  36. gitlab_projects_settings-4.2.1/src/__init__.py +0 -5
  37. gitlab_projects_settings-4.2.1/src/__main__.py +0 -5
  38. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/.gitignore +0 -0
  39. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/.markdownlint.json +0 -0
  40. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/.style.yapf +0 -0
  41. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/.vscode/settings.json +0 -0
  42. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/gitlab_projects_settings.egg-info/dependency_links.txt +0 -0
  43. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/gitlab_projects_settings.egg-info/entry_points.txt +0 -0
  44. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/gitlab_projects_settings.egg-info/requires.txt +0 -0
  45. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/gitlab_projects_settings.egg-info/top_level.txt +0 -0
  46. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/mypy.ini +0 -0
  47. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/requirements/build.txt +0 -0
  48. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/requirements/deploy.txt +0 -0
  49. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/requirements/runtime.txt +0 -0
  50. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/setup.cfg +0 -0
  51. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/src/cli/__init__.py +0 -0
  52. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/src/features/__init__.py +0 -0
  53. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/src/package/__init__.py +0 -0
  54. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/src/prints/__init__.py +0 -0
  55. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/src/prints/boxes.py +0 -0
  56. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/src/prints/themes.py +0 -0
  57. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/src/system/__init__.py +0 -0
  58. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/src/types/__init__.py +0 -0
  59. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/src/types/namespaces.py +0 -0
  60. {gitlab_projects_settings-4.2.1 → gitlab_projects_settings-5.2.1}/src/types/strings.py +0 -0
@@ -0,0 +1,188 @@
1
+ ---
2
+ commitizen:
3
+
4
+ # commitizen configurations
5
+ always_signoff: true
6
+ bump_message: 'docs(changelog): regenerate release tag changes history'
7
+ changelog_incremental: false
8
+ major_version_zero: true
9
+ retry_after_failure: false
10
+ tag_format: $version
11
+ update_changelog_on_bump: false
12
+ use_shortcuts: true
13
+ version_provider: scm
14
+ version_scheme: pep440
15
+
16
+ # commitizen rules
17
+ # - Based upon 'cz_conventional_commits' original rules for Conventional Commits
18
+ # - Improved with 'Issue:' detailed messages examples and 'Signed-off-by' footer
19
+ # - Commit scope turned mandatory by the rules
20
+ # - Commit scope refactored with support for spaces and comma
21
+ # - Breaking change reimplemented with the standard '!' scope suffix
22
+ # - Questions simplified for professional usage
23
+ # - Type 'security' implemented for security related commits
24
+ # - Accept temporary commits starting with 'wip' or 'WIP'
25
+ name: cz_customize
26
+ customize:
27
+ example: |-
28
+ feat(scope): implement feature ABC in sources
29
+
30
+ Issue: #123
31
+ Details: Details about the changes
32
+ ---
33
+
34
+ Signed-off-by: Firstname LASTNAME <firstname.lastname@example.com>
35
+ info: |
36
+
37
+ ## Conventional Commits - Customized specification
38
+
39
+ The commit contains the following structural elements, to communicate
40
+ intent to the consumers of your library:
41
+
42
+ ### Commit type
43
+
44
+ fix: a commit of the type fix patches a bug in your codebase
45
+ (this correlates with PATCH in semantic versioning).
46
+
47
+ feat: a commit of the type feat introduces a new feature to the codebase
48
+ (this correlates with MINOR in semantic versioning).
49
+
50
+ Others: commit types other than fix: and feat: are allowed,
51
+ like chore:, docs:, style:, refactor:, perf:, test:, and others.
52
+
53
+ We also recommend improvement for commits that improve a current
54
+ implementation without adding a new feature or fixing a bug.
55
+
56
+ For temporary commits, start with 'wip' or 'WIP' to ignore commit validation.
57
+
58
+ ### Commit scope
59
+
60
+ A scope has to be provided to a commit’s type, to provide additional contextual information,
61
+ such as the changed file, the containing folder or a globally modified feature,
62
+ and is contained within parenthesis, e.g., feat(parser): add ability to parse arrays.
63
+
64
+ ### Commit breaking changes
65
+
66
+ BREAKING CHANGE: A commit with '!' before the ':' or that has the text BREAKING CHANGE:
67
+ at the beginning of its optional body or footer section introduces a breaking API change
68
+ (correlating with MAJOR in semantic versioning).
69
+ A BREAKING CHANGE can be part of commits of any type.
70
+
71
+ ### Commit syntax
72
+
73
+ Notice these types are not mandated by the conventional commits specification,
74
+ and have no implicit effect in semantic versioning (unless they include a BREAKING CHANGE).
75
+
76
+ <type>(mandatory scope)[optional !]: <description>
77
+
78
+ [optional body]
79
+
80
+ [optional footer]
81
+ message_template: "\
82
+ {{prefix}}\
83
+ ({{scope}})\
84
+ {% if is_breaking_change %}!{% endif %}\
85
+ : \
86
+ {{subject}}\
87
+ {% if body or footer %}\n{% endif %}\
88
+ {% if body %}\n{{body}}{% endif %}\
89
+ {% if footer %}\n{{footer}}{% endif %}\
90
+ {% if body or footer %}\n---{% endif %}\
91
+ "
92
+ questions:
93
+ - type: list
94
+ name: prefix
95
+ message: 'Type of the change :'
96
+ choices:
97
+ - value: fix
98
+ name: 'fix: Bug or issues fixes'
99
+ key: x
100
+ - value: feat
101
+ name: 'feat: New or extended feature'
102
+ key: f
103
+ - value: chore
104
+ name: 'chore: Changes to non-production code'
105
+ key: h
106
+ - value: docs
107
+ name: 'docs: Documentation only changes'
108
+ key: d
109
+ - value: style
110
+ name: 'style: Cosmetic changes only (white-space, formatting, etc)'
111
+ key: s
112
+ - value: refactor
113
+ name: 'refactor: Code changes that neither fix a bug nor add a feature'
114
+ key: r
115
+ - value: perf
116
+ name: 'perf: Code change that improve performance'
117
+ key: p
118
+ - value: security
119
+ name: 'security: Changes that improve sources without any impact'
120
+ key: e
121
+ - value: test
122
+ name: 'test: Adding missing or correcting existing tests'
123
+ key: t
124
+ - value: build
125
+ name: 'build: Changes to the build system or dependencies _(example: makefile, pip, docker)'
126
+ key: b
127
+ - value: ci
128
+ name: 'ci: Changes to CI configuration files and scripts (example: gitlab-ci)'
129
+ key: c
130
+ - value: improvement
131
+ name: 'improvement: Changes that improve sources without any impact'
132
+ key: i
133
+ - type: input
134
+ name: scope
135
+ message: 'Scope of the change :'
136
+ filter: 'lambda text: commitizen.cz.utils.required_validator(text, msg="! Error: Scope is required")'
137
+ default: ''
138
+ - type: input
139
+ name: subject
140
+ message: 'Title of the commit (starting in lower case and without period) :'
141
+ filter: 'lambda text: commitizen.cz.utils.required_validator(text.strip(".").strip(), msg="! Error: Title is required")'
142
+ default: ''
143
+ - type: input
144
+ name: body
145
+ message: 'Additional contextual message (Empty to skip) :'
146
+ default: 'Issue: #...'
147
+ filter: 'commitizen.cz.utils.multiple_line_breaker'
148
+ - type: input
149
+ name: footer
150
+ message: 'Footer information and references (Empty to skip) :'
151
+ default: ''
152
+ - type: confirm
153
+ message: 'BREAKING CHANGE to warn ?'
154
+ name: is_breaking_change
155
+ default: False
156
+ schema: |-
157
+ <type>(<scope>): <subject>
158
+ <BLANK LINE>
159
+ <body>
160
+ <BLANK LINE>
161
+ <footer>
162
+ schema_pattern: "\
163
+ (?s)\
164
+ ^(wip|WIP).*$\
165
+ |\
166
+ (fix|feat|chore|docs|style|refactor|perf|test|build|ci|improvement|security|revert)\
167
+ (\\([^\\n\\r]+\\))\
168
+ !?\
169
+ :\
170
+ \
171
+ ([^\\n\\r]+)\
172
+ ((\\n\\n.*)|(\\s*))?\
173
+ (\\n[^\\n\r]+-by:.*)*\
174
+ $\
175
+ "
176
+
177
+ # commitizen styles
178
+ style:
179
+ - ["qmark", "fg:#FF9D00 bold"]
180
+ - ["question", "bold"]
181
+ - ["answer", "fg:#FF9D00 bold"]
182
+ - ["pointer", "fg:#FF9D00 bold"]
183
+ - ["highlighted", "fg:#FF9D00 bold"]
184
+ - ["selected", "fg:#CC5454"]
185
+ - ["separator", "fg:#CC5454"]
186
+ - ["instruction", ""]
187
+ - ["text", ""]
188
+ - ["disabled", "fg:#858585 italic"]
@@ -0,0 +1,428 @@
1
+ stages:
2
+ - development
3
+ - prepare
4
+ - build
5
+ - deploy
6
+
7
+ variables:
8
+ REGISTRY_HOST: registry.gitlab.com
9
+ REGISTRY_NAMESPACE: radiandevcore/tools
10
+ REGISTRY_PROJECT: gitlab-projects-settings
11
+
12
+ .local:
13
+ engine: docker,auto
14
+ real_paths: true
15
+ version: 9.0
16
+
17
+ # =============================================================================
18
+ # Stage: development
19
+
20
+ clean:
21
+ stage: development
22
+ image: local
23
+ script:
24
+ - sudo rm -rf ./build ./dist ./*.egg-info ./.eggs
25
+ rules:
26
+ - if: $CI_LOCAL
27
+
28
+ changelog:
29
+ stage: development
30
+ image: local:silent
31
+ script:
32
+ # Prepare git-cliff binaries
33
+ - |
34
+ mkdir -p ./.tmp/
35
+ if ! ls ./.tmp/git-cliff-x86_64-unknown-linux-gnu.tar.gz >/dev/null 2>&1; then
36
+ wget -O ./.tmp/git-cliff-x86_64-unknown-linux-gnu.tar.gz -q https://github.com/orhun/git-cliff/releases/download/v2.4.0/git-cliff-2.4.0-x86_64-unknown-linux-gnu.tar.gz
37
+ tar -xzf ./.tmp/git-cliff-x86_64-unknown-linux-gnu.tar.gz -C ./.tmp/ --strip-components 1
38
+ rm -f ./.tmp/git-cliff-x86_64-unknown-linux-gnu.tar.gz
39
+ fi
40
+ # Request release tag
41
+ - |
42
+ echo -n " > Current commit : "
43
+ git describe --always
44
+ echo ''
45
+ if [ ! -z "${RELEASE_TAG:-}" ]; then
46
+ tag="${RELEASE_TAG}"
47
+ else
48
+ read -p " > Release tag : " -r tag
49
+ fi
50
+ echo ''
51
+ # Generate changelog
52
+ - |
53
+ git tag -f -m "${tag}" "${tag}"
54
+ ./.tmp/git-cliff --no-exec --config ./config/cliff.toml --output ./CHANGELOG.md
55
+ sed -i "s#raw/[^/]*/docs#raw/${tag}/docs#g" ./README.md
56
+ git add -v ./CHANGELOG.md ./README.md
57
+ echo ''
58
+ git commit -m "docs(changelog): regenerate release tag changes history" -s
59
+ echo ''
60
+ # Create release tag
61
+ - git tag -f -m "${tag}" "${tag}"
62
+ rules:
63
+ - if: $CI_LOCAL
64
+
65
+ images:
66
+ stage: development
67
+ image: local:silent
68
+ script:
69
+ # Rehost standard images
70
+ - |
71
+ for image in \
72
+ python:3.12-alpine \
73
+ ; do
74
+ if [ -z "${IMAGE}" ] || echo "${image}" | grep -q "${IMAGE}"; then
75
+ echo ''
76
+ echo " [INFO] Pull: ${image}"
77
+ echo ''
78
+ docker pull "${image}" || true
79
+ docker tag "${image}" "${REGISTRY_HOST}/${REGISTRY_NAMESPACE}/${REGISTRY_PROJECT}/${image}"
80
+ echo ''
81
+ echo " [INFO] Push: ${REGISTRY_HOST}/${REGISTRY_NAMESPACE}/${REGISTRY_PROJECT}/${image}"
82
+ echo ''
83
+ docker push "${REGISTRY_HOST}/${REGISTRY_NAMESPACE}/${REGISTRY_PROJECT}/${image}" || true
84
+ docker rmi "${image}" >/dev/null || true
85
+ fi
86
+ done
87
+ # Prepare build image
88
+ - |
89
+ base='python:3.12-alpine'
90
+ image='gitlab-projects-settings:build'
91
+ if [ -z "${IMAGE}" ] || echo "${image}" | grep -q "${IMAGE}"; then
92
+ echo ''
93
+ echo " [INFO] Pull: ${REGISTRY_HOST}/${REGISTRY_NAMESPACE}/${REGISTRY_PROJECT}/${base}"
94
+ echo ''
95
+ docker pull "${REGISTRY_HOST}/${REGISTRY_NAMESPACE}/${REGISTRY_PROJECT}/${base}" || true
96
+ docker pull "${REGISTRY_HOST}/${REGISTRY_NAMESPACE}/${REGISTRY_PROJECT}/${image}" || true
97
+ docker build -t "${REGISTRY_HOST}/${REGISTRY_NAMESPACE}/${REGISTRY_PROJECT}/${image}" -f - . <<-EOF
98
+ FROM ${REGISTRY_HOST}/${REGISTRY_NAMESPACE}/${REGISTRY_PROJECT}/${base}
99
+ RUN apk add -q git
100
+ COPY ./requirements/runtime.txt /tmp/
101
+ COPY ./requirements/build.txt /tmp/
102
+ RUN export PIP_DISABLE_PIP_VERSION_CHECK=1 \
103
+ && pip3 install -q -r /tmp/runtime.txt --no-cache-dir --upgrade \
104
+ && pip3 install -q -r /tmp/build.txt --no-cache-dir --upgrade \
105
+ && rm -f /tmp/runtime.txt \
106
+ && rm -f /tmp/build.txt
107
+ EOF
108
+ echo ''
109
+ echo " [INFO] Push: ${REGISTRY_HOST}/${REGISTRY_NAMESPACE}/${REGISTRY_PROJECT}/${image}"
110
+ echo ''
111
+ docker push "${REGISTRY_HOST}/${REGISTRY_NAMESPACE}/${REGISTRY_PROJECT}/${image}" || true
112
+ fi
113
+ # Prepare codestyle image
114
+ - |
115
+ base='python:3.12-alpine'
116
+ image='gitlab-projects-settings:codestyle'
117
+ if [ -z "${IMAGE}" ] || echo "${image}" | grep -q "${IMAGE}"; then
118
+ echo ''
119
+ echo " [INFO] Pull: ${REGISTRY_HOST}/${REGISTRY_NAMESPACE}/${REGISTRY_PROJECT}/${base}"
120
+ echo ''
121
+ docker pull "${REGISTRY_HOST}/${REGISTRY_NAMESPACE}/${REGISTRY_PROJECT}/${base}" || true
122
+ docker pull "${REGISTRY_HOST}/${REGISTRY_NAMESPACE}/${REGISTRY_PROJECT}/${image}" || true
123
+ docker build -t "${REGISTRY_HOST}/${REGISTRY_NAMESPACE}/${REGISTRY_PROJECT}/${image}" -f- . <<-EOF
124
+ FROM ${REGISTRY_HOST}/${REGISTRY_NAMESPACE}/${REGISTRY_PROJECT}/${base}
125
+ RUN apk add -q git
126
+ COPY ./requirements/runtime.txt /tmp/
127
+ COPY ./requirements/quality.txt /tmp/
128
+ RUN export PIP_DISABLE_PIP_VERSION_CHECK=1 \
129
+ && pip3 install -q -r /tmp/runtime.txt --no-cache-dir --upgrade \
130
+ && pip3 install -q -r /tmp/quality.txt --no-cache-dir --upgrade \
131
+ && rm -f /tmp/runtime.txt \
132
+ && rm -f /tmp/quality.txt \
133
+ && rm -f /tmp/tests.txt
134
+ EOF
135
+ echo ''
136
+ echo " [INFO] Push: ${REGISTRY_HOST}/${REGISTRY_NAMESPACE}/${REGISTRY_PROJECT}/${image}"
137
+ echo ''
138
+ docker push "${REGISTRY_HOST}/${REGISTRY_NAMESPACE}/${REGISTRY_PROJECT}/${image}" || true
139
+ fi
140
+ # Prepare deploy image
141
+ - |
142
+ base='python:3.12-alpine'
143
+ image='gitlab-projects-settings:deploy'
144
+ if [ -z "${IMAGE}" ] || echo "${image}" | grep -q "${IMAGE}"; then
145
+ echo ''
146
+ echo " [INFO] Pull: ${REGISTRY_HOST}/${REGISTRY_NAMESPACE}/${REGISTRY_PROJECT}/${base}"
147
+ echo ''
148
+ docker pull "${REGISTRY_HOST}/${REGISTRY_NAMESPACE}/${REGISTRY_PROJECT}/${base}" || true
149
+ docker pull "${REGISTRY_HOST}/${REGISTRY_NAMESPACE}/${REGISTRY_PROJECT}/${image}" || true
150
+ docker build -t "${REGISTRY_HOST}/${REGISTRY_NAMESPACE}/${REGISTRY_PROJECT}/${image}" -f - . <<-EOF
151
+ FROM ${REGISTRY_HOST}/${REGISTRY_NAMESPACE}/${REGISTRY_PROJECT}/${base}
152
+ RUN apk add -q gcc git libc-dev libffi-dev sed
153
+ COPY ./requirements/deploy.txt /tmp/
154
+ RUN export PIP_DISABLE_PIP_VERSION_CHECK=1 \
155
+ && pip3 install -q -r /tmp/deploy.txt --no-cache-dir --upgrade \
156
+ && rm -f /tmp/deploy.txt
157
+ EOF
158
+ echo ''
159
+ echo " [INFO] Push: ${REGISTRY_HOST}/${REGISTRY_NAMESPACE}/${REGISTRY_PROJECT}/${image}"
160
+ echo ''
161
+ docker push "${REGISTRY_HOST}/${REGISTRY_NAMESPACE}/${REGISTRY_PROJECT}/${image}" || true
162
+ fi
163
+ rules:
164
+ - if: $CI_LOCAL
165
+
166
+ # =============================================================================
167
+ # Stage: prepare
168
+
169
+ codestyle:
170
+ stage: prepare
171
+ image: registry.gitlab.com/radiandevcore/tools/gitlab-projects-settings/gitlab-projects-settings:codestyle
172
+ needs: []
173
+ script:
174
+ - yapf -i ./.hooks/*.py ./src/*.py ./src/*/*.py ./setup.py
175
+ - echo '' && git diff --name-status
176
+ - git diff --quiet
177
+ rules:
178
+ - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
179
+ changes:
180
+ - 'CHANGELOG.md'
181
+ - '.hooks/**/*'
182
+ - 'requirements/**/*'
183
+ - 'setup.py'
184
+ - 'src/**/*'
185
+ - if: $CI_COMMIT_TAG || $CI_PIPELINE_SOURCE == "trigger" || $CI_PIPELINE_SOURCE == "web" || $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH
186
+ when: on_success
187
+
188
+ commits:
189
+ stage: prepare
190
+ image: registry.gitlab.com/radiandevcore/tools/gcil/gcil:codestyle
191
+ needs: []
192
+ before_script:
193
+ # Check system context
194
+ - git cz version -r
195
+ # Show commits documentation
196
+ - |
197
+ (
198
+ set +x
199
+ echo ' '
200
+ for hint in 'example:33' 'info:36' 'schema:32'; do
201
+ command="${hint%%:*}"
202
+ color="${hint##*:}"
203
+ echo '---'
204
+ echo "git cz ${command}:"
205
+ echo -e "\033[1;${color}m"
206
+ git cz "${command}" | sed 's#^$# #g'
207
+ echo -e '\033[0m '
208
+ done
209
+ echo '---'
210
+ )
211
+ script:
212
+ # Detect commits range
213
+ - set +x
214
+ - remote=$(git remote -v | grep '(fetch)' | awk '{print $1}' | head -n1)
215
+ - none_sha='0000000000000000000000000000000000000000'
216
+ - head_sha=$(git rev-parse "${CI_COMMIT_SHA:-HEAD}")
217
+ - |
218
+ if [ ! -z "${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-}" ]; then
219
+ git fetch "${remote}" "${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}" >/dev/null 2>&1 || true
220
+ base_sha=$(git rev-parse "${remote}/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}")
221
+ base_branch=$(git rev-parse --abbrev-ref "${remote}/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}")
222
+ elif [ ! -z "${CI_LOCAL:-}" ]; then
223
+ base_sha=$(git rev-parse "${remote}/HEAD")
224
+ base_branch=$(git rev-parse --abbrev-ref "${remote}/HEAD")
225
+ elif [ ! "${CI_COMMIT_BEFORE_SHA:-${none_sha}}" = "${none_sha}" ] && git cat-file -e "${CI_COMMIT_BEFORE_SHA}" 2>/dev/null; then
226
+ base_sha="${CI_COMMIT_BEFORE_SHA}"
227
+ base_branch="${CI_COMMIT_REF_NAME:-}"
228
+ else
229
+ base_sha=$(git rev-parse 'HEAD^')
230
+ base_branch=$(git rev-parse --abbrev-ref 'HEAD')
231
+ fi
232
+ # Validate commits range
233
+ - |
234
+ set +x
235
+ echo ' '
236
+ echo '---'
237
+ echo -e "\033[0m\033[1mINFO: Commitizen checks from \033[1m'\033[1;36m${base_sha:0:8}\033[0m\033[1m' (\033[1;33m${base_branch}\033[0m\033[1m) to '\033[1;36m${head_sha:0:8}\033[0m\033[1m' (\033[1;33mHEAD\033[0m\033[1m)\033[0m"
238
+ echo ' '
239
+ git log --pretty=oneline --abbrev-commit "${base_sha}..${head_sha}" | sed "s#^\([^ ]*\) #$(printf '\033[1;33m')\1$(printf '\033[0m') #g"
240
+ echo ' '
241
+ set -x
242
+ git cz --no-raise 3 check --rev-range "${base_sha}..${head_sha}"
243
+
244
+ lint:
245
+ stage: prepare
246
+ image: registry.gitlab.com/radiandevcore/tools/gitlab-projects-settings/gitlab-projects-settings:codestyle
247
+ needs: []
248
+ script:
249
+ - pylint --errors-only ./.hooks/*.py ./src/ ./setup.py
250
+ - pylint --disable=missing-docstring --load-plugins=pylint.extensions.no_self_use ./.hooks/*.py ./src/ ./setup.py
251
+ rules:
252
+ - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
253
+ changes:
254
+ - 'CHANGELOG.md'
255
+ - '.hooks/**/*'
256
+ - 'requirements/**/*'
257
+ - 'setup.py'
258
+ - 'src/**/*'
259
+ - if: $CI_COMMIT_TAG || $CI_PIPELINE_SOURCE == "trigger" || $CI_PIPELINE_SOURCE == "web" || $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH
260
+ when: on_success
261
+
262
+ typings:
263
+ stage: prepare
264
+ image: registry.gitlab.com/radiandevcore/tools/gitlab-projects-settings/gitlab-projects-settings:codestyle
265
+ needs: []
266
+ variables:
267
+ MYPY_CACHE_DIR: /dev/null
268
+ MYPY_FORCE_COLOR: 1
269
+ TERM: ansi
270
+ script:
271
+ - set +x
272
+ - |
273
+ if [ $(git rev-list --count HEAD) -gt 1 ]; then
274
+ mypy --follow-imports silent --pretty $(git diff --name-only $(git diff --exit-code >/dev/null && echo 'HEAD^' || echo 'HEAD') ./.hooks/*.py ./src/ ./setup.py) 2>/dev/null || true
275
+ fi
276
+ - sleep 1
277
+ - mypy --follow-imports silent --pretty ./.hooks/*.py ./src/ ./setup.py
278
+ rules:
279
+ - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
280
+ changes:
281
+ - 'CHANGELOG.md'
282
+ - '.hooks/**/*'
283
+ - 'requirements/**/*'
284
+ - 'setup.py'
285
+ - 'src/**/*'
286
+ - if: $CI_COMMIT_TAG || $CI_PIPELINE_SOURCE == "trigger" || $CI_PIPELINE_SOURCE == "web" || $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH
287
+ when: on_success
288
+
289
+ # =============================================================================
290
+ # Stage: build
291
+
292
+ build:
293
+ stage: build
294
+ image: registry.gitlab.com/radiandevcore/tools/gitlab-projects-settings/gitlab-projects-settings:build
295
+ needs:
296
+ - job: codestyle
297
+ artifacts: false
298
+ - job: commits
299
+ artifacts: false
300
+ - job: lint
301
+ artifacts: false
302
+ - job: typings
303
+ artifacts: false
304
+ script:
305
+ - rm -rf ./build ./dist ./*.egg-info ./.eggs
306
+ - python3 -m build
307
+ after_script:
308
+ - rm -rf ./build ./*.egg-info ./.eggs
309
+ rules:
310
+ - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
311
+ changes:
312
+ - 'CHANGELOG.md'
313
+ - 'requirements/**/*'
314
+ - 'src/**/*'
315
+ - if: $CI_COMMIT_TAG || $CI_PIPELINE_SOURCE == "trigger" || $CI_PIPELINE_SOURCE == "web" || $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH
316
+ when: on_success
317
+ artifacts:
318
+ paths:
319
+ - dist/
320
+
321
+ install:
322
+ stage: build
323
+ image: local:quiet
324
+ script:
325
+ - pipx uninstall $(ls -1 ./dist/*.whl | cut -d'/' -f3 | cut -d'-' -f1) || true
326
+ - pipx install --force ./dist/*.whl
327
+ rules:
328
+ - if: $CI_LOCAL
329
+
330
+ readme:
331
+ stage: build
332
+ image: local:silent
333
+ script:
334
+ - |
335
+ export COLUMNS=120
336
+ mkdir -p ./.tmp/
337
+ PROJECT_PACKAGE=$(grep '^PROJECT_PACKAGE =' ./setup.py | cut -d"'" -f2)
338
+ {
339
+ echo ''
340
+ echo '```yaml'
341
+ alignments='[ ]\{2,\}'
342
+ argument='[[:alnum:]][[:alnum:]_-]\{0,\}'
343
+ letter='[[:alnum:]_]\{1\}'
344
+ parameter='[-]\{1,2\}[[:alnum:]][[:alnum:]_-]\{0,\}'
345
+ separator='--'
346
+ word='[[:alnum:]_-]\{1,\}'
347
+ help="[(]\{0,1\}${word}"
348
+ "${PROJECT_PACKAGE}" --help \
349
+ | sed '1d; $d' \
350
+ | sed "s/^\( ${parameter} \[${word}\]${alignments}\)/\1# /g" \
351
+ | sed "s/^\( ${parameter}\( ${word}\)\{1,\}${alignments}\)/\1# /g" \
352
+ | sed "s/^\( ${parameter}\( ${word}\)\{1,\}, ${parameter}\( ${word}\)\{1,\}${alignments}\)/\1# /g" \
353
+ | sed "s/^\( ${parameter}${alignments}\)/\1# /g" \
354
+ | sed "s/^\( ${parameter}, ${parameter}${alignments}\)/\1# /g" \
355
+ | sed "s/^\( ${separator}${alignments}\)/\1# /g" \
356
+ | sed "s/^\( ${argument}${alignments}\)/\1# /g" \
357
+ | sed "s/^\( ${alignments}\)\(${help}\)/\1# \2/g"
358
+ echo '```'
359
+ echo ''
360
+ } >./.tmp/README.help.tmp
361
+ - |
362
+ lead='^<!-- readme-help-start -->$'
363
+ tail='^<!-- readme-help-stop -->$'
364
+ sed -i "/${lead}/,/${tail}/{ /${lead}/{ p; r ./.tmp/README.help.tmp
365
+ }; /${tail}/p; d }" ./README.md | head -n 100
366
+ - rm -f ./.tmp/README.help.tmp
367
+ - |
368
+ git -c color.diff=always --no-pager diff ./README.md | grep --color=never '.' && echo ''
369
+ echo ' > README: Updated successfully'
370
+ git diff --quiet ./README.md
371
+ rules:
372
+ - if: $CI_LOCAL
373
+
374
+ # =============================================================================
375
+ # Stage: deploy
376
+
377
+ deploy:release:
378
+ stage: deploy
379
+ image: registry.gitlab.com/radiandevcore/tools/gitlab-projects-settings/gitlab-projects-settings:deploy
380
+ needs:
381
+ - job: build
382
+ variables:
383
+ TWINE_PASSWORD: ${TWINE_PASSWORD}
384
+ before_script:
385
+ # Validate protected tag
386
+ - if [ ! "${CI_COMMIT_REF_PROTECTED}" = 'true' ]; then echo '[ERROR] Please protect this tag...'; exit 1; fi
387
+ script:
388
+ # Extract tag changelog
389
+ - tag=${CI_COMMIT_REF_NAME:-$(git describe --always --abbrev=0)}
390
+ - |
391
+ description=$(
392
+ sed -n "
393
+ /^## \[${tag}\]/,/^## \[/{
394
+ n; :a; n; h;
395
+ /^$/{
396
+ n; H;
397
+ /^$/{
398
+ n; H;
399
+ /^<a name=/{ q; };
400
+ };
401
+ g;
402
+ };
403
+ p; ba;
404
+ }" ./CHANGELOG.md \
405
+ | sed -z 's/"/\\"/g'
406
+ )
407
+ # Create tag release
408
+ - |
409
+ description="${description}"$'\n\n''### Download'$'\n'
410
+ gitlab-release --description "${description}" --link-prefix '* ' ./dist/*
411
+ # Deploy package release
412
+ - twine upload -u '__token__' -p "${TWINE_PASSWORD}" ./dist/*
413
+ rules:
414
+ - if: $CI_COMMIT_TAG
415
+
416
+ deploy:trial:
417
+ stage: deploy
418
+ image: registry.gitlab.com/radiandevcore/tools/gitlab-projects-settings/gitlab-projects-settings:deploy
419
+ needs:
420
+ - job: build
421
+ variables:
422
+ TWINE_PASSWORD_TEST: ${TWINE_PASSWORD_TEST}
423
+ script:
424
+ # Deploy package release
425
+ - twine upload -u '__token__' -p "${TWINE_PASSWORD_TEST}" --repository testpypi ./dist/*
426
+ rules:
427
+ - if: $CI_LOCAL
428
+ when: manual