From 5586511446a9988af7b5e19b61c151b5d1111691 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Thu, 16 Feb 2023 00:30:15 -0300 Subject: ci: Add a job to verify commit messages on MRs This uses [gitlint] and is based on their linting rules with some minor config so it matches our style pretty well. [gitlint]: https://jorisroovers.com/gitlint/#configuration Part-of: --- .gitlab-ci.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to '.gitlab-ci.yml') 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 # -- cgit v1.2.1