From patchwork Fri Jun 14 15:57:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 20324 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id CFBEBBD87C for ; Fri, 14 Jun 2024 15:57:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DDF1865461; Fri, 14 Jun 2024 17:57:24 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="E85ZyRnX"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BDFFD61A2A for ; Fri, 14 Jun 2024 17:57:22 +0200 (CEST) Received: from Monstersaurus.local (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id BA0172C5; Fri, 14 Jun 2024 17:57:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1718380627; bh=0U38dB+Od5hmDlb/LPXDMZi9zLQBdljoSKVjnasnbkY=; h=From:To:Cc:Subject:Date:From; b=E85ZyRnXmEmNfmEq2HhgDexUdQagrrDvQh5Vhpz5HDP7wp3ANrpv1/BsREKRE0vGa INXQxVWpNBU+oxe7BBYfzKs+kJPI+w9DODHNp4x52RGUh1IrsSNaVgH2J8Z/veuxnH M+PoseX7IxbK+1W/HkC4E9CCPyEzQ8nS+QTiSD0Y= From: Kieran Bingham To: libcamera devel Cc: Kieran Bingham Subject: [PATCH] lint: Add pre-merge checks using pre-push hook Date: Fri, 14 Jun 2024 16:57:18 +0100 Message-Id: <20240614155718.10902-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Wrap the existing libcamera pre-push hook into a lint task to make sure that the rules we apply to merging are conveyed as part of the CI jobs. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart Acked-by: Author , which even publicly records that the --- .gitlab-ci/lint-pre-push.sh | 27 +++++++++++++++++++++++++++ gitlab-ci.yml | 16 +++++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100755 .gitlab-ci/lint-pre-push.sh diff --git a/.gitlab-ci/lint-pre-push.sh b/.gitlab-ci/lint-pre-push.sh new file mode 100755 index 000000000000..8a4283cc0f15 --- /dev/null +++ b/.gitlab-ci/lint-pre-push.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# SPDX-License-Identifier: GPL-2.0-or-later +# SPDX-FileCopyrightText: © 2023 Laurent Pinchart +# +# Pre-merge checks + +set -e + +source "$(dirname "$0")/lib.sh" + +libcamera_premerge() { + echo "Running Pre-merge checks for $CI_COMMIT_REF_NAME ($base..$CI_COMMIT_SHA)" + + # Wrap parameters as git would send them to the pre-push hooks directly. + echo "$CI_COMMIT_REF_NAME $CI_COMMIT_SHA refs/heads/integration/pre-push-lint-test $base" \ + | ./utils/hooks/pre-push origin "$CI_DEFAULT_BRANCH" +} + +base=$(find_base origin/$CI_DEFAULT_BRANCH $CI_COMMIT_SHA) + +if [[ $base == $CI_COMMIT_SHA ]] ; then + echo "No commit to test, skipping" + exit 0 +fi + +run libcamera_premerge diff --git a/gitlab-ci.yml b/gitlab-ci.yml index 50b81e591458..d9b31ec8259e 100644 --- a/gitlab-ci.yml +++ b/gitlab-ci.yml @@ -311,7 +311,7 @@ build-package:cros: dotenv: env # ------------------------------------------------------------------------------ -# Lint stage - Run checkstyle.py +# Lint stage - Run checkstyle.py and check merge suitability # ------------------------------------------------------------------------------ lint: @@ -330,6 +330,20 @@ lint: script: - $CI_PROJECT_DIR/.gitlab-ci/lint-libcamera.sh +merge-check: + extends: + - .fdo.distribution-image@debian + - .history-jobs + - .libcamera-ci.debian:12 + - .libcamera-ci.scripts + stage: lint + needs: + - job: container-debian:12 + artifacts: false + script: + - $CI_PROJECT_DIR/.gitlab-ci/lint-pre-push.sh + + # ------------------------------------------------------------------------------ # Test stage - Run unit tests and hardware tests # ------------------------------------------------------------------------------