cikit 0.0.3__tar.gz → 0.0.5__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.
- {cikit-0.0.3 → cikit-0.0.5}/.gitignore +1 -1
- {cikit-0.0.3 → cikit-0.0.5}/.gitlab-ci.yml +2 -3
- {cikit-0.0.3 → cikit-0.0.5}/PKG-INFO +58 -15
- {cikit-0.0.3 → cikit-0.0.5}/README.md +56 -13
- {cikit-0.0.3 → cikit-0.0.5}/ci_commands/all_.py +27 -13
- {cikit-0.0.3 → cikit-0.0.5}/ci_commands/coverage.py +5 -5
- {cikit-0.0.3 → cikit-0.0.5}/ci_commands/init.py +6 -6
- {cikit-0.0.3 → cikit-0.0.5}/ci_commands/pylint.py +3 -3
- {cikit-0.0.3 → cikit-0.0.5}/ci_commands/ruff.py +2 -2
- {cikit-0.0.3 → cikit-0.0.5}/ci_commands/sphinx.py +2 -2
- {cikit-0.0.3 → cikit-0.0.5}/ci_commands/test.py +6 -12
- cikit-0.0.5/docs/build_reports/tests.rst +8 -0
- {cikit-0.0.3 → cikit-0.0.5}/docs/concepts/artifacts.rst +1 -1
- cikit-0.0.5/docs/concepts/cikit_data.rst +58 -0
- {cikit-0.0.3 → cikit-0.0.5}/docs/concepts/index.rst +1 -1
- {cikit-0.0.3 → cikit-0.0.5}/docs/concepts/metadata.rst +1 -1
- {cikit-0.0.3 → cikit-0.0.5}/docs/concepts/providers.rst +3 -0
- {cikit-0.0.3 → cikit-0.0.5}/docs/getting_started.rst +10 -8
- {cikit-0.0.3 → cikit-0.0.5}/docs/guides/ci_commands.rst +2 -2
- {cikit-0.0.3 → cikit-0.0.5}/docs/guides/gitlab_ci.rst +19 -0
- {cikit-0.0.3 → cikit-0.0.5}/docs/guides/local_pipeline.rst +3 -1
- {cikit-0.0.3 → cikit-0.0.5}/docs/guides/sphinx_build.rst +1 -1
- {cikit-0.0.3 → cikit-0.0.5}/pyproject.toml +3 -2
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/__init__.py +2 -2
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/badge.py +2 -2
- cikit-0.0.5/src/cikit/ci/README.md +120 -0
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/ci/main.py +2 -0
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/ci/runner.py +23 -8
- cikit-0.0.5/src/cikit/data/README.md +445 -0
- cikit-0.0.5/src/cikit/data/__init__.py +15 -0
- {cikit-0.0.3/src/cikit/jobdata → cikit-0.0.5/src/cikit/data}/api.py +113 -117
- {cikit-0.0.3/src/cikit/jobdata → cikit-0.0.5/src/cikit/data}/cli.py +52 -72
- {cikit-0.0.3/src/cikit/jobdata → cikit-0.0.5/src/cikit/data}/client.py +30 -31
- {cikit-0.0.3/src/cikit/jobdata → cikit-0.0.5/src/cikit/data}/common.py +37 -32
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/env/README.md +72 -11
- cikit-0.0.5/src/cikit/env/__init__.py +23 -0
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/env/api.py +191 -161
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/env/cli.py +37 -32
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/env/common.py +26 -35
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/env/env_vars.py +10 -9
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/env/provider.py +51 -25
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/errors.py +6 -2
- cikit-0.0.5/src/cikit/factory.py +53 -0
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/lint_to_rst.py +1 -1
- cikit-0.0.5/src/cikit/macros/README.md +277 -0
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/macros/__init__.py +2 -2
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/macros/cmake.py +13 -7
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/macros/common.py +52 -27
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/macros/coverage.py +55 -44
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/macros/pylint.py +46 -32
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/macros/pytest.py +9 -11
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/macros/ruff.py +42 -24
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/macros/sphinx.py +10 -6
- cikit-0.0.5/src/cikit/macros/test_report.py +85 -0
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/project_meta.py +2 -1
- cikit-0.0.5/src/cikit/resources/php/cikit_data/README.md +267 -0
- cikit-0.0.3/src/cikit/resources/php/jobdata/jobdata_common.php → cikit-0.0.5/src/cikit/resources/php/cikit_data/cikit_data_common.php +126 -126
- cikit-0.0.3/src/cikit/resources/php/jobdata/jobdata_create.php → cikit-0.0.5/src/cikit/resources/php/cikit_data/cikit_data_create.php +200 -200
- cikit-0.0.3/src/cikit/resources/php/jobdata/jobdata_latest.php → cikit-0.0.5/src/cikit/resources/php/cikit_data/cikit_data_latest.php +121 -116
- cikit-0.0.3/src/cikit/resources/php/jobdata/jobdata_timeline.php → cikit-0.0.5/src/cikit/resources/php/cikit_data/cikit_data_timeline.php +217 -217
- cikit-0.0.3/src/cikit/resources/php/jobdata/jobdata_update.php → cikit-0.0.5/src/cikit/resources/php/cikit_data/cikit_data_update.php +160 -160
- {cikit-0.0.3/src/cikit/resources/php/jobdata → cikit-0.0.5/src/cikit/resources/php/cikit_data}/config.php +1 -1
- {cikit-0.0.3/src/cikit/resources/php/jobdata → cikit-0.0.5/src/cikit/resources/php/cikit_data}/config.php.example +77 -78
- cikit-0.0.5/src/cikit/resources/php/cikit_data/generate_secrets.py +38 -0
- {cikit-0.0.3/src/cikit/resources/sql/jobdata → cikit-0.0.5/src/cikit/resources/sql/cikit_data}/README.md +7 -7
- {cikit-0.0.3/src/cikit/resources/sql/jobdata → cikit-0.0.5/src/cikit/resources/sql/cikit_data}/db_init.sql +132 -132
- {cikit-0.0.3/src/cikit/resources/sql/jobdata → cikit-0.0.5/src/cikit/resources/sql/cikit_data}/db_reset.sql +20 -20
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/rst_tools.py +1 -1
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/timeline.py +6 -6
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit.egg-info/PKG-INFO +58 -15
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit.egg-info/SOURCES.txt +26 -25
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit.egg-info/entry_points.txt +1 -1
- cikit-0.0.5/tests/systemtests/test_data_cli.py +164 -0
- {cikit-0.0.3 → cikit-0.0.5}/tests/systemtests/test_env_cli.py +3 -3
- {cikit-0.0.3 → cikit-0.0.5}/tests/unittests/test_ci_commands/test_all.py +2 -2
- {cikit-0.0.3 → cikit-0.0.5}/tests/unittests/test_cikit/test_badge.py +1 -1
- cikit-0.0.5/tests/unittests/test_cikit/test_data/__init__.py +12 -0
- cikit-0.0.5/tests/unittests/test_cikit/test_data/test_api.py +442 -0
- {cikit-0.0.3/tests/unittests/test_cikit/test_jobdata → cikit-0.0.5/tests/unittests/test_cikit/test_data}/test_cli.py +20 -12
- {cikit-0.0.3/tests/unittests/test_cikit/test_jobdata → cikit-0.0.5/tests/unittests/test_cikit/test_data}/test_client.py +104 -84
- {cikit-0.0.3/tests/unittests/test_cikit/test_jobdata → cikit-0.0.5/tests/unittests/test_cikit/test_data}/test_common.py +44 -39
- {cikit-0.0.3 → cikit-0.0.5}/tests/unittests/test_cikit/test_env/test_api.py +131 -58
- {cikit-0.0.3 → cikit-0.0.5}/tests/unittests/test_cikit/test_env/test_env_vars.py +7 -7
- {cikit-0.0.3 → cikit-0.0.5}/tests/unittests/test_cikit/test_env/test_provider.py +44 -28
- {cikit-0.0.3 → cikit-0.0.5}/tests/unittests/test_cikit/test_errors.py +14 -4
- cikit-0.0.5/tests/unittests/test_cikit/test_factory.py +170 -0
- {cikit-0.0.3 → cikit-0.0.5}/tests/unittests/test_cikit/test_lint_to_rst.py +5 -17
- cikit-0.0.5/tests/unittests/test_cikit/test_macros/__init__.py +8 -0
- {cikit-0.0.3 → cikit-0.0.5}/tests/unittests/test_cikit/test_macros/test_cmake.py +23 -8
- {cikit-0.0.3 → cikit-0.0.5}/tests/unittests/test_cikit/test_macros/test_common.py +16 -17
- {cikit-0.0.3 → cikit-0.0.5}/tests/unittests/test_cikit/test_macros/test_coverage.py +27 -36
- {cikit-0.0.3 → cikit-0.0.5}/tests/unittests/test_cikit/test_macros/test_pylint.py +30 -18
- {cikit-0.0.3 → cikit-0.0.5}/tests/unittests/test_cikit/test_macros/test_pytest.py +11 -32
- {cikit-0.0.3 → cikit-0.0.5}/tests/unittests/test_cikit/test_macros/test_ruff.py +22 -10
- {cikit-0.0.3 → cikit-0.0.5}/tests/unittests/test_cikit/test_macros/test_test_report.py +36 -21
- {cikit-0.0.3 → cikit-0.0.5}/tests/unittests/test_cikit/test_project_meta.py +3 -0
- {cikit-0.0.3 → cikit-0.0.5}/tests/unittests/test_cikit/test_timeline.py +1 -1
- {cikit-0.0.3 → cikit-0.0.5}/uv.lock +1 -1
- cikit-0.0.3/docs/build_reports/tests.rst +0 -8
- cikit-0.0.3/docs/concepts/jobdata.rst +0 -49
- cikit-0.0.3/src/cikit/ci/README.md +0 -180
- cikit-0.0.3/src/cikit/env/__init__.py +0 -33
- cikit-0.0.3/src/cikit/factory.py +0 -51
- cikit-0.0.3/src/cikit/jobdata/README.md +0 -408
- cikit-0.0.3/src/cikit/jobdata/__init__.py +0 -14
- cikit-0.0.3/src/cikit/macros/README.md +0 -223
- cikit-0.0.3/src/cikit/macros/test_report.py +0 -94
- cikit-0.0.3/src/cikit/resources/php/jobdata/README.md +0 -258
- cikit-0.0.3/tests/systemtests/test_jobdata_cli.py +0 -162
- cikit-0.0.3/tests/unittests/test_cikit/test_factory.py +0 -183
- cikit-0.0.3/tests/unittests/test_cikit/test_jobdata/__init__.py +0 -0
- cikit-0.0.3/tests/unittests/test_cikit/test_jobdata/test_api.py +0 -437
- cikit-0.0.3/tests/unittests/test_cikit/test_macros/__init__.py +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/.project +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/.pydevproject +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/.pylintrc +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/.repomixignore +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/LICENSE +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/ci_commands/__init__.py +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/docs/Makefile +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/docs/_static/logo/cikit-logo-192.png +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/docs/_static/logo/cikit-logo.png +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/docs/_static/logo/favicon.ico +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/docs/build_reports/index.rst +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/docs/build_reports/lint.rst +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/docs/concepts/environment.rst +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/docs/conf.py +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/docs/guides/index.rst +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/docs/index.rst +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/setup.cfg +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/ci/__init__.py +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/ci/loader.py +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/command.py +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/logging_utils.py +0 -0
- {cikit-0.0.3/src/cikit/resources/php/jobdata → cikit-0.0.5/src/cikit/resources/php/cikit_data}/.htaccess +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/status.py +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/systemtest/__init__.py +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/systemtest/fixtures.py +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit/xml_tools.py +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit.egg-info/dependency_links.txt +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit.egg-info/requires.txt +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/src/cikit.egg-info/top_level.txt +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/tests/systemtests/conftest.py +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/tests/systemtests/test_ci_cli.py +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/tests/unittests/test_ci_commands/__init__.py +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/tests/unittests/test_cikit/__init__.py +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/tests/unittests/test_cikit/test_command.py +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/tests/unittests/test_cikit/test_env/__init__.py +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/tests/unittests/test_cikit/test_env/test_common.py +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/tests/unittests/test_cikit/test_logging_utils.py +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/tests/unittests/test_cikit/test_macros/test_sphinx.py +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/tests/unittests/test_cikit/test_rst_tools.py +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/tests/unittests/test_cikit/test_status.py +0 -0
- {cikit-0.0.3 → cikit-0.0.5}/tests/unittests/test_cikit/test_xml_tools.py +0 -0
|
@@ -16,7 +16,6 @@ variables:
|
|
|
16
16
|
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
|
|
17
17
|
UV_CACHE_DIR: "$CI_PROJECT_DIR/.uv-cache"
|
|
18
18
|
UV_LINK_MODE: copy
|
|
19
|
-
JOBDATA_CACHE_DIR: public/jobdata
|
|
20
19
|
EXEC_TOOL: "uv run"
|
|
21
20
|
FF_TIMESTAMPS: "false"
|
|
22
21
|
|
|
@@ -103,7 +102,7 @@ pylint:
|
|
|
103
102
|
unittests:
|
|
104
103
|
stage: test
|
|
105
104
|
script:
|
|
106
|
-
- $EXEC_TOOL cikit test tests/unittests
|
|
105
|
+
- $EXEC_TOOL cikit --name unittests test tests/unittests
|
|
107
106
|
artifacts:
|
|
108
107
|
when: always
|
|
109
108
|
paths:
|
|
@@ -112,7 +111,7 @@ unittests:
|
|
|
112
111
|
systemtests:
|
|
113
112
|
stage: test
|
|
114
113
|
script:
|
|
115
|
-
- $EXEC_TOOL cikit test tests/systemtests
|
|
114
|
+
- $EXEC_TOOL cikit --name systemtests test tests/systemtests
|
|
116
115
|
artifacts:
|
|
117
116
|
when: always
|
|
118
117
|
paths:
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cikit
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.5
|
|
4
4
|
Summary: CI helper toolkit
|
|
5
5
|
Author-email: Sven Schlender <svesch@gmx.de>
|
|
6
6
|
License-Expression: GPL-3.0-or-later
|
|
7
7
|
Project-URL: Documentation, https://cikit-a4de14.gitlab.io
|
|
8
8
|
Project-URL: Repository, https://gitlab.com/svesch/cikit
|
|
9
|
-
Keywords: ci,gitlab,pipeline,artifacts,sphinx
|
|
9
|
+
Keywords: ci,gitlab,devops,pipeline,artifacts,sphinx
|
|
10
10
|
Classifier: Development Status :: 3 - Alpha
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.11
|
|
@@ -18,7 +18,6 @@ Requires-Dist: anybadge>=1.16
|
|
|
18
18
|
Requires-Dist: pygal>=3.1.0
|
|
19
19
|
Dynamic: license-file
|
|
20
20
|
|
|
21
|
-
|
|
22
21
|
# cikit
|
|
23
22
|
|
|
24
23
|
**cikit** is a lightweight Python toolkit for building reproducible CI/CD pipelines.
|
|
@@ -26,15 +25,15 @@ Dynamic: license-file
|
|
|
26
25
|
It provides reusable building blocks for:
|
|
27
26
|
|
|
28
27
|
* CI environment handling
|
|
29
|
-
* provider abstraction
|
|
28
|
+
* provider abstraction for GitLab and local execution
|
|
30
29
|
* command execution
|
|
31
30
|
* test execution and coverage reporting
|
|
32
|
-
* lint integration
|
|
31
|
+
* lint integration with Ruff and Pylint
|
|
33
32
|
* Sphinx documentation generation
|
|
34
33
|
* artifact management
|
|
35
34
|
* badge generation
|
|
36
35
|
* project metadata handling
|
|
37
|
-
*
|
|
36
|
+
* cikit data and pipeline reporting
|
|
38
37
|
|
|
39
38
|
The package is designed for projects that want to keep CI logic in Python instead of large shell scripts or complex YAML definitions.
|
|
40
39
|
|
|
@@ -50,11 +49,12 @@ Resolve CI variables from multiple sources:
|
|
|
50
49
|
* template expansion using `${VAR}` syntax
|
|
51
50
|
|
|
52
51
|
```python
|
|
53
|
-
from cikit.env import CiEnvironment
|
|
52
|
+
from cikit.env import CiEnvironment, get_env_vars
|
|
53
|
+
|
|
54
|
+
env = CiEnvironment(get_env_vars())
|
|
54
55
|
|
|
55
|
-
env = CiEnvironment()
|
|
56
56
|
print(env["PROJECT_ROOT"])
|
|
57
|
-
print(env
|
|
57
|
+
print(env.pipeline_id)
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
### Command Execution
|
|
@@ -87,6 +87,7 @@ Reports can be converted into reStructuredText and published as documentation ar
|
|
|
87
87
|
Built-in helpers for:
|
|
88
88
|
|
|
89
89
|
* pytest execution
|
|
90
|
+
* CTest execution
|
|
90
91
|
* JUnit XML generation
|
|
91
92
|
* coverage collection
|
|
92
93
|
* Cobertura reports
|
|
@@ -112,14 +113,15 @@ Read project information from:
|
|
|
112
113
|
|
|
113
114
|
Generate version files and metadata artifacts from a unified project model.
|
|
114
115
|
|
|
115
|
-
###
|
|
116
|
+
### Cikit Data and Metrics
|
|
116
117
|
|
|
117
|
-
Optional integration with the
|
|
118
|
+
Optional integration with the cikit data backend allows pipelines to store:
|
|
118
119
|
|
|
119
120
|
* build results
|
|
120
121
|
* quality metrics
|
|
121
122
|
* coverage values
|
|
122
123
|
* historical trends
|
|
124
|
+
* local artifact metadata
|
|
123
125
|
|
|
124
126
|
This data can be used to generate badges and timeline charts across multiple pipeline runs.
|
|
125
127
|
|
|
@@ -138,13 +140,13 @@ uv add cikit
|
|
|
138
140
|
## Quick Example
|
|
139
141
|
|
|
140
142
|
```python
|
|
141
|
-
from cikit.env import CiEnvironment
|
|
142
|
-
from cikit.logging_utils import setup_logging
|
|
143
143
|
from cikit.command import run_command
|
|
144
|
+
from cikit.env import CiEnvironment, get_env_vars
|
|
145
|
+
from cikit.logging_utils import setup_logging
|
|
144
146
|
|
|
145
147
|
setup_logging()
|
|
146
148
|
|
|
147
|
-
env = CiEnvironment()
|
|
149
|
+
env = CiEnvironment(get_env_vars())
|
|
148
150
|
|
|
149
151
|
result = run_command(
|
|
150
152
|
["pytest"],
|
|
@@ -158,6 +160,7 @@ result.check_returncode()
|
|
|
158
160
|
|
|
159
161
|
```text
|
|
160
162
|
project/
|
|
163
|
+
├── ci_commands/
|
|
161
164
|
├── docs/
|
|
162
165
|
├── src/
|
|
163
166
|
├── tests/
|
|
@@ -168,6 +171,44 @@ project/
|
|
|
168
171
|
└── rst/
|
|
169
172
|
```
|
|
170
173
|
|
|
174
|
+
## CI Command Framework
|
|
175
|
+
|
|
176
|
+
Projects can define Python-based CI commands in a root-level `ci_commands` package.
|
|
177
|
+
The `cikit` console command discovers these commands automatically and provides
|
|
178
|
+
shared logging, status handling, environment initialization and error handling.
|
|
179
|
+
|
|
180
|
+
A minimal command module typically looks like this:
|
|
181
|
+
|
|
182
|
+
```python
|
|
183
|
+
import argparse
|
|
184
|
+
|
|
185
|
+
from cikit import CiSection
|
|
186
|
+
from cikit.ci import run_ci_script
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def run(env, status, args: argparse.Namespace):
|
|
190
|
+
"""Run command logic."""
|
|
191
|
+
with CiSection("Run custom step", status=status):
|
|
192
|
+
...
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
def command(args: argparse.Namespace) -> int:
|
|
196
|
+
"""Run command."""
|
|
197
|
+
return run_ci_script("custom", lambda env, status: run(env, status, args), args=args)
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def register(subparsers: argparse._SubParsersAction):
|
|
201
|
+
"""Register command."""
|
|
202
|
+
parser = subparsers.add_parser("custom", help="Run custom CI step.")
|
|
203
|
+
parser.set_defaults(func=command)
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
The default logical run name can be overridden globally:
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
cikit --name custom-run custom
|
|
210
|
+
```
|
|
211
|
+
|
|
171
212
|
## Design Goals
|
|
172
213
|
|
|
173
214
|
* Pure Python implementation
|
|
@@ -185,10 +226,12 @@ The full documentation contains:
|
|
|
185
226
|
|
|
186
227
|
* CI environment reference
|
|
187
228
|
* command execution API
|
|
229
|
+
* CI command framework
|
|
188
230
|
* lint reporting
|
|
189
231
|
* testing helpers
|
|
232
|
+
* coverage reporting
|
|
190
233
|
* Sphinx integration
|
|
191
|
-
*
|
|
234
|
+
* cikit data integration
|
|
192
235
|
* artifact management
|
|
193
236
|
* examples and recipes
|
|
194
237
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
# cikit
|
|
3
2
|
|
|
4
3
|
**cikit** is a lightweight Python toolkit for building reproducible CI/CD pipelines.
|
|
@@ -6,15 +5,15 @@
|
|
|
6
5
|
It provides reusable building blocks for:
|
|
7
6
|
|
|
8
7
|
* CI environment handling
|
|
9
|
-
* provider abstraction
|
|
8
|
+
* provider abstraction for GitLab and local execution
|
|
10
9
|
* command execution
|
|
11
10
|
* test execution and coverage reporting
|
|
12
|
-
* lint integration
|
|
11
|
+
* lint integration with Ruff and Pylint
|
|
13
12
|
* Sphinx documentation generation
|
|
14
13
|
* artifact management
|
|
15
14
|
* badge generation
|
|
16
15
|
* project metadata handling
|
|
17
|
-
*
|
|
16
|
+
* cikit data and pipeline reporting
|
|
18
17
|
|
|
19
18
|
The package is designed for projects that want to keep CI logic in Python instead of large shell scripts or complex YAML definitions.
|
|
20
19
|
|
|
@@ -30,11 +29,12 @@ Resolve CI variables from multiple sources:
|
|
|
30
29
|
* template expansion using `${VAR}` syntax
|
|
31
30
|
|
|
32
31
|
```python
|
|
33
|
-
from cikit.env import CiEnvironment
|
|
32
|
+
from cikit.env import CiEnvironment, get_env_vars
|
|
33
|
+
|
|
34
|
+
env = CiEnvironment(get_env_vars())
|
|
34
35
|
|
|
35
|
-
env = CiEnvironment()
|
|
36
36
|
print(env["PROJECT_ROOT"])
|
|
37
|
-
print(env
|
|
37
|
+
print(env.pipeline_id)
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
### Command Execution
|
|
@@ -67,6 +67,7 @@ Reports can be converted into reStructuredText and published as documentation ar
|
|
|
67
67
|
Built-in helpers for:
|
|
68
68
|
|
|
69
69
|
* pytest execution
|
|
70
|
+
* CTest execution
|
|
70
71
|
* JUnit XML generation
|
|
71
72
|
* coverage collection
|
|
72
73
|
* Cobertura reports
|
|
@@ -92,14 +93,15 @@ Read project information from:
|
|
|
92
93
|
|
|
93
94
|
Generate version files and metadata artifacts from a unified project model.
|
|
94
95
|
|
|
95
|
-
###
|
|
96
|
+
### Cikit Data and Metrics
|
|
96
97
|
|
|
97
|
-
Optional integration with the
|
|
98
|
+
Optional integration with the cikit data backend allows pipelines to store:
|
|
98
99
|
|
|
99
100
|
* build results
|
|
100
101
|
* quality metrics
|
|
101
102
|
* coverage values
|
|
102
103
|
* historical trends
|
|
104
|
+
* local artifact metadata
|
|
103
105
|
|
|
104
106
|
This data can be used to generate badges and timeline charts across multiple pipeline runs.
|
|
105
107
|
|
|
@@ -118,13 +120,13 @@ uv add cikit
|
|
|
118
120
|
## Quick Example
|
|
119
121
|
|
|
120
122
|
```python
|
|
121
|
-
from cikit.env import CiEnvironment
|
|
122
|
-
from cikit.logging_utils import setup_logging
|
|
123
123
|
from cikit.command import run_command
|
|
124
|
+
from cikit.env import CiEnvironment, get_env_vars
|
|
125
|
+
from cikit.logging_utils import setup_logging
|
|
124
126
|
|
|
125
127
|
setup_logging()
|
|
126
128
|
|
|
127
|
-
env = CiEnvironment()
|
|
129
|
+
env = CiEnvironment(get_env_vars())
|
|
128
130
|
|
|
129
131
|
result = run_command(
|
|
130
132
|
["pytest"],
|
|
@@ -138,6 +140,7 @@ result.check_returncode()
|
|
|
138
140
|
|
|
139
141
|
```text
|
|
140
142
|
project/
|
|
143
|
+
├── ci_commands/
|
|
141
144
|
├── docs/
|
|
142
145
|
├── src/
|
|
143
146
|
├── tests/
|
|
@@ -148,6 +151,44 @@ project/
|
|
|
148
151
|
└── rst/
|
|
149
152
|
```
|
|
150
153
|
|
|
154
|
+
## CI Command Framework
|
|
155
|
+
|
|
156
|
+
Projects can define Python-based CI commands in a root-level `ci_commands` package.
|
|
157
|
+
The `cikit` console command discovers these commands automatically and provides
|
|
158
|
+
shared logging, status handling, environment initialization and error handling.
|
|
159
|
+
|
|
160
|
+
A minimal command module typically looks like this:
|
|
161
|
+
|
|
162
|
+
```python
|
|
163
|
+
import argparse
|
|
164
|
+
|
|
165
|
+
from cikit import CiSection
|
|
166
|
+
from cikit.ci import run_ci_script
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def run(env, status, args: argparse.Namespace):
|
|
170
|
+
"""Run command logic."""
|
|
171
|
+
with CiSection("Run custom step", status=status):
|
|
172
|
+
...
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def command(args: argparse.Namespace) -> int:
|
|
176
|
+
"""Run command."""
|
|
177
|
+
return run_ci_script("custom", lambda env, status: run(env, status, args), args=args)
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def register(subparsers: argparse._SubParsersAction):
|
|
181
|
+
"""Register command."""
|
|
182
|
+
parser = subparsers.add_parser("custom", help="Run custom CI step.")
|
|
183
|
+
parser.set_defaults(func=command)
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
The default logical run name can be overridden globally:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
cikit --name custom-run custom
|
|
190
|
+
```
|
|
191
|
+
|
|
151
192
|
## Design Goals
|
|
152
193
|
|
|
153
194
|
* Pure Python implementation
|
|
@@ -165,10 +206,12 @@ The full documentation contains:
|
|
|
165
206
|
|
|
166
207
|
* CI environment reference
|
|
167
208
|
* command execution API
|
|
209
|
+
* CI command framework
|
|
168
210
|
* lint reporting
|
|
169
211
|
* testing helpers
|
|
212
|
+
* coverage reporting
|
|
170
213
|
* Sphinx integration
|
|
171
|
-
*
|
|
214
|
+
* cikit data integration
|
|
172
215
|
* artifact management
|
|
173
216
|
* examples and recipes
|
|
174
217
|
|
|
@@ -45,20 +45,34 @@ def command(args: argparse.Namespace) -> int:
|
|
|
45
45
|
Returns:
|
|
46
46
|
Process exit code.
|
|
47
47
|
"""
|
|
48
|
+
def ns(args: argparse.Namespace, name: str = None, **kwargs) -> argparse.Namespace:
|
|
49
|
+
"""Create command arguments for one workflow step.
|
|
50
|
+
|
|
51
|
+
Args:
|
|
52
|
+
args: Parsed arguments of the all command.
|
|
53
|
+
name: Optional logical run name override for the workflow step.
|
|
54
|
+
**kwargs: Additional command-specific arguments.
|
|
55
|
+
|
|
56
|
+
Returns:
|
|
57
|
+
Argument namespace for one command step.
|
|
58
|
+
"""
|
|
59
|
+
values = {"verbose": args.verbose, **kwargs}
|
|
60
|
+
if name is not None:
|
|
61
|
+
values["name"] = name
|
|
62
|
+
|
|
63
|
+
return argparse.Namespace(**values)
|
|
64
|
+
|
|
65
|
+
lint_paths = ["src", "tests", "ci_commands"]
|
|
66
|
+
|
|
48
67
|
steps = [
|
|
49
|
-
("Init", init.command,
|
|
50
|
-
("Ruff", ruff.command,
|
|
51
|
-
|
|
52
|
-
("
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
("
|
|
57
|
-
alias="systemtests",
|
|
58
|
-
verbose=args.verbose)),
|
|
59
|
-
("Coverage", coverage.command, argparse.Namespace(verbose=args.verbose)),
|
|
60
|
-
("Sphinx", sphinx.command, argparse.Namespace(docs_dir=Path("docs"),
|
|
61
|
-
verbose=args.verbose)),
|
|
68
|
+
("Init", init.command, ns(args)),
|
|
69
|
+
("Ruff", ruff.command, ns(args, paths=lint_paths)),
|
|
70
|
+
("Pylint", pylint.command, ns(args, paths=lint_paths, rcfile=".pylintrc")),
|
|
71
|
+
("Unit tests", test.command, ns(args, "unittests", test_path=Path("tests/unittests"))),
|
|
72
|
+
("System tests", test.command, ns(args, "systemtests",
|
|
73
|
+
test_path=Path("tests/systemtests"))),
|
|
74
|
+
("Coverage", coverage.command, ns(args)),
|
|
75
|
+
("Sphinx", sphinx.command, ns(args, docs_dir=Path("docs"))),
|
|
62
76
|
]
|
|
63
77
|
|
|
64
78
|
for title, func, step_args in steps:
|
|
@@ -12,24 +12,24 @@ Date:
|
|
|
12
12
|
|
|
13
13
|
import argparse
|
|
14
14
|
|
|
15
|
-
from cikit import
|
|
16
|
-
from cikit.macros import coverage, chart_timeline
|
|
17
|
-
from cikit.errors import CiRecoverableError
|
|
15
|
+
from cikit import CiOptionalSection, CiSection
|
|
18
16
|
from cikit.ci import run_ci_script
|
|
17
|
+
from cikit.errors import CiRecoverableError
|
|
18
|
+
from cikit.macros import chart_timeline, coverage
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
def run(env, status, _args: argparse.Namespace):
|
|
22
22
|
"""Run coverage command logic.
|
|
23
23
|
|
|
24
24
|
Args:
|
|
25
|
-
env: Resolved CI
|
|
25
|
+
env: Resolved CI run environment.
|
|
26
26
|
status: Shared CI run status object.
|
|
27
27
|
_args: Parsed command arguments.
|
|
28
28
|
"""
|
|
29
29
|
with CiSection("Generating coverage", status=status):
|
|
30
30
|
coverage.pycoverage(env)
|
|
31
31
|
coverage.badge(env)
|
|
32
|
-
if env.
|
|
32
|
+
if env.data.get("coverage", 0) < 70:
|
|
33
33
|
raise CiRecoverableError("Coverage is below level!")
|
|
34
34
|
|
|
35
35
|
with CiOptionalSection("Create timeline chart", status=status):
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"""Init command for CI scripts.
|
|
3
3
|
|
|
4
4
|
This module prepares the CI environment, generates static project badges,
|
|
5
|
-
and initializes
|
|
5
|
+
and initializes cikit data for the current pipeline.
|
|
6
6
|
|
|
7
7
|
Author:
|
|
8
8
|
Sven Schlender
|
|
@@ -14,7 +14,7 @@ import argparse
|
|
|
14
14
|
|
|
15
15
|
from cikit import CiSection
|
|
16
16
|
from cikit.env import pretty_print_env, prepare_dirs
|
|
17
|
-
from cikit.macros import ai_assisted_badge,
|
|
17
|
+
from cikit.macros import ai_assisted_badge, data_prepare, python_badge
|
|
18
18
|
from cikit.ci import run_ci_script
|
|
19
19
|
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ def run(env, status, _args: argparse.Namespace):
|
|
|
22
22
|
"""Run init command logic.
|
|
23
23
|
|
|
24
24
|
Args:
|
|
25
|
-
env: Resolved CI
|
|
25
|
+
env: Resolved CI run environment.
|
|
26
26
|
status: Shared CI run status object.
|
|
27
27
|
_args: Parsed command arguments.
|
|
28
28
|
"""
|
|
@@ -36,8 +36,8 @@ def run(env, status, _args: argparse.Namespace):
|
|
|
36
36
|
python_badge(env)
|
|
37
37
|
ai_assisted_badge(env, "Assisted")
|
|
38
38
|
|
|
39
|
-
with CiSection("Preparing
|
|
40
|
-
|
|
39
|
+
with CiSection("Preparing cikit data for this pipeline", status=status):
|
|
40
|
+
data_prepare(env)
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
def command(args: argparse.Namespace) -> int:
|
|
@@ -58,5 +58,5 @@ def register(subparsers: argparse._SubParsersAction):
|
|
|
58
58
|
Args:
|
|
59
59
|
subparsers: Argparse subparser registry.
|
|
60
60
|
"""
|
|
61
|
-
parser = subparsers.add_parser("init", help="Prepare CI environment and
|
|
61
|
+
parser = subparsers.add_parser("init", help="Prepare CI environment and cikit data.")
|
|
62
62
|
parser.set_defaults(func=command)
|
|
@@ -14,15 +14,15 @@ Date:
|
|
|
14
14
|
import argparse
|
|
15
15
|
|
|
16
16
|
from cikit import CiSection, CiOptionalSection
|
|
17
|
-
from cikit.macros import pylint, chart_timeline
|
|
18
17
|
from cikit.ci import run_ci_script
|
|
18
|
+
from cikit.macros import pylint, chart_timeline
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
def run(env, status, args: argparse.Namespace):
|
|
22
22
|
"""Run Pylint command logic.
|
|
23
23
|
|
|
24
24
|
Args:
|
|
25
|
-
env: Resolved CI
|
|
25
|
+
env: Resolved CI run environment.
|
|
26
26
|
status: Shared CI run status object.
|
|
27
27
|
args: Parsed command arguments.
|
|
28
28
|
"""
|
|
@@ -44,7 +44,7 @@ def run(env, status, args: argparse.Namespace):
|
|
|
44
44
|
pylint.write_rst(env)
|
|
45
45
|
|
|
46
46
|
with CiSection("Generating todo rst from pylint", status=status):
|
|
47
|
-
pylint.write_rst(env,
|
|
47
|
+
pylint.write_rst(env, "todo", report_title="Todo Report", filter_code="fixme")
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
def command(args: argparse.Namespace) -> int:
|
|
@@ -13,15 +13,15 @@ Date:
|
|
|
13
13
|
import argparse
|
|
14
14
|
|
|
15
15
|
from cikit import CiSection, CiOptionalSection
|
|
16
|
-
from cikit.macros import ruff, chart_timeline
|
|
17
16
|
from cikit.ci import run_ci_script
|
|
17
|
+
from cikit.macros import ruff, chart_timeline
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
def run(env, status, args: argparse.Namespace):
|
|
21
21
|
"""Run Ruff command logic.
|
|
22
22
|
|
|
23
23
|
Args:
|
|
24
|
-
env: Resolved CI
|
|
24
|
+
env: Resolved CI run environment.
|
|
25
25
|
status: Shared CI run status object.
|
|
26
26
|
args: Parsed command arguments.
|
|
27
27
|
"""
|
|
@@ -14,15 +14,15 @@ import argparse
|
|
|
14
14
|
from pathlib import Path
|
|
15
15
|
|
|
16
16
|
from cikit import CiSection
|
|
17
|
-
from cikit.macros import sphinx
|
|
18
17
|
from cikit.ci import run_ci_script
|
|
18
|
+
from cikit.macros import sphinx
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
def run(env, status, args: argparse.Namespace):
|
|
22
22
|
"""Run Sphinx command logic.
|
|
23
23
|
|
|
24
24
|
Args:
|
|
25
|
-
env: Resolved CI
|
|
25
|
+
env: Resolved CI run environment.
|
|
26
26
|
status: Shared CI run status object.
|
|
27
27
|
args: Parsed command arguments.
|
|
28
28
|
"""
|
|
@@ -13,20 +13,20 @@ Date:
|
|
|
13
13
|
import argparse
|
|
14
14
|
from pathlib import Path
|
|
15
15
|
|
|
16
|
-
from cikit import
|
|
17
|
-
from cikit.macros import pytest, chart_timeline, test_report
|
|
16
|
+
from cikit import CiOptionalSection, CiSection
|
|
18
17
|
from cikit.ci import run_ci_script
|
|
18
|
+
from cikit.macros import chart_timeline, pytest, test_report
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
def run(env, status, args: argparse.Namespace):
|
|
22
22
|
"""Run pytest command logic.
|
|
23
23
|
|
|
24
24
|
Args:
|
|
25
|
-
env: Resolved CI
|
|
25
|
+
env: Resolved CI run environment.
|
|
26
26
|
status: Shared CI run status object.
|
|
27
27
|
args: Parsed command arguments.
|
|
28
28
|
"""
|
|
29
|
-
test_alias =
|
|
29
|
+
test_alias = env.name
|
|
30
30
|
|
|
31
31
|
try:
|
|
32
32
|
with CiSection(f"Running test '{test_alias}'", status=status):
|
|
@@ -38,7 +38,7 @@ def run(env, status, args: argparse.Namespace):
|
|
|
38
38
|
timeline.create(env, f"test_{test_alias}")
|
|
39
39
|
|
|
40
40
|
finally:
|
|
41
|
-
if env.
|
|
41
|
+
if env.data:
|
|
42
42
|
with CiSection("Create badge and rst files", status=status):
|
|
43
43
|
test_report.badge(env)
|
|
44
44
|
test_report.write_rst(env)
|
|
@@ -53,9 +53,7 @@ def command(args: argparse.Namespace) -> int:
|
|
|
53
53
|
Returns:
|
|
54
54
|
Process exit code.
|
|
55
55
|
"""
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return run_ci_script(jobname, lambda env, status: run(env, status, args), args=args)
|
|
56
|
+
return run_ci_script("test", lambda env, status: run(env, status, args), args=args)
|
|
59
57
|
|
|
60
58
|
|
|
61
59
|
def register(subparsers: argparse._SubParsersAction):
|
|
@@ -65,9 +63,5 @@ def register(subparsers: argparse._SubParsersAction):
|
|
|
65
63
|
subparsers: Argparse subparser registry.
|
|
66
64
|
"""
|
|
67
65
|
parser = subparsers.add_parser("test", help="Run one pytest directory.")
|
|
68
|
-
|
|
69
66
|
parser.add_argument("test_path", type=Path, help="Pytest directory.")
|
|
70
|
-
|
|
71
|
-
parser.add_argument("--alias", help="Optional report alias.")
|
|
72
|
-
|
|
73
67
|
parser.set_defaults(func=command)
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Cikit Data
|
|
2
|
+
==========
|
|
3
|
+
|
|
4
|
+
cikit data provides persistent storage for run and quality information.
|
|
5
|
+
|
|
6
|
+
Purpose
|
|
7
|
+
-------
|
|
8
|
+
|
|
9
|
+
cikit data allows CI runs to store structured information such as:
|
|
10
|
+
|
|
11
|
+
* Test results
|
|
12
|
+
* Coverage values
|
|
13
|
+
* Lint statistics
|
|
14
|
+
* Build metrics
|
|
15
|
+
* Artifact metadata
|
|
16
|
+
|
|
17
|
+
Local Cache
|
|
18
|
+
-----------
|
|
19
|
+
|
|
20
|
+
During local execution, cikit data stores run data below ``CIKIT_DATA_DIR``.
|
|
21
|
+
By default this resolves to:
|
|
22
|
+
|
|
23
|
+
.. code-block:: text
|
|
24
|
+
|
|
25
|
+
public/cikit_data/
|
|
26
|
+
|
|
27
|
+
Remote Backend
|
|
28
|
+
--------------
|
|
29
|
+
|
|
30
|
+
Optionally, cikit data can synchronize run data with a remote backend by
|
|
31
|
+
using ``CIKIT_DATA_BASE_URL`` and ``CIKIT_DATA_API_TOKEN``.
|
|
32
|
+
|
|
33
|
+
Run Data
|
|
34
|
+
--------
|
|
35
|
+
|
|
36
|
+
Data is stored per logical run name. The command runner creates a run
|
|
37
|
+
environment and exposes helper methods such as:
|
|
38
|
+
|
|
39
|
+
* ``env.data``
|
|
40
|
+
* ``env.data_set()``
|
|
41
|
+
* ``env.data_update()``
|
|
42
|
+
* ``env.timeline()``
|
|
43
|
+
* ``env.add_artifact()``
|
|
44
|
+
|
|
45
|
+
Historical Data
|
|
46
|
+
---------------
|
|
47
|
+
|
|
48
|
+
Stored information can be used for:
|
|
49
|
+
|
|
50
|
+
* Timeline charts
|
|
51
|
+
* Build statistics
|
|
52
|
+
* Quality tracking
|
|
53
|
+
* Badges
|
|
54
|
+
* Generated reports
|
|
55
|
+
|
|
56
|
+
See also:
|
|
57
|
+
|
|
58
|
+
* :doc:`artifacts`
|