summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml36
-rw-r--r--.gitlab-image-tags.yml1
-rw-r--r--.gitlint12
-rwxr-xr-xci/docker/lint/prepare.sh4
-rw-r--r--meson.build8
5 files changed, 61 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 7caa885074..22f153ab0d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -34,6 +34,7 @@ variables:
FEDORA_AMD64_SUFFIX: 'amd64/fedora'
INDENT_AMD64_SUFFIX: 'amd64/gst-indent'
+ COMMITLINT_AMD64_SUFFIX: 'amd64/commitlint'
WINDOWS_AMD64_SUFFIX: 'amd64/windows'
WINDOWS_IMAGE: "$CI_REGISTRY_IMAGE/$WINDOWS_AMD64_SUFFIX:$WINDOWS_TAG-$GST_UPSTREAM_BRANCH"
@@ -154,6 +155,22 @@ gst-indent amd64 docker:
# Do not depend on the trigger, as we want to run indent always
needs: []
+.commitlint image:
+ variables:
+ FDO_DISTRIBUTION_VERSION: '37'
+ FDO_REPO_SUFFIX: "$COMMITLINT_AMD64_SUFFIX"
+ FDO_DISTRIBUTION_TAG: "$LINT_TAG-$GST_UPSTREAM_BRANCH"
+ FDO_DISTRIBUTION_PACKAGES: 'python3-pip git'
+ FDO_DISTRIBUTION_EXEC: 'ci/docker/lint/prepare.sh'
+
+commitlint docker:
+ extends:
+ - '.commitlint image'
+ - '.fdo.container-build@fedora'
+ stage: 'preparation'
+ # Do not depend on the trigger, as we want to run indent always
+ needs: []
+
windows amd64 docker:
stage: "preparation"
needs:
@@ -205,6 +222,25 @@ gst indent:
- if: '$CI_PROJECT_NAMESPACE != "gstreamer" || $CI_COMMIT_BRANCH != $GST_UPSTREAM_BRANCH'
when: 'always'
+commitlint:
+ extends:
+ - '.commitlint image'
+ - '.fdo.suffixed-image@fedora'
+ stage: 'preparation'
+ variables:
+ GIT_STRATEGY: fetch
+ GIT_DEPTH: 100
+ needs:
+ - job: 'commitlint docker'
+ artifacts: false
+ script:
+ - echo $CI_MERGE_REQUEST_DIFF_BASE_SHA
+ - gitlint --commits $CI_MERGE_REQUEST_DIFF_BASE_SHA..HEAD
+ rules:
+ # Only run on MR as we need CI_MERGE_REQUEST_DIFF_BASE_SHA to know
+ # what commits to check
+ - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
+
#
# build setup templates
#
diff --git a/.gitlab-image-tags.yml b/.gitlab-image-tags.yml
index c627be701c..e8f6420e24 100644
--- a/.gitlab-image-tags.yml
+++ b/.gitlab-image-tags.yml
@@ -7,4 +7,5 @@ variables:
###
FEDORA_TAG: '2022-12-10.0'
INDENT_TAG: '2022-03-07.1'
+ LINT_TAG: '2023-02-16.5'
WINDOWS_TAG: '2023-01-26.0'
diff --git a/.gitlint b/.gitlint
new file mode 100644
index 0000000000..48fde1a413
--- /dev/null
+++ b/.gitlint
@@ -0,0 +1,12 @@
+[title-max-length]
+line-length=100
+
+[general]
+ignore=body-is-missing
+
+[body-max-line-length]
+line-length=120
+
+# Ensure every title starts with a prefix
+[title-match-regex]
+regex=^\w+:.*
diff --git a/ci/docker/lint/prepare.sh b/ci/docker/lint/prepare.sh
new file mode 100755
index 0000000000..439d81706d
--- /dev/null
+++ b/ci/docker/lint/prepare.sh
@@ -0,0 +1,4 @@
+set -eux
+
+python3 -m pip install gitlint
+
diff --git a/meson.build b/meson.build
index 79974538b9..abc46b6d3e 100644
--- a/meson.build
+++ b/meson.build
@@ -33,6 +33,14 @@ endif
# Install gst-indent pre-commit hook
run_command(python3, '-c', 'import shutil; shutil.copy("scripts/git-hooks/multi-pre-commit.hook", ".git/hooks/pre-commit")', check: false)
+
+gitlint = find_program('gitlint', required: false)
+if gitlint.found()
+ run_command(gitlint, 'install-hook', check: false)
+else
+ message('gitlint not found, please install it with your package manager or `python3 -m pip install gitlint` to enable the commit message hook')
+endif
+
# On macOS, you have to run "Install Certificates.command" otherwise Python
# doesn't have access to the latest SSL CA Certificates, and Meson will fail to
# download wrap files from websites that use, for example, Let's Encrypt.