gitlab-projects-settings 5.2.0__tar.gz → 5.3.0__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.
- gitlab_projects_settings-5.3.0/.coveragerc +7 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/.cz.yaml +17 -17
- gitlab_projects_settings-5.3.0/.gitattributes +2 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/.gitignore +8 -0
- gitlab_projects_settings-5.3.0/.gitlab-ci.yml +566 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/.pre-commit-config.yaml +30 -8
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/CHANGELOG.md +57 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/PKG-INFO +10 -2
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/README.md +9 -1
- gitlab_projects_settings-5.3.0/containers/codestyle/Dockerfile +18 -0
- gitlab_projects_settings-5.3.0/containers/deploy/Dockerfile +16 -0
- gitlab_projects_settings-5.3.0/containers/test-coverage-linux/Dockerfile +19 -0
- gitlab_projects_settings-5.3.0/containers/test-coverage-windows/Dockerfile +22 -0
- gitlab_projects_settings-5.3.0/containers/test-linux/Dockerfile +13 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/gitlab_projects_settings.egg-info/PKG-INFO +10 -2
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/gitlab_projects_settings.egg-info/SOURCES.txt +17 -4
- gitlab_projects_settings-5.3.0/requirements/coverage.txt +1 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/requirements/quality.txt +1 -0
- gitlab_projects_settings-5.3.0/requirements/tests.txt +1 -0
- gitlab_projects_settings-5.3.0/sonar-project.properties +15 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/src/features/gitlab.py +9 -3
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/src/package/bundle.py +3 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/src/package/version.py +1 -1
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/src/system/platform.py +8 -1
- gitlab_projects_settings-5.3.0/tests/arguments/test.sh +13 -0
- gitlab_projects_settings-5.3.0/tests/colors/test.sh +22 -0
- gitlab_projects_settings-5.3.0/tests/macos/test.sh +22 -0
- gitlab_projects_settings-5.3.0/tests/settings/test.sh +22 -0
- gitlab_projects_settings-5.3.0/tests/versions/test.sh +32 -0
- gitlab_projects_settings-5.3.0/tests/windows/test.sh +30 -0
- gitlab_projects_settings-5.2.0/.gitlab-ci.yml +0 -428
- gitlab_projects_settings-5.2.0/.hooks/configurations.py +0 -241
- gitlab_projects_settings-5.2.0/.hooks/manage +0 -173
- gitlab_projects_settings-5.2.0/.hooks/prepare_commit_msg_template.py +0 -203
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/.markdownlint.json +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/.style.yapf +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/.vscode/extensions.json +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/.vscode/settings.json +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/LICENSE +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/config/cliff.toml +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/gitlab_projects_settings.egg-info/dependency_links.txt +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/gitlab_projects_settings.egg-info/entry_points.txt +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/gitlab_projects_settings.egg-info/requires.txt +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/gitlab_projects_settings.egg-info/top_level.txt +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/mypy.ini +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/requirements/build.txt +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/requirements/deploy.txt +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/requirements/runtime.txt +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/setup.cfg +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/setup.py +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/src/__init__.py +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/src/__main__.py +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/src/cli/__init__.py +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/src/cli/entrypoint.py +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/src/cli/main.py +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/src/features/__init__.py +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/src/package/__init__.py +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/src/package/settings.py +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/src/package/updates.py +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/src/prints/__init__.py +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/src/prints/boxes.py +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/src/prints/colors.py +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/src/prints/themes.py +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/src/system/__init__.py +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/src/types/__init__.py +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/src/types/environments.py +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/src/types/gitlab.py +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/src/types/namespaces.py +0 -0
- {gitlab_projects_settings-5.2.0 → gitlab_projects_settings-5.3.0}/src/types/strings.py +0 -0
|
@@ -36,36 +36,36 @@ commitizen:
|
|
|
36
36
|
|
|
37
37
|
## Conventional Commits - Customized specification
|
|
38
38
|
|
|
39
|
-
The commit contains the following structural elements
|
|
40
|
-
intent to the consumers of your library:
|
|
39
|
+
The commit contains the following structural elements:
|
|
41
40
|
|
|
42
41
|
### Commit type
|
|
43
42
|
|
|
44
|
-
fix:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
43
|
+
- fix: Bug or issues fixes
|
|
44
|
+
- feat: New or extended feature
|
|
45
|
+
- chore: Changes to non-production code
|
|
46
|
+
- docs: Documentation only changes
|
|
47
|
+
- style: Cosmetic changes only (white-space, formatting, etc)
|
|
48
|
+
- refactor: Code changes that neither fix a bug nor add a feature
|
|
49
|
+
- perf: Code change that improve performance
|
|
50
|
+
- security: Changes resolve security related issues
|
|
51
|
+
- test: Adding missing or correcting existing tests
|
|
52
|
+
- build: Changes to the build system or dependencies (example: makefile, pip, docker)
|
|
53
|
+
- ci: Changes to CI configuration files and scripts (example: gitlab-ci)
|
|
54
|
+
- improvement: Changes that improve sources without any impact
|
|
55
|
+
- wip: Temporary commits meant for local developments and rebases
|
|
57
56
|
|
|
58
57
|
### Commit scope
|
|
59
58
|
|
|
60
59
|
A scope has to be provided to a commit’s type, to provide additional contextual information,
|
|
61
60
|
such as the changed file, the containing folder or a globally modified feature,
|
|
62
|
-
and is contained within parenthesis, e.g
|
|
61
|
+
and is contained within parenthesis, e.g. feat(parser): add ability to parse arrays.
|
|
63
62
|
|
|
64
63
|
### Commit breaking changes
|
|
65
64
|
|
|
66
65
|
BREAKING CHANGE: A commit with '!' before the ':' or that has the text BREAKING CHANGE:
|
|
67
66
|
at the beginning of its optional body or footer section introduces a breaking API change
|
|
68
67
|
(correlating with MAJOR in semantic versioning).
|
|
68
|
+
|
|
69
69
|
A BREAKING CHANGE can be part of commits of any type.
|
|
70
70
|
|
|
71
71
|
### Commit syntax
|
|
@@ -122,7 +122,7 @@ commitizen:
|
|
|
122
122
|
name: 'test: Adding missing or correcting existing tests'
|
|
123
123
|
key: t
|
|
124
124
|
- value: build
|
|
125
|
-
name: 'build: Changes to the build system or dependencies
|
|
125
|
+
name: 'build: Changes to the build system or dependencies (example: makefile, pip, docker)'
|
|
126
126
|
key: b
|
|
127
127
|
- value: ci
|
|
128
128
|
name: 'ci: Changes to CI configuration files and scripts (example: gitlab-ci)'
|
|
@@ -0,0 +1,566 @@
|
|
|
1
|
+
include:
|
|
2
|
+
- component: gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commits@2.0.0
|
|
3
|
+
inputs:
|
|
4
|
+
stage: prepare
|
|
5
|
+
|
|
6
|
+
stages:
|
|
7
|
+
- development
|
|
8
|
+
- prepare
|
|
9
|
+
- build
|
|
10
|
+
- test
|
|
11
|
+
- quality
|
|
12
|
+
- deploy
|
|
13
|
+
|
|
14
|
+
variables:
|
|
15
|
+
REGISTRY_HOST: registry.gitlab.com
|
|
16
|
+
REGISTRY_NAMESPACE: radiandevcore/tools
|
|
17
|
+
REGISTRY_PROJECT: gitlab-projects-settings
|
|
18
|
+
|
|
19
|
+
.local:
|
|
20
|
+
engine: docker,auto
|
|
21
|
+
real_paths: true
|
|
22
|
+
version: 9.0
|
|
23
|
+
|
|
24
|
+
# =============================================================================
|
|
25
|
+
# Stage: development
|
|
26
|
+
|
|
27
|
+
clean:
|
|
28
|
+
stage: development
|
|
29
|
+
image: local
|
|
30
|
+
script:
|
|
31
|
+
- sudo rm -rf ./build ./dist ./*.egg-info ./.eggs
|
|
32
|
+
rules:
|
|
33
|
+
- if: $CI_LOCAL
|
|
34
|
+
|
|
35
|
+
changelog:
|
|
36
|
+
stage: development
|
|
37
|
+
image: local:silent
|
|
38
|
+
script:
|
|
39
|
+
# Prepare git-cliff binaries
|
|
40
|
+
- |
|
|
41
|
+
mkdir -p ./.tmp/
|
|
42
|
+
if ! ls ./.tmp/git-cliff-x86_64-unknown-linux-gnu.tar.gz >/dev/null 2>&1; then
|
|
43
|
+
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
|
|
44
|
+
tar -xzf ./.tmp/git-cliff-x86_64-unknown-linux-gnu.tar.gz -C ./.tmp/ --strip-components 1
|
|
45
|
+
rm -f ./.tmp/git-cliff-x86_64-unknown-linux-gnu.tar.gz
|
|
46
|
+
fi
|
|
47
|
+
# Request release tag
|
|
48
|
+
- |
|
|
49
|
+
echo -n " > Current commit : "
|
|
50
|
+
git describe --always
|
|
51
|
+
echo ''
|
|
52
|
+
if [ ! -z "${RELEASE_TAG:-}" ]; then
|
|
53
|
+
tag="${RELEASE_TAG}"
|
|
54
|
+
else
|
|
55
|
+
read -p " > Release tag : " -r tag
|
|
56
|
+
fi
|
|
57
|
+
echo ''
|
|
58
|
+
# Generate changelog
|
|
59
|
+
- |
|
|
60
|
+
git tag -f -m "${tag}" "${tag}"
|
|
61
|
+
./.tmp/git-cliff --no-exec --config ./config/cliff.toml --output ./CHANGELOG.md
|
|
62
|
+
sed -i "s#raw/[^/]*/docs#raw/${tag}/docs#g" ./README.md
|
|
63
|
+
git add -v ./CHANGELOG.md ./README.md
|
|
64
|
+
echo ''
|
|
65
|
+
git commit -m "docs(changelog): regenerate release tag changes history" -s
|
|
66
|
+
echo ''
|
|
67
|
+
# Create release tag
|
|
68
|
+
- git tag -f -m "${tag}" "${tag}"
|
|
69
|
+
rules:
|
|
70
|
+
- if: $CI_LOCAL
|
|
71
|
+
|
|
72
|
+
hooks:
|
|
73
|
+
stage: development
|
|
74
|
+
image: local:silent
|
|
75
|
+
script:
|
|
76
|
+
# Refresh configurations
|
|
77
|
+
- pre-commit-crocodile --configure
|
|
78
|
+
# Stash local changes
|
|
79
|
+
- echo ''
|
|
80
|
+
- echo ' [INFO] Use "s" to split hunks and "y" to remove changes you do not want, "n" otherwise'
|
|
81
|
+
- echo ''
|
|
82
|
+
- sleep 2
|
|
83
|
+
- git stash -p
|
|
84
|
+
# Stage changes
|
|
85
|
+
- git add -v ./.cz.yaml ./.pre-commit-config.yaml
|
|
86
|
+
# Enable hooks
|
|
87
|
+
- pre-commit-crocodile --enable
|
|
88
|
+
# Run hooks
|
|
89
|
+
- pre-commit-crocodile --run
|
|
90
|
+
# Reset changes
|
|
91
|
+
- git reset HEAD ./.cz.yaml ./.pre-commit-config.yaml
|
|
92
|
+
rules:
|
|
93
|
+
- if: $CI_LOCAL
|
|
94
|
+
|
|
95
|
+
images:
|
|
96
|
+
stage: development
|
|
97
|
+
image: local:silent
|
|
98
|
+
script:
|
|
99
|
+
# Rehost standard images
|
|
100
|
+
- |
|
|
101
|
+
for base_rename in \
|
|
102
|
+
'python:3.8' \
|
|
103
|
+
'python:3.12' \
|
|
104
|
+
'python:3.12-alpine' \
|
|
105
|
+
'sonarsource/sonar-scanner-cli:latest' \
|
|
106
|
+
'tobix/pywine:3.10' \
|
|
107
|
+
; do
|
|
108
|
+
base=$(echo "${base_rename}" | cut -d'|' -f1 | tr -d ' ')
|
|
109
|
+
rename=$(echo "${base_rename}" | cut -d'|' -f2 | tr -d ' ')
|
|
110
|
+
image="${REGISTRY_HOST}/${REGISTRY_NAMESPACE}/${REGISTRY_PROJECT}/${rename:-${base}}"
|
|
111
|
+
if [ -z "${IMAGE}" ] || echo "${image}" | grep -q "${IMAGE}"; then
|
|
112
|
+
echo ''
|
|
113
|
+
echo " [INFO] Pull: ${base}"
|
|
114
|
+
echo ''
|
|
115
|
+
docker pull "${base}" || true
|
|
116
|
+
docker tag "${base}" "${image}"
|
|
117
|
+
echo ''
|
|
118
|
+
echo " [INFO] Push: ${image}"
|
|
119
|
+
echo ''
|
|
120
|
+
docker push "${image}" || true
|
|
121
|
+
docker rmi "${base}" >/dev/null || true
|
|
122
|
+
fi
|
|
123
|
+
done
|
|
124
|
+
# Prepare project images
|
|
125
|
+
- |
|
|
126
|
+
for name_base_container in \
|
|
127
|
+
'build | python:3.12-alpine | build' \
|
|
128
|
+
'codestyle | python:3.12-alpine | codestyle' \
|
|
129
|
+
'deploy | python:3.12-alpine | deploy' \
|
|
130
|
+
'test-coverage-linux | python:3.12 | test-coverage-linux' \
|
|
131
|
+
'test-coverage-windows | tobix/pywine:3.10 | test-coverage-windows' \
|
|
132
|
+
'test-oldest | python:3.8 | test-linux' \
|
|
133
|
+
'test-latest | python:3.12 | test-linux' \
|
|
134
|
+
; do
|
|
135
|
+
name=$(echo "${name_base_container}" | cut -d'|' -f1 | tr -d ' ')
|
|
136
|
+
base=$(echo "${name_base_container}" | cut -d'|' -f2 | tr -d ' ')
|
|
137
|
+
container=$(echo "${name_base_container}" | cut -d'|' -f3 | tr -d ' ')
|
|
138
|
+
base="${REGISTRY_HOST}/${REGISTRY_NAMESPACE}/${REGISTRY_PROJECT}/${base}"
|
|
139
|
+
image="${REGISTRY_HOST}/${REGISTRY_NAMESPACE}/${REGISTRY_PROJECT}/${REGISTRY_PROJECT}:${name}"
|
|
140
|
+
if [ -z "${IMAGE}" ] || echo "${image}" | grep -q "${IMAGE}"; then
|
|
141
|
+
echo ''
|
|
142
|
+
echo " [INFO] Pull: ${image}"
|
|
143
|
+
echo ''
|
|
144
|
+
docker pull "${base}" || true
|
|
145
|
+
docker pull "${image}" || true
|
|
146
|
+
docker build \
|
|
147
|
+
--build-arg "IMAGE_BASE=${base}" \
|
|
148
|
+
--build-context 'requirements=./requirements' \
|
|
149
|
+
--cache-from "${image}" \
|
|
150
|
+
--pull \
|
|
151
|
+
--tag "${image}" \
|
|
152
|
+
"./containers/${container}/"
|
|
153
|
+
echo ''
|
|
154
|
+
echo " [INFO] Push: ${image}"
|
|
155
|
+
echo ''
|
|
156
|
+
docker push "${image}" || true
|
|
157
|
+
fi
|
|
158
|
+
done
|
|
159
|
+
rules:
|
|
160
|
+
- if: $CI_LOCAL
|
|
161
|
+
|
|
162
|
+
# =============================================================================
|
|
163
|
+
# Stage: prepare
|
|
164
|
+
|
|
165
|
+
codestyle:
|
|
166
|
+
stage: prepare
|
|
167
|
+
image: registry.gitlab.com/radiandevcore/tools/gitlab-projects-settings/gitlab-projects-settings:codestyle
|
|
168
|
+
needs: []
|
|
169
|
+
script:
|
|
170
|
+
- yapf -i ./src/*.py ./src/*/*.py ./setup.py
|
|
171
|
+
- echo '' && git diff --name-status
|
|
172
|
+
- git diff --quiet
|
|
173
|
+
rules:
|
|
174
|
+
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
|
|
175
|
+
changes:
|
|
176
|
+
- 'CHANGELOG.md'
|
|
177
|
+
- 'requirements/**/*'
|
|
178
|
+
- 'setup.py'
|
|
179
|
+
- 'src/**/*'
|
|
180
|
+
- if: $CI_COMMIT_TAG || $CI_PIPELINE_SOURCE == "trigger" || $CI_PIPELINE_SOURCE == "web" || $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH
|
|
181
|
+
when: on_success
|
|
182
|
+
|
|
183
|
+
lint:
|
|
184
|
+
stage: prepare
|
|
185
|
+
image: registry.gitlab.com/radiandevcore/tools/gitlab-projects-settings/gitlab-projects-settings:codestyle
|
|
186
|
+
needs: []
|
|
187
|
+
script:
|
|
188
|
+
- pylint --errors-only ./src/ ./setup.py
|
|
189
|
+
- pylint --disable=missing-docstring --load-plugins=pylint.extensions.no_self_use ./src/ ./setup.py
|
|
190
|
+
rules:
|
|
191
|
+
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
|
|
192
|
+
changes:
|
|
193
|
+
- 'CHANGELOG.md'
|
|
194
|
+
- 'requirements/**/*'
|
|
195
|
+
- 'setup.py'
|
|
196
|
+
- 'src/**/*'
|
|
197
|
+
- if: $CI_COMMIT_TAG || $CI_PIPELINE_SOURCE == "trigger" || $CI_PIPELINE_SOURCE == "web" || $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH
|
|
198
|
+
when: on_success
|
|
199
|
+
|
|
200
|
+
typings:
|
|
201
|
+
stage: prepare
|
|
202
|
+
image: registry.gitlab.com/radiandevcore/tools/gitlab-projects-settings/gitlab-projects-settings:codestyle
|
|
203
|
+
needs: []
|
|
204
|
+
variables:
|
|
205
|
+
MYPY_CACHE_DIR: /dev/null
|
|
206
|
+
MYPY_FORCE_COLOR: 1
|
|
207
|
+
TERM: ansi
|
|
208
|
+
script:
|
|
209
|
+
- set +x
|
|
210
|
+
- |
|
|
211
|
+
if [ $(git rev-list --count HEAD) -gt 1 ]; then
|
|
212
|
+
mypy --follow-imports silent --pretty $(git diff --name-only $(git diff --exit-code >/dev/null && echo 'HEAD~1' || echo 'HEAD') ./src/ ./setup.py | grep '\.py$') 2>/dev/null || true
|
|
213
|
+
fi
|
|
214
|
+
- sleep 1
|
|
215
|
+
- mypy --follow-imports silent --pretty ./src/ ./setup.py
|
|
216
|
+
rules:
|
|
217
|
+
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
|
|
218
|
+
changes:
|
|
219
|
+
- 'CHANGELOG.md'
|
|
220
|
+
- 'requirements/**/*'
|
|
221
|
+
- 'setup.py'
|
|
222
|
+
- 'src/**/*'
|
|
223
|
+
- if: $CI_COMMIT_TAG || $CI_PIPELINE_SOURCE == "trigger" || $CI_PIPELINE_SOURCE == "web" || $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH
|
|
224
|
+
when: on_success
|
|
225
|
+
|
|
226
|
+
# =============================================================================
|
|
227
|
+
# Stage: build
|
|
228
|
+
|
|
229
|
+
build:
|
|
230
|
+
stage: build
|
|
231
|
+
image: registry.gitlab.com/radiandevcore/tools/gitlab-projects-settings/gitlab-projects-settings:build
|
|
232
|
+
needs:
|
|
233
|
+
- job: codestyle
|
|
234
|
+
artifacts: false
|
|
235
|
+
optional: true
|
|
236
|
+
- job: commits
|
|
237
|
+
artifacts: false
|
|
238
|
+
optional: true
|
|
239
|
+
- job: lint
|
|
240
|
+
artifacts: false
|
|
241
|
+
optional: true
|
|
242
|
+
- job: typings
|
|
243
|
+
artifacts: false
|
|
244
|
+
optional: true
|
|
245
|
+
script:
|
|
246
|
+
- rm -rf ./build ./dist ./*.egg-info ./.eggs
|
|
247
|
+
- python3 -m build
|
|
248
|
+
after_script:
|
|
249
|
+
- rm -rf ./build ./*.egg-info ./.eggs
|
|
250
|
+
rules:
|
|
251
|
+
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
|
|
252
|
+
changes:
|
|
253
|
+
- 'CHANGELOG.md'
|
|
254
|
+
- 'requirements/**/*'
|
|
255
|
+
- 'src/**/*'
|
|
256
|
+
- if: $CI_COMMIT_TAG || $CI_PIPELINE_SOURCE == "trigger" || $CI_PIPELINE_SOURCE == "web" || $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH
|
|
257
|
+
when: on_success
|
|
258
|
+
artifacts:
|
|
259
|
+
paths:
|
|
260
|
+
- dist/
|
|
261
|
+
|
|
262
|
+
install:
|
|
263
|
+
stage: build
|
|
264
|
+
image: local:quiet
|
|
265
|
+
script:
|
|
266
|
+
- pipx uninstall $(ls -1 ./dist/*.whl | cut -d'/' -f3 | cut -d'-' -f1) || true
|
|
267
|
+
- pipx install --force ./dist/*.whl
|
|
268
|
+
rules:
|
|
269
|
+
- if: $CI_LOCAL
|
|
270
|
+
|
|
271
|
+
readme:
|
|
272
|
+
stage: build
|
|
273
|
+
image: local:silent
|
|
274
|
+
script:
|
|
275
|
+
- |
|
|
276
|
+
export COLUMNS=120
|
|
277
|
+
mkdir -p ./.tmp/
|
|
278
|
+
PROJECT_PACKAGE=$(grep '^PROJECT_PACKAGE =' ./setup.py | cut -d"'" -f2)
|
|
279
|
+
{
|
|
280
|
+
echo ''
|
|
281
|
+
echo '```yaml'
|
|
282
|
+
alignments='[ ]\{2,\}'
|
|
283
|
+
argument='[[:alnum:]][[:alnum:]_-]\{0,\}'
|
|
284
|
+
letter='[[:alnum:]_]\{1\}'
|
|
285
|
+
parameter='[-]\{1,2\}[[:alnum:]][[:alnum:]_-]\{0,\}'
|
|
286
|
+
separator='--'
|
|
287
|
+
word='[[:alnum:]_-]\{1,\}'
|
|
288
|
+
help="[(]\{0,1\}${word}"
|
|
289
|
+
"${PROJECT_PACKAGE}" --help \
|
|
290
|
+
| sed '1d; $d' \
|
|
291
|
+
| sed "s/^\( ${parameter} \[${word}\]${alignments}\)/\1# /g" \
|
|
292
|
+
| sed "s/^\( ${parameter}\( ${word}\)\{1,\}${alignments}\)/\1# /g" \
|
|
293
|
+
| sed "s/^\( ${parameter}\( ${word}\)\{1,\}, ${parameter}\( ${word}\)\{1,\}${alignments}\)/\1# /g" \
|
|
294
|
+
| sed "s/^\( ${parameter}${alignments}\)/\1# /g" \
|
|
295
|
+
| sed "s/^\( ${parameter}, ${parameter}${alignments}\)/\1# /g" \
|
|
296
|
+
| sed "s/^\( ${separator}${alignments}\)/\1# /g" \
|
|
297
|
+
| sed "s/^\( ${argument}${alignments}\)/\1# /g" \
|
|
298
|
+
| sed "s/^\( ${alignments}\)\(${help}\)/\1# \2/g"
|
|
299
|
+
echo '```'
|
|
300
|
+
echo ''
|
|
301
|
+
} >./.tmp/README.help.tmp
|
|
302
|
+
- |
|
|
303
|
+
lead='^<!-- readme-help-start -->$'
|
|
304
|
+
tail='^<!-- readme-help-stop -->$'
|
|
305
|
+
sed -i "/${lead}/,/${tail}/{ /${lead}/{ p; r ./.tmp/README.help.tmp
|
|
306
|
+
}; /${tail}/p; d }" ./README.md | head -n 100
|
|
307
|
+
- rm -f ./.tmp/README.help.tmp
|
|
308
|
+
- |
|
|
309
|
+
git -c color.diff=always --no-pager diff ./README.md | grep --color=never '.' && echo ''
|
|
310
|
+
echo ' > README: Updated successfully'
|
|
311
|
+
git diff --quiet ./README.md
|
|
312
|
+
rules:
|
|
313
|
+
- if: $CI_LOCAL
|
|
314
|
+
|
|
315
|
+
# =============================================================================
|
|
316
|
+
# Stage: test (templates)
|
|
317
|
+
|
|
318
|
+
.unit-tests-rules:
|
|
319
|
+
rules:
|
|
320
|
+
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
|
|
321
|
+
changes:
|
|
322
|
+
- 'CHANGELOG.md'
|
|
323
|
+
- 'requirements/**/*'
|
|
324
|
+
- 'src/**/*'
|
|
325
|
+
- if: $CI_COMMIT_TAG || $CI_PIPELINE_SOURCE == "trigger" || $CI_PIPELINE_SOURCE == "web" || $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH
|
|
326
|
+
when: on_success
|
|
327
|
+
|
|
328
|
+
.unit-tests-template:
|
|
329
|
+
stage: test
|
|
330
|
+
timeout: 10m
|
|
331
|
+
variables:
|
|
332
|
+
DEBUG_UPDATES_DISABLE: 'true'
|
|
333
|
+
FORCE_COLOR: 1
|
|
334
|
+
PYTHONUNBUFFERED: 1
|
|
335
|
+
TEMP: .tmp
|
|
336
|
+
TERM: ansi
|
|
337
|
+
before_script:
|
|
338
|
+
- mkdir -p ./.tmp/
|
|
339
|
+
- |
|
|
340
|
+
if type pipx >/dev/null 2>&1; then
|
|
341
|
+
pipx uninstall $(ls -1 ./dist/*.whl | cut -d'/' -f3 | cut -d'-' -f1) || true
|
|
342
|
+
pipx install --force ./dist/*.whl
|
|
343
|
+
else
|
|
344
|
+
pip3 install ./dist/*.whl
|
|
345
|
+
pip3 install --force-reinstall --no-deps --upgrade ./dist/*.whl
|
|
346
|
+
pip3 show gitlab-projects-settings
|
|
347
|
+
fi
|
|
348
|
+
script:
|
|
349
|
+
# Prepare tests
|
|
350
|
+
- export SUITE=$(echo "${SUITE}" | sed 's/,/\\|/g')
|
|
351
|
+
- if [ ! -z "${SUITE}" ]; then ls -1d ./tests/* | grep -q "\/\(${SUITE}\)" || (set +x; echo ''; echo -e '\033[1;31m[ERROR] The requested SUITE filter does not match any suite\033[0m'; echo ''; exit 1); fi
|
|
352
|
+
# Run tests
|
|
353
|
+
- for path in $(ls -1d ./tests/* | grep "\/\(${SUITE}\)"); do (cd "${path}/" && time sh ./test.sh 2>&1); done
|
|
354
|
+
# Finish tests
|
|
355
|
+
- |
|
|
356
|
+
(
|
|
357
|
+
set +x
|
|
358
|
+
echo ''
|
|
359
|
+
echo ' [INFO] Unit tests finished successfully'
|
|
360
|
+
echo ''
|
|
361
|
+
)
|
|
362
|
+
|
|
363
|
+
.coverage-template:
|
|
364
|
+
extends:
|
|
365
|
+
- .unit-tests-template
|
|
366
|
+
- .unit-tests-rules
|
|
367
|
+
variables:
|
|
368
|
+
COVERAGE_COMMON: ${CI_PROJECT_DIR}/coverage-reports/coverage-common.xml
|
|
369
|
+
COVERAGE_FOLDER: ${CI_PROJECT_DIR}/coverage-reports
|
|
370
|
+
COVERAGE_RCFILE: ${CI_PROJECT_DIR}/.coveragerc
|
|
371
|
+
PYTHONDONTWRITEBYTECODE: 1
|
|
372
|
+
PYTHONPATH: ${CI_PROJECT_DIR}
|
|
373
|
+
before_script:
|
|
374
|
+
- mkdir -p "${COVERAGE_FOLDER}/"
|
|
375
|
+
- chmod 777 "${COVERAGE_FOLDER}"
|
|
376
|
+
- |
|
|
377
|
+
if [ -z "${SUITE}" ]; then
|
|
378
|
+
coverage erase
|
|
379
|
+
fi
|
|
380
|
+
- coverage run --append --module --source=src src --version >/dev/null
|
|
381
|
+
- chmod 666 "${COVERAGE_FILE}"
|
|
382
|
+
- echo 'coverage run --append --module --source=src src "${@}"' | tee /usr/local/bin/gitlab-projects-settings >/dev/null
|
|
383
|
+
- echo 'coverage run --append --source=src "${@}"' | tee /usr/local/bin/python3-coverage >/dev/null
|
|
384
|
+
- chmod a+x /usr/local/bin/gitlab-projects-settings /usr/local/bin/python3-coverage
|
|
385
|
+
after_script:
|
|
386
|
+
- coverage xml -o "${COVERAGE_XML}"
|
|
387
|
+
- coverage report --show-missing --skip-covered
|
|
388
|
+
- sed -i 's#\(<source>\).*\(</source>\)#\1.\2#g' "${COVERAGE_XML}"
|
|
389
|
+
- |
|
|
390
|
+
set +x
|
|
391
|
+
if [ ! -z "${CI_LOCAL}" ]; then
|
|
392
|
+
common=$(mktemp -d)
|
|
393
|
+
cp "${COVERAGE_FOLDER}/.coverage-"* "${common}/"
|
|
394
|
+
COVERAGE_FILE="${common}/.coverage" coverage combine "${common}/.coverage-"*
|
|
395
|
+
COVERAGE_FILE="${common}/.coverage" coverage report --ignore-errors --show-missing --skip-covered
|
|
396
|
+
COVERAGE_FILE="${common}/.coverage" coverage xml -o "${COVERAGE_COMMON}"
|
|
397
|
+
sed -i 's#\(<source>\).*\(</source>\)#\1.\2#g' "${COVERAGE_COMMON}"
|
|
398
|
+
rm -rf "${common}"
|
|
399
|
+
fi
|
|
400
|
+
rules:
|
|
401
|
+
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
|
|
402
|
+
changes:
|
|
403
|
+
- 'CHANGELOG.md'
|
|
404
|
+
- 'requirements/**/*'
|
|
405
|
+
- 'src/**/*'
|
|
406
|
+
- 'tests/**/*'
|
|
407
|
+
- if: $CI_COMMIT_TAG || $CI_PIPELINE_SOURCE == "trigger" || $CI_PIPELINE_SOURCE == "web" || $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH
|
|
408
|
+
when: on_success
|
|
409
|
+
artifacts:
|
|
410
|
+
paths:
|
|
411
|
+
- coverage-reports/
|
|
412
|
+
|
|
413
|
+
# =============================================================================
|
|
414
|
+
# Stage: test (coverage)
|
|
415
|
+
|
|
416
|
+
coverage:linux:
|
|
417
|
+
extends:
|
|
418
|
+
- .coverage-template
|
|
419
|
+
image: registry.gitlab.com/radiandevcore/tools/gitlab-projects-settings/gitlab-projects-settings:test-coverage-linux
|
|
420
|
+
needs: []
|
|
421
|
+
variables:
|
|
422
|
+
COVERAGE_FILE: ${CI_PROJECT_DIR}/coverage-reports/.coverage-linux
|
|
423
|
+
COVERAGE_XML: ${CI_PROJECT_DIR}/coverage-reports/coverage-linux.xml
|
|
424
|
+
before_script:
|
|
425
|
+
- !reference [.coverage-template, before_script]
|
|
426
|
+
|
|
427
|
+
coverage:windows:
|
|
428
|
+
extends:
|
|
429
|
+
- .coverage-template
|
|
430
|
+
image: registry.gitlab.com/radiandevcore/tools/gitlab-projects-settings/gitlab-projects-settings:test-coverage-windows
|
|
431
|
+
needs: []
|
|
432
|
+
variables:
|
|
433
|
+
COVERAGE_FILE: ${CI_PROJECT_DIR}/coverage-reports/.coverage-windows
|
|
434
|
+
COVERAGE_XML: ${CI_PROJECT_DIR}/coverage-reports/coverage-windows.xml
|
|
435
|
+
before_script:
|
|
436
|
+
- !reference [.coverage-template, before_script]
|
|
437
|
+
script:
|
|
438
|
+
- cd ./tests/windows/ && sh ./test.sh 2>&1
|
|
439
|
+
|
|
440
|
+
# =============================================================================
|
|
441
|
+
# Stage: test (Python)
|
|
442
|
+
|
|
443
|
+
py3.8:
|
|
444
|
+
extends:
|
|
445
|
+
- .unit-tests-template
|
|
446
|
+
- .unit-tests-rules
|
|
447
|
+
image: registry.gitlab.com/radiandevcore/tools/gitlab-projects-settings/gitlab-projects-settings:test-oldest
|
|
448
|
+
before_script:
|
|
449
|
+
- !reference [.unit-tests-template, before_script]
|
|
450
|
+
|
|
451
|
+
py3.12:
|
|
452
|
+
extends:
|
|
453
|
+
- .unit-tests-template
|
|
454
|
+
- .unit-tests-rules
|
|
455
|
+
image: registry.gitlab.com/radiandevcore/tools/gitlab-projects-settings/gitlab-projects-settings:test-latest
|
|
456
|
+
before_script:
|
|
457
|
+
- !reference [.unit-tests-template, before_script]
|
|
458
|
+
|
|
459
|
+
# =============================================================================
|
|
460
|
+
# Stage: quality
|
|
461
|
+
|
|
462
|
+
sonarcloud:
|
|
463
|
+
stage: quality
|
|
464
|
+
image:
|
|
465
|
+
name: registry.gitlab.com/radiandevcore/tools/gitlab-projects-settings/sonarsource/sonar-scanner-cli:latest
|
|
466
|
+
entrypoint: ['']
|
|
467
|
+
needs:
|
|
468
|
+
- job: coverage:linux
|
|
469
|
+
- job: coverage:windows
|
|
470
|
+
variables:
|
|
471
|
+
GIT_DEPTH: 0
|
|
472
|
+
SONAR_USER_HOME: ${CI_PROJECT_DIR}/.sonar
|
|
473
|
+
cache:
|
|
474
|
+
key: '${CI_JOB_NAME}'
|
|
475
|
+
paths:
|
|
476
|
+
- .sonar/cache
|
|
477
|
+
before_script:
|
|
478
|
+
# Configure Git securities
|
|
479
|
+
- git config --global --add safe.directory "${CI_PROJECT_DIR}"
|
|
480
|
+
script:
|
|
481
|
+
# Scan with SonarCloud
|
|
482
|
+
- sonar-scanner -Dsonar.projectVersion=$(git describe --always) -Dsonar.branch.name=${CI_COMMIT_REF_NAME}
|
|
483
|
+
rules:
|
|
484
|
+
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
|
|
485
|
+
changes:
|
|
486
|
+
- 'CHANGELOG.md'
|
|
487
|
+
- 'requirements/**/*'
|
|
488
|
+
- 'src/**/*'
|
|
489
|
+
- 'tests/**/*'
|
|
490
|
+
when: always
|
|
491
|
+
- if: $CI_COMMIT_REF_NAME == "main"
|
|
492
|
+
when: always
|
|
493
|
+
- when: never
|
|
494
|
+
allow_failure: true
|
|
495
|
+
|
|
496
|
+
# =============================================================================
|
|
497
|
+
# Stage: deploy
|
|
498
|
+
|
|
499
|
+
deploy:release:
|
|
500
|
+
stage: deploy
|
|
501
|
+
image: registry.gitlab.com/radiandevcore/tools/gitlab-projects-settings/gitlab-projects-settings:deploy
|
|
502
|
+
needs:
|
|
503
|
+
- job: build
|
|
504
|
+
- job: coverage:linux
|
|
505
|
+
artifacts: false
|
|
506
|
+
- job: coverage:windows
|
|
507
|
+
artifacts: false
|
|
508
|
+
- job: py3.8
|
|
509
|
+
artifacts: false
|
|
510
|
+
- job: py3.12
|
|
511
|
+
artifacts: false
|
|
512
|
+
variables:
|
|
513
|
+
TWINE_PASSWORD: ${TWINE_PASSWORD}
|
|
514
|
+
before_script:
|
|
515
|
+
# Validate protected tag
|
|
516
|
+
- if [ ! "${CI_COMMIT_REF_PROTECTED}" = 'true' ]; then echo '[ERROR] Please protect this tag...'; exit 1; fi
|
|
517
|
+
script:
|
|
518
|
+
# Extract tag changelog
|
|
519
|
+
- tag=${CI_COMMIT_REF_NAME:-$(git describe --always --abbrev=0)}
|
|
520
|
+
- |
|
|
521
|
+
description=$(
|
|
522
|
+
sed -n "
|
|
523
|
+
/^## \[${tag}\]/,/^## \[/{
|
|
524
|
+
n; :a; n; h;
|
|
525
|
+
/^$/{
|
|
526
|
+
n; H;
|
|
527
|
+
/^$/{
|
|
528
|
+
n; H;
|
|
529
|
+
/^<a name=/{ q; };
|
|
530
|
+
};
|
|
531
|
+
g;
|
|
532
|
+
};
|
|
533
|
+
p; ba;
|
|
534
|
+
}" ./CHANGELOG.md \
|
|
535
|
+
| sed -z 's/"/\\"/g'
|
|
536
|
+
)
|
|
537
|
+
# Create tag release
|
|
538
|
+
- |
|
|
539
|
+
description="${description}"$'\n\n''### Download'$'\n'
|
|
540
|
+
gitlab-release --description "${description}" --link-prefix '* ' ./dist/*
|
|
541
|
+
# Deploy package release
|
|
542
|
+
- twine upload -u '__token__' -p "${TWINE_PASSWORD}" ./dist/*
|
|
543
|
+
rules:
|
|
544
|
+
- if: $CI_COMMIT_TAG
|
|
545
|
+
|
|
546
|
+
deploy:trial:
|
|
547
|
+
stage: deploy
|
|
548
|
+
image: registry.gitlab.com/radiandevcore/tools/gitlab-projects-settings/gitlab-projects-settings:deploy
|
|
549
|
+
needs:
|
|
550
|
+
- job: build
|
|
551
|
+
- job: coverage:linux
|
|
552
|
+
artifacts: false
|
|
553
|
+
- job: coverage:windows
|
|
554
|
+
artifacts: false
|
|
555
|
+
- job: py3.8
|
|
556
|
+
artifacts: false
|
|
557
|
+
- job: py3.12
|
|
558
|
+
artifacts: false
|
|
559
|
+
variables:
|
|
560
|
+
TWINE_PASSWORD_TEST: ${TWINE_PASSWORD_TEST}
|
|
561
|
+
script:
|
|
562
|
+
# Deploy package release
|
|
563
|
+
- twine upload -u '__token__' -p "${TWINE_PASSWORD_TEST}" --repository testpypi ./dist/*
|
|
564
|
+
rules:
|
|
565
|
+
- if: $CI_LOCAL
|
|
566
|
+
when: manual
|