cappysan-dotfiles 0.0.31__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.
- cappysan_dotfiles-0.0.31/.answers.yml +39 -0
- cappysan_dotfiles-0.0.31/.git-blame-ignore-revs +0 -0
- cappysan_dotfiles-0.0.31/.gitattributes +0 -0
- cappysan_dotfiles-0.0.31/.gitignore +29 -0
- cappysan_dotfiles-0.0.31/.gitlab/ci/core.yml +208 -0
- cappysan_dotfiles-0.0.31/.gitlab/ci/pages.yml +62 -0
- cappysan_dotfiles-0.0.31/.gitlab/ci/pre-commit.yml +111 -0
- cappysan_dotfiles-0.0.31/.gitlab/ci/python.yml +594 -0
- cappysan_dotfiles-0.0.31/.gitlab/ci/releases.yml +26 -0
- cappysan_dotfiles-0.0.31/.gitlab/ci/sphinx.yml +65 -0
- cappysan_dotfiles-0.0.31/.gitlab/ci/stages.yml +44 -0
- cappysan_dotfiles-0.0.31/.gitlab/ci/workflow.yml +41 -0
- cappysan_dotfiles-0.0.31/.gitlab-ci.yml +35 -0
- cappysan_dotfiles-0.0.31/.pre-commit-config.yaml +100 -0
- cappysan_dotfiles-0.0.31/AUTHORS +1 -0
- cappysan_dotfiles-0.0.31/CODE_OF_CONDUCT.md +1 -0
- cappysan_dotfiles-0.0.31/LICENSE +21 -0
- cappysan_dotfiles-0.0.31/MANIFEST.in +13 -0
- cappysan_dotfiles-0.0.31/Makefile +25 -0
- cappysan_dotfiles-0.0.31/PKG-INFO +15 -0
- cappysan_dotfiles-0.0.31/README.md +0 -0
- cappysan_dotfiles-0.0.31/bin/dict2json +25 -0
- cappysan_dotfiles-0.0.31/bin/dotfiles-setup +74 -0
- cappysan_dotfiles-0.0.31/bin/git-grep-vim +13 -0
- cappysan_dotfiles-0.0.31/bin/git-sed +120 -0
- cappysan_dotfiles-0.0.31/bin/help-bash-substitions +31 -0
- cappysan_dotfiles-0.0.31/bin/json2dict +0 -0
- cappysan_dotfiles-0.0.31/bin/no-color +17 -0
- cappysan_dotfiles-0.0.31/bin/python3-version +18 -0
- cappysan_dotfiles-0.0.31/bin/sponge +14 -0
- cappysan_dotfiles-0.0.31/bin/to-tmpfile +15 -0
- cappysan_dotfiles-0.0.31/cappysan_dotfiles.egg-info/PKG-INFO +15 -0
- cappysan_dotfiles-0.0.31/cappysan_dotfiles.egg-info/SOURCES.txt +60 -0
- cappysan_dotfiles-0.0.31/cappysan_dotfiles.egg-info/dependency_links.txt +1 -0
- cappysan_dotfiles-0.0.31/cappysan_dotfiles.egg-info/requires.txt +2 -0
- cappysan_dotfiles-0.0.31/cappysan_dotfiles.egg-info/top_level.txt +2 -0
- cappysan_dotfiles-0.0.31/cappysan_dotfiles.egg-info/zip-safe +1 -0
- cappysan_dotfiles-0.0.31/constraints.txt +2 -0
- cappysan_dotfiles-0.0.31/dotfiles/__init__.py +0 -0
- cappysan_dotfiles-0.0.31/dotfiles/__main__.py +2 -0
- cappysan_dotfiles-0.0.31/dotfiles/bin/sponge.bin +0 -0
- cappysan_dotfiles-0.0.31/dotfiles/share/dotfiles-setup +64 -0
- cappysan_dotfiles-0.0.31/dotfiles/share/functions.sh +100 -0
- cappysan_dotfiles-0.0.31/dotfiles/share/setup.d/00_email.sh +14 -0
- cappysan_dotfiles-0.0.31/dotfiles/share/setup.d/01_fullname.sh +16 -0
- cappysan_dotfiles-0.0.31/dotfiles/share/setup.d/02_keyid.sh +14 -0
- cappysan_dotfiles-0.0.31/dotfiles/share/setup.d/05_pipx.sh +13 -0
- cappysan_dotfiles-0.0.31/dotfiles/share/setup.d/80_dpkg.sh +21 -0
- cappysan_dotfiles-0.0.31/dotfiles/share/setup.d/99_vcsh.sh +25 -0
- cappysan_dotfiles-0.0.31/dotfiles/share/setup.d/environment.sh +52 -0
- cappysan_dotfiles-0.0.31/dotfiles/share/setup.d/forward.sh +4 -0
- cappysan_dotfiles-0.0.31/pyproject.toml +320 -0
- cappysan_dotfiles-0.0.31/requirements-dev.txt +9 -0
- cappysan_dotfiles-0.0.31/requirements.txt +0 -0
- cappysan_dotfiles-0.0.31/setup.cfg +4 -0
- cappysan_dotfiles-0.0.31/setup.py +76 -0
- cappysan_dotfiles-0.0.31/support/codespell.exclude +0 -0
- cappysan_dotfiles-0.0.31/support/help.mk +9 -0
- cappysan_dotfiles-0.0.31/support/precommit.mk +13 -0
- cappysan_dotfiles-0.0.31/support/python3.mk +86 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
# The following file enables recreating a templated output dir by executing:
|
|
3
|
+
# mk-scaffold clone "https://gitlab.com/cappysan/scaffolds/python-template" --input-file .answers.yml --output-dir output
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
answers:
|
|
7
|
+
# File generated with mk-scaffold:
|
|
8
|
+
# cf. nitpick/scaffold-tpl-version-check.toml
|
|
9
|
+
template_used: "https://gitlab.com/cappysan/scaffolds/python-template"
|
|
10
|
+
template_version: "1.2.2"
|
|
11
|
+
|
|
12
|
+
author: "Julien Lecomte"
|
|
13
|
+
email: "julien@cappysan.dev"
|
|
14
|
+
|
|
15
|
+
project_name: "dotfile-scripts"
|
|
16
|
+
project_slug: "dotfile-scripts"
|
|
17
|
+
project_url: "https://gitlab.com/cappysan/dotfiles/dotfiles"
|
|
18
|
+
project_description: ""
|
|
19
|
+
|
|
20
|
+
package_name: "cappysan-dotfile-scripts"
|
|
21
|
+
executable_name: ""
|
|
22
|
+
is_app: False
|
|
23
|
+
is_lib: False
|
|
24
|
+
|
|
25
|
+
documentation_url: "https://gitlab.com/cappysan/dotfiles/dotfiles"
|
|
26
|
+
source_code_url: "https://gitlab.com/cappysan/dotfiles/dotfiles"
|
|
27
|
+
bug_tracker_url: "https://gitlab.com/cappysan/dotfiles/dotfiles/-/issues"
|
|
28
|
+
pypi_url: "https://pypi.org/project/cappysan-dotfiles"
|
|
29
|
+
|
|
30
|
+
python_min_version: "3.11"
|
|
31
|
+
has_pytest_plugin: False
|
|
32
|
+
|
|
33
|
+
license: "MIT"
|
|
34
|
+
|
|
35
|
+
version: "0.0.31"
|
|
36
|
+
|
|
37
|
+
# Hidden fields
|
|
38
|
+
creation_year: "2025"
|
|
39
|
+
last_update: "2025-11-16 13:56:05"
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
|
2
|
+
#
|
|
3
|
+
### Project specifics ###
|
|
4
|
+
|
|
5
|
+
### Generic ###
|
|
6
|
+
/.env
|
|
7
|
+
/.cache/
|
|
8
|
+
/public/
|
|
9
|
+
|
|
10
|
+
### Python ###
|
|
11
|
+
# Byte-compiled / optimized / DLL files
|
|
12
|
+
/.pytest_cache/
|
|
13
|
+
__pycache__/
|
|
14
|
+
*.py[cod]
|
|
15
|
+
*$py.class
|
|
16
|
+
|
|
17
|
+
# Distribution / packaging
|
|
18
|
+
/build/
|
|
19
|
+
/dist/
|
|
20
|
+
/*.egg-info/
|
|
21
|
+
|
|
22
|
+
# Unit test / coverage reports
|
|
23
|
+
*.py,cover
|
|
24
|
+
/.coverage
|
|
25
|
+
|
|
26
|
+
# Virtual env
|
|
27
|
+
/.python-version
|
|
28
|
+
/.tox/
|
|
29
|
+
/.venv/
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
|
2
|
+
#
|
|
3
|
+
---
|
|
4
|
+
variables:
|
|
5
|
+
DEBIAN_FRONTEND: "noninteractive"
|
|
6
|
+
|
|
7
|
+
APTGET_INSTALL_FLAGS:
|
|
8
|
+
value: ""
|
|
9
|
+
description: "Flags to pass to apt-get"
|
|
10
|
+
|
|
11
|
+
# Used by jobs other than than just python.yml
|
|
12
|
+
# cf: https://gitlab.com/cappysan/images/container_registry/6574223
|
|
13
|
+
PYTHON_JOB_IMAGE_NAMESPACE:
|
|
14
|
+
value: "registry.gitlab.com/cappysan/images"
|
|
15
|
+
description: "Docker namespace to use for building environments for version matrix"
|
|
16
|
+
PYTHON_JOB_IMAGE:
|
|
17
|
+
value: "$PYTHON_JOB_IMAGE_NAMESPACE/python:3.11"
|
|
18
|
+
description: "Docker image to use for building environment"
|
|
19
|
+
|
|
20
|
+
# ------------------------------------------------------------------------------
|
|
21
|
+
# Reference parts
|
|
22
|
+
# ------------------------------------------------------------------------------
|
|
23
|
+
# The following section add functions to the bash executor of the image.
|
|
24
|
+
# * we disable PS4 (used by `set -x`)
|
|
25
|
+
# * we create functions to create collapsible timed sections
|
|
26
|
+
# * we create some coloring functions
|
|
27
|
+
#
|
|
28
|
+
# Collapsible sections:
|
|
29
|
+
# https://docs.gitlab.com/ee/ci/jobs/#custom-collapsible-sections
|
|
30
|
+
#
|
|
31
|
+
# Usage:
|
|
32
|
+
# - !reference [".core:functions", script]
|
|
33
|
+
.core:functions:
|
|
34
|
+
script:
|
|
35
|
+
- |
|
|
36
|
+
# !reference [".core:functions", script]
|
|
37
|
+
set -e
|
|
38
|
+
set -o pipefail
|
|
39
|
+
export PS4=''
|
|
40
|
+
# Sections
|
|
41
|
+
section_start() { echo -e "section_start:`date +%s`:${1}${3}\r\e[0K\e[34;1m${2}\e[0m"; }
|
|
42
|
+
section_start_c() { section_start "$1" "$2" "[collapsed=true]"; }
|
|
43
|
+
section_start_nc() { section_start "$1" "$2" "[collapsed=false]"; }
|
|
44
|
+
section_end() { echo -e "section_end:`date +%s`:${1}\r\e[0K"; }
|
|
45
|
+
# Titles are bluish like section starts
|
|
46
|
+
color_title() { echo -e "\e[1;34m"${@}"\e[0m"; }
|
|
47
|
+
color_error() { echo -e "\e[1;31m"${@}"\e[0m" >&2; }
|
|
48
|
+
color_warning() { echo -e "\e[1;33m"${@}"\e[0m" >&2; }
|
|
49
|
+
#
|
|
50
|
+
color_command() { echo -e "\e[1;32m"\$ ${@}"\e[0m" >&2; }
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
# ------------------------------------------------------------------------------
|
|
54
|
+
# .core:prolog
|
|
55
|
+
# ------------------------------------------------------------------------------
|
|
56
|
+
# Print debugging info, notably details that allow
|
|
57
|
+
# to retrieve instance, project, pipeline and job
|
|
58
|
+
# from the raw log files on the server.
|
|
59
|
+
#
|
|
60
|
+
# Of interest: https://docs.gitlab.com/ci/variables/predefined_variables/
|
|
61
|
+
.core:prolog:
|
|
62
|
+
script:
|
|
63
|
+
- |
|
|
64
|
+
# !reference [".core:prolog", script]
|
|
65
|
+
section_start_c "core_prolog" "Core information"
|
|
66
|
+
cat <<_EOF >&2
|
|
67
|
+
Current:
|
|
68
|
+
time: $(date -R)
|
|
69
|
+
server: ${CI_SERVER_URL}
|
|
70
|
+
project: ${CI_PROJECT_URL}
|
|
71
|
+
pipeline: ${CI_PIPELINE_URL}
|
|
72
|
+
job: ${CI_JOB_URL}
|
|
73
|
+
timeout: ${CI_JOB_TIMEOUT}
|
|
74
|
+
pipeline start: ${CI_PIPELINE_CREATED_AT}
|
|
75
|
+
#
|
|
76
|
+
source: ${CI_PIPELINE_SOURCE}
|
|
77
|
+
protected: ${CI_COMMIT_REF_PROTECTED}
|
|
78
|
+
#
|
|
79
|
+
reference: ${CI_COMMIT_REF_NAME}
|
|
80
|
+
sha: ${CI_COMMIT_SHA}
|
|
81
|
+
tag name: ${CI_COMMIT_TAG}
|
|
82
|
+
default branch: ${CI_DEFAULT_BRANCH}
|
|
83
|
+
#
|
|
84
|
+
server version: ${CI_SERVER_VERSION}
|
|
85
|
+
runner version: ${CI_RUNNER_VERSION}
|
|
86
|
+
runner id: ${CI_RUNNER_ID}
|
|
87
|
+
_EOF
|
|
88
|
+
section_end "core_prolog"
|
|
89
|
+
|
|
90
|
+
# ------------------------------------------------------------------------------
|
|
91
|
+
# .core:defaults
|
|
92
|
+
# ------------------------------------------------------------------------------
|
|
93
|
+
# cf. https://docs.gitlab.com/ee/ci/yaml/#default
|
|
94
|
+
.core:defaults:
|
|
95
|
+
image: alpine
|
|
96
|
+
needs: []
|
|
97
|
+
before_script:
|
|
98
|
+
- !reference [".core:functions", script]
|
|
99
|
+
- !reference [".core:prolog", script]
|
|
100
|
+
rules:
|
|
101
|
+
- when: never
|
|
102
|
+
|
|
103
|
+
# ------------------------------------------------------------------------------
|
|
104
|
+
# .core:make
|
|
105
|
+
# ------------------------------------------------------------------------------
|
|
106
|
+
.core:make:
|
|
107
|
+
script:
|
|
108
|
+
- |
|
|
109
|
+
# !reference [".core:make", script]
|
|
110
|
+
color_command make ${MAKEFILE_TARGET}
|
|
111
|
+
make ${MAKEFILE_TARGET} ${MAKEFILE_FLAGS}
|
|
112
|
+
|
|
113
|
+
# ------------------------------------------------------------------------------
|
|
114
|
+
# .core:rules
|
|
115
|
+
# ------------------------------------------------------------------------------
|
|
116
|
+
.core:rules:if:
|
|
117
|
+
# !reference [".core:rules:if", is_tag]
|
|
118
|
+
is_tag:
|
|
119
|
+
- if: $CI_COMMIT_TAG != null
|
|
120
|
+
when: on_success
|
|
121
|
+
|
|
122
|
+
# !reference [".core:rules:if", is_merge_request]
|
|
123
|
+
is_merge_request:
|
|
124
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
125
|
+
when: on_success
|
|
126
|
+
|
|
127
|
+
# !reference [".core:rules:if", if_not_merge_request]
|
|
128
|
+
if_not_merge_request:
|
|
129
|
+
- if: $CI_PIPELINE_SOURCE != "merge_request_event"
|
|
130
|
+
when: on_success
|
|
131
|
+
|
|
132
|
+
# !reference [".core:rules:if", is_default_branch]
|
|
133
|
+
is_default_branch:
|
|
134
|
+
# Reference (branch/tag) must be protected, and this must not be a merge request
|
|
135
|
+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
136
|
+
when: on_success
|
|
137
|
+
|
|
138
|
+
# !reference [".core:rules:if", is_not_default_branch]
|
|
139
|
+
is_not_default_branch:
|
|
140
|
+
# Reference (branch/tag) must be protected, and this must not be a merge request
|
|
141
|
+
- if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
|
|
142
|
+
when: on_success
|
|
143
|
+
|
|
144
|
+
# !reference [".core:rules:if", if_protected]
|
|
145
|
+
if_protected:
|
|
146
|
+
- if: $CI_COMMIT_REF_PROTECTED == "true"
|
|
147
|
+
when: on_success
|
|
148
|
+
|
|
149
|
+
# !reference [".core:rules:if", if_protected]
|
|
150
|
+
if_not_protected:
|
|
151
|
+
- if: $CI_COMMIT_REF_PROTECTED != "true"
|
|
152
|
+
when: on_success
|
|
153
|
+
|
|
154
|
+
.core:rules:not_if:
|
|
155
|
+
# !reference [".core:rules:not_if", pages_are_inactive]
|
|
156
|
+
pages_are_inactive:
|
|
157
|
+
- if: $CI_PAGES_URL == null
|
|
158
|
+
when: never
|
|
159
|
+
|
|
160
|
+
# !reference [".core:rules:not_if", is_tag]
|
|
161
|
+
is_tag:
|
|
162
|
+
- if: $CI_COMMIT_TAG != null
|
|
163
|
+
when: never
|
|
164
|
+
|
|
165
|
+
# !reference [".core:rules:not_if", is_not_tag]
|
|
166
|
+
is_not_tag:
|
|
167
|
+
- if: $CI_COMMIT_TAG == null
|
|
168
|
+
when: never
|
|
169
|
+
|
|
170
|
+
# !reference [".core:rules:not_if", is_merge_request]
|
|
171
|
+
is_merge_request:
|
|
172
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
173
|
+
when: never
|
|
174
|
+
|
|
175
|
+
# !reference [".core:rules:not_if", is_not_merge_request]
|
|
176
|
+
is_not_merge_request:
|
|
177
|
+
- if: $CI_PIPELINE_SOURCE != "merge_request_event"
|
|
178
|
+
when: never
|
|
179
|
+
|
|
180
|
+
# !reference [".core:rules:if", is_protected]
|
|
181
|
+
is_protected:
|
|
182
|
+
- if: $CI_COMMIT_REF_PROTECTED == "true"
|
|
183
|
+
when: never
|
|
184
|
+
|
|
185
|
+
# !reference [".core:rules:not_if", not_if_protected]
|
|
186
|
+
not_if_protected:
|
|
187
|
+
- if: $CI_COMMIT_REF_PROTECTED != "true"
|
|
188
|
+
when: never
|
|
189
|
+
|
|
190
|
+
# !reference [".core:rules:not_if", is_default_branch]
|
|
191
|
+
is_default_branch:
|
|
192
|
+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
193
|
+
when: never
|
|
194
|
+
|
|
195
|
+
# !reference [".core:rules:not_if", is_not_default_branch]
|
|
196
|
+
is_not_default_branch:
|
|
197
|
+
- if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
|
|
198
|
+
when: never
|
|
199
|
+
|
|
200
|
+
# !reference [".core:rules:not_if", is_protected]
|
|
201
|
+
is_protected:
|
|
202
|
+
- if: $CI_COMMIT_REF_PROTECTED == "true"
|
|
203
|
+
when: never
|
|
204
|
+
|
|
205
|
+
# !reference [".core:rules:not_if", is_not_protected]
|
|
206
|
+
is_not_protected:
|
|
207
|
+
- if: $CI_COMMIT_REF_PROTECTED != "true"
|
|
208
|
+
when: never
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
|
2
|
+
#
|
|
3
|
+
---
|
|
4
|
+
variables:
|
|
5
|
+
PUBLISH_PAGES:
|
|
6
|
+
value: ""
|
|
7
|
+
description: "Set to 'true' to force publish the generated pages. Can be set to 'false', or to a branch name"
|
|
8
|
+
|
|
9
|
+
# ------------------------------------------------------------------------------
|
|
10
|
+
# .pages:user
|
|
11
|
+
# ------------------------------------------------------------------------------
|
|
12
|
+
.pages:user:pre:
|
|
13
|
+
before_script:
|
|
14
|
+
- /bin/true
|
|
15
|
+
|
|
16
|
+
.pages:user:post:
|
|
17
|
+
before_script:
|
|
18
|
+
- /bin/true
|
|
19
|
+
|
|
20
|
+
.pages:defaults:
|
|
21
|
+
extends: .core:defaults
|
|
22
|
+
image: "$PYTHON_JOB_IMAGE"
|
|
23
|
+
stage: deploy
|
|
24
|
+
inherit:
|
|
25
|
+
default: false
|
|
26
|
+
artifacts:
|
|
27
|
+
paths:
|
|
28
|
+
- public/
|
|
29
|
+
before_script:
|
|
30
|
+
- !reference [".core:defaults", before_script]
|
|
31
|
+
- !reference [".pages:user:pre", before_script]
|
|
32
|
+
- (mkdir -p public && touch public/.placeholder) 2>/dev/null || true
|
|
33
|
+
- !reference [".pages:user:post", before_script]
|
|
34
|
+
script:
|
|
35
|
+
- mv -vf public/sphinx/html/* public/
|
|
36
|
+
- mv -vf public/sphinx/html/.* public/ || true
|
|
37
|
+
rules:
|
|
38
|
+
- !reference [".core:rules:not_if", pages_are_inactive]
|
|
39
|
+
- !reference [".core:rules:not_if", is_merge_request]
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
# ------------------------------------------------------------------------------
|
|
43
|
+
# .pages
|
|
44
|
+
# ------------------------------------------------------------------------------
|
|
45
|
+
.pages:
|
|
46
|
+
extends: .pages:defaults
|
|
47
|
+
inherit:
|
|
48
|
+
default: false
|
|
49
|
+
rules:
|
|
50
|
+
# We need defaults, and for pages this could be the default branch, or on tags.
|
|
51
|
+
# For this reason, use same rules than for .python:package:upload, but add
|
|
52
|
+
# an overwrite switch
|
|
53
|
+
- !reference [".pages:defaults", rules]
|
|
54
|
+
- if: $PUBLISH_PAGES == "true"
|
|
55
|
+
when: on_success
|
|
56
|
+
- if: $PUBLISH_PAGES == "false"
|
|
57
|
+
when: never
|
|
58
|
+
- if: $PUBLISH_PAGES == $CI_COMMIT_BRANCH
|
|
59
|
+
when: on_success
|
|
60
|
+
- !reference [".core:rules:not_if", is_merge_request]
|
|
61
|
+
- !reference [".core:rules:not_if", is_not_protected]
|
|
62
|
+
- !reference [".core:rules:not_if", is_not_tag]
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
|
2
|
+
#
|
|
3
|
+
---
|
|
4
|
+
variables:
|
|
5
|
+
PRECOMMITSKIP:
|
|
6
|
+
value: ""
|
|
7
|
+
description: "pre-commit jobs to skip"
|
|
8
|
+
PRECOMMITFLAGS:
|
|
9
|
+
value: ""
|
|
10
|
+
description: "pre-commit additional flags"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# ------------------------------------------------------------------------------
|
|
14
|
+
# .pre-commit:user
|
|
15
|
+
# ------------------------------------------------------------------------------
|
|
16
|
+
.pre-commit:user:pre:
|
|
17
|
+
before_script:
|
|
18
|
+
- /bin/true
|
|
19
|
+
|
|
20
|
+
.pre-commit:user:post:
|
|
21
|
+
before_script:
|
|
22
|
+
- /bin/true
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# ------------------------------------------------------------------------------
|
|
26
|
+
# .pre-commit:prepare
|
|
27
|
+
# ------------------------------------------------------------------------------
|
|
28
|
+
.pre-commit:defaults:prepare:
|
|
29
|
+
before_script:
|
|
30
|
+
# Some precommit hooks, such as for ansible, will complain that it's in a world
|
|
31
|
+
# writable directory
|
|
32
|
+
- chmod 755 .
|
|
33
|
+
- |
|
|
34
|
+
# Install pipx if missing
|
|
35
|
+
if ! builtin type -P "pipx" &>/dev/null; then
|
|
36
|
+
apt-get update
|
|
37
|
+
apt-get install -yq --no-install-recommends pipx
|
|
38
|
+
fi
|
|
39
|
+
- PIPX_BIN_DIR=/usr/local/bin pipx install pre-commit
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
# ------------------------------------------------------------------------------
|
|
43
|
+
# .pre-commit:defaults
|
|
44
|
+
# ------------------------------------------------------------------------------
|
|
45
|
+
.pre-commit:defaults:
|
|
46
|
+
extends: .core:defaults
|
|
47
|
+
image: "$PYTHON_JOB_IMAGE"
|
|
48
|
+
stage: lint
|
|
49
|
+
inherit:
|
|
50
|
+
default: false
|
|
51
|
+
before_script:
|
|
52
|
+
- !reference [".core:defaults", before_script]
|
|
53
|
+
- !reference [".pre-commit:user:pre", before_script]
|
|
54
|
+
- !reference [".pre-commit:defaults:prepare", before_script]
|
|
55
|
+
- !reference [".pre-commit:user:post", before_script]
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
# ------------------------------------------------------------------------------
|
|
59
|
+
# .pre-commit
|
|
60
|
+
# ------------------------------------------------------------------------------
|
|
61
|
+
# Runs pre-commit configured tools.
|
|
62
|
+
#
|
|
63
|
+
# This job has value in a merge request, in order to prevent it from being
|
|
64
|
+
# merged.
|
|
65
|
+
.pre-commit:
|
|
66
|
+
extends: .pre-commit:defaults
|
|
67
|
+
variables:
|
|
68
|
+
PRE_COMMIT_HOME: "$CI_PROJECT_DIR/.cache/pre-commit"
|
|
69
|
+
cache:
|
|
70
|
+
- key: ${CI_COMMIT_BRANCH}-pre-commit
|
|
71
|
+
paths:
|
|
72
|
+
- .cache
|
|
73
|
+
script:
|
|
74
|
+
- SKIP="${PRECOMMITSKIP} ${SKIP}" pre-commit run -a ${PRECOMMITFLAGS}
|
|
75
|
+
rules:
|
|
76
|
+
# On a merge request, user is expected to fix the error before merging
|
|
77
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
78
|
+
allow_failure: false
|
|
79
|
+
when: on_success
|
|
80
|
+
|
|
81
|
+
# Allow failure when there's no action that can be taken to fix the pipeline.
|
|
82
|
+
- when: on_success
|
|
83
|
+
allow_failure: true
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
# ------------------------------------------------------------------------------
|
|
87
|
+
# .pre-commit:autoupdate
|
|
88
|
+
# ------------------------------------------------------------------------------
|
|
89
|
+
# Verify that pre-commit is up-to-date.
|
|
90
|
+
#
|
|
91
|
+
# This job has value in a merge request, in order to prevent it from being
|
|
92
|
+
# merged.
|
|
93
|
+
.pre-commit:autoupdate:
|
|
94
|
+
extends: .pre-commit:defaults
|
|
95
|
+
script:
|
|
96
|
+
- pre-commit autoupdate
|
|
97
|
+
- |
|
|
98
|
+
#
|
|
99
|
+
if test -n "$(git status --porcelain)"; then
|
|
100
|
+
color_error "error: .pre-commit-config.yaml is not up-to-date"
|
|
101
|
+
exit 13
|
|
102
|
+
fi
|
|
103
|
+
rules:
|
|
104
|
+
# On a merge request, user is expected to fix the error before merging
|
|
105
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
106
|
+
allow_failure: false
|
|
107
|
+
when: on_success
|
|
108
|
+
|
|
109
|
+
# Allow failure when there's no action that can be taken to fix the pipeline.
|
|
110
|
+
- when: on_success
|
|
111
|
+
allow_failure: true
|