diff options
author | Daniel P. Berrangé <berrange@redhat.com> | 2022-11-23 10:43:25 +0000 |
---|---|---|
committer | Daniel P. Berrangé <berrange@redhat.com> | 2023-01-17 10:09:40 +0000 |
commit | e96df99622dca395591685ab867284b2dc18c2b6 (patch) | |
tree | 930c760015a9c20633cbb9b7db4eedd10ffe73ae | |
parent | 348aef1917595cc9343a55d30440e0fced7d4b13 (diff) | |
download | libvirt-ci-e96df99622dca395591685ab867284b2dc18c2b6.zip libvirt-ci-e96df99622dca395591685ab867284b2dc18c2b6.tar.gz libvirt-ci-e96df99622dca395591685ab867284b2dc18c2b6.tar.bz2 |
manifest: integrate support for 'black' formatting job
This allows the manifest to request use of 'black' for python code
formatting checks.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-rw-r--r-- | examples/manifest.yml | 1 | ||||
-rw-r--r-- | lcitool/gitlab.py | 11 | ||||
-rw-r--r-- | lcitool/manifest.py | 3 | ||||
-rw-r--r-- | tests/data/manifest/in/manifest.yml | 1 | ||||
-rw-r--r-- | tests/data/manifest/out/ci/gitlab/sanity-checks.yml | 7 |
5 files changed, 23 insertions, 0 deletions
diff --git a/examples/manifest.yml b/examples/manifest.yml index 2acfbd3..e3144bd 100644 --- a/examples/manifest.yml +++ b/examples/manifest.yml @@ -46,6 +46,7 @@ gitlab: # cargo-fmt: false # go-fmt: false # clang-format: false +# black: false # # templates: # native-build: .native_build_job diff --git a/lcitool/gitlab.py b/lcitool/gitlab.py index a115da7..a9a3377 100644 --- a/lcitool/gitlab.py +++ b/lcitool/gitlab.py @@ -451,6 +451,17 @@ def clang_format_job(): """) +def black_job(): + return textwrap.dedent( + """ + black: + extends: .code_format + variables: + NAME: black + EXT: txt + """) + + def _container_job(target, arch, image, allow_failure, optional): allow_failure = str(allow_failure).lower() jobvars = { diff --git a/lcitool/manifest.py b/lcitool/manifest.py index 2ad5358..a41deeb 100644 --- a/lcitool/manifest.py +++ b/lcitool/manifest.py @@ -81,6 +81,7 @@ class Manifest: jobinfo.setdefault("cargo-fmt", False) jobinfo.setdefault("go-fmt", False) jobinfo.setdefault("clang-format", False) + jobinfo.setdefault("black", False) templateinfo = gitlabinfo["templates"] templateinfo.setdefault("native-build", ".native_build_job") @@ -320,6 +321,8 @@ class Manifest: fmtcontent.append(gitlab.go_fmt_job()) if jobinfo["clang-format"]: fmtcontent.append(gitlab.clang_format_job()) + if jobinfo["black"]: + fmtcontent.append(gitlab.black_job()) testcontent = [] if jobinfo["check-dco"]: diff --git a/tests/data/manifest/in/manifest.yml b/tests/data/manifest/in/manifest.yml index a247f69..e05ae9a 100644 --- a/tests/data/manifest/in/manifest.yml +++ b/tests/data/manifest/in/manifest.yml @@ -10,6 +10,7 @@ gitlab: cargo-fmt: true clang-format: true go-fmt: true + black: true targets: centos-stream-9: x86_64 diff --git a/tests/data/manifest/out/ci/gitlab/sanity-checks.yml b/tests/data/manifest/out/ci/gitlab/sanity-checks.yml index 759e98b..498957e 100644 --- a/tests/data/manifest/out/ci/gitlab/sanity-checks.yml +++ b/tests/data/manifest/out/ci/gitlab/sanity-checks.yml @@ -64,3 +64,10 @@ clang-format: variables: NAME: clang-format EXT: patch + + +black: + extends: .code_format + variables: + NAME: black + EXT: txt |