diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5581a7c829..833fbdd28f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,34 +8,6 @@ default: name: registry.gitlab.com/kicad/kicad-ci/source_containers/master/fedora:36 entrypoint: ["/bin/sh", "-c"] - -########################################################################## -# Test the formatting in a merge request using clang-format -########################################################################## -# The variable CI_COMMIT_BEFORE_SHA is not available in normal merge requests -# so we must build the commit hash ourselves, see: -# https://gitlab.com/gitlab-org/gitlab/issues/12850 -test_formatting: - stage: test - needs: [] - only: - - merge_requests - allow_failure: true - before_script: - # We must manually add the KiCad remote to ensure it is named sensibly - - git remote add product https://gitlab.com/kicad/code/kicad.git - - git remote add source ${CI_MERGE_REQUEST_SOURCE_PROJECT_URL}.git - - git fetch -n product - - git fetch -n source - # Get the SHAs of the commits - - "TARGET_HEAD_SHA=$(git rev-parse product/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME})" - - "SOURCE_HEAD_SHA=$(git rev-parse source/${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME})" - - "MERGE_BASE_SHA=$(git merge-base ${TARGET_HEAD_SHA} ${SOURCE_HEAD_SHA})" - script: - - echo "Testing formatting from commit ${MERGE_BASE_SHA}" - - ./tools/check_coding.sh --diff --ci --commit ${MERGE_BASE_SHA} - - include: - local: '/.gitlab/templates.yml' - local: '/.gitlab/Fedora-Linux-CI.yml' @@ -44,3 +16,4 @@ include: - local: '/.gitlab/coverity.yml' - local: '/.gitlab/linux-metadata-validate.yml' - local: '/.gitlab/doxygen.yml' + - local: '/.gitlab/mr_formatting.yml' diff --git a/.gitlab/mr_formatting.yaml b/.gitlab/mr_formatting.yaml new file mode 100644 index 0000000000..666a623571 --- /dev/null +++ b/.gitlab/mr_formatting.yaml @@ -0,0 +1,25 @@ +########################################################################## +# Test the formatting in a merge request using clang-format +########################################################################## +# The variable CI_COMMIT_BEFORE_SHA is not available in normal merge requests +# so we must build the commit hash ourselves, see: +# https://gitlab.com/gitlab-org/gitlab/issues/12850 +test_formatting: + stage: test + needs: [] + only: + - merge_requests + allow_failure: true + before_script: + # We must manually add the KiCad remote to ensure it is named sensibly + - git remote add product https://gitlab.com/kicad/code/kicad.git + - git remote add source ${CI_MERGE_REQUEST_SOURCE_PROJECT_URL}.git + - git fetch -n product + - git fetch -n source + # Get the SHAs of the commits + - "TARGET_HEAD_SHA=$(git rev-parse product/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME})" + - "SOURCE_HEAD_SHA=$(git rev-parse source/${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME})" + - "MERGE_BASE_SHA=$(git merge-base ${TARGET_HEAD_SHA} ${SOURCE_HEAD_SHA})" + script: + - echo "Testing formatting from commit ${MERGE_BASE_SHA}" + - ./tools/check_coding.sh --diff --ci --commit ${MERGE_BASE_SHA}