Skip to content
Snippets Groups Projects
Commit e296f4e9 authored by Pierre-Alain Loizeau's avatar Pierre-Alain Loizeau
Browse files

Add linear history check to CI for merge requests. Refs #1852

parent 4b0967d0
No related branches found
No related tags found
1 merge request!115Add linear history check to CI for merge requests. Refs #1852
stages: stages:
- checkRebase - checkRepository
- checkFormat - checkFormat
- build - build
- documentation - documentation
RebaseCheck: RebaseCheck:
stage: checkRebase stage: checkRepository
tags: tags:
- CbmRoot - CbmRoot
only: only:
...@@ -15,7 +15,7 @@ RebaseCheck: ...@@ -15,7 +15,7 @@ RebaseCheck:
- $CI_MERGE_REQUEST_PROJECT_PATH == "computing/cbmroot" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" - $CI_MERGE_REQUEST_PROJECT_PATH == "computing/cbmroot" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
script: script:
# Get the upstream repository manually. I did not find any other way to have it for # Get the upstream repository manually. I did not find any other way to have it for
# comparisson # comparison
# Check if a rebase is needed # Check if a rebase is needed
# If a rebase is needed stop immediately # If a rebase is needed stop immediately
- scripts/connect_upstream_repo.sh $CI_MERGE_REQUEST_PROJECT_URL - scripts/connect_upstream_repo.sh $CI_MERGE_REQUEST_PROJECT_URL
...@@ -33,6 +33,33 @@ RebaseCheck: ...@@ -33,6 +33,33 @@ RebaseCheck:
- exit 1 - exit 1
- fi - fi
LinearHistCheck:
stage: checkRepository
tags:
- CbmRoot
only:
refs:
- merge_requests
variables:
- $CI_MERGE_REQUEST_PROJECT_PATH == "computing/cbmroot" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
script:
# Get the upstream repository manually. I did not find any other way to have it for
# comparison
# Check if the history introduced by the MR is linear (no branch loop in fork)
# If not linear stop immediately
- scripts/connect_upstream_repo.sh $CI_MERGE_REQUEST_PROJECT_URL
- git fetch upstream
- count=$(git rev-list --min-parents=2 --count upstream/master..HEAD)
- echo "${count}"
- if [ 0 = "${count}" ]; then
- echo "History introduced in fork is linear"
- exit 0
- else
- echo "History introduced in fork is not linear"
- echo "${count} merge commits must be removed or the other new commits have to be replayed in a new branch"
- exit 1
- fi
FormatCheck: FormatCheck:
stage: checkFormat stage: checkFormat
tags: tags:
...@@ -44,7 +71,7 @@ FormatCheck: ...@@ -44,7 +71,7 @@ FormatCheck:
- $CI_MERGE_REQUEST_PROJECT_PATH == "computing/cbmroot" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" - $CI_MERGE_REQUEST_PROJECT_PATH == "computing/cbmroot" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
script: script:
# Get the upstream repository manually. I did not find any other way to have it for # Get the upstream repository manually. I did not find any other way to have it for
# comparisson # comparison
- scripts/connect_upstream_repo.sh $CI_MERGE_REQUEST_PROJECT_URL - scripts/connect_upstream_repo.sh $CI_MERGE_REQUEST_PROJECT_URL
- git fetch upstream - git fetch upstream
- echo "export FAIRSOFT_VERSION=jun19p1" > env.sh - echo "export FAIRSOFT_VERSION=jun19p1" > env.sh
...@@ -58,7 +85,7 @@ FormatCheck: ...@@ -58,7 +85,7 @@ FormatCheck:
- echo "export FAIRROOT_FORMAT_BASE=upstream/\${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}" >> env.sh - echo "export FAIRROOT_FORMAT_BASE=upstream/\${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}" >> env.sh
- . ./env.sh && ctest -S cmake/scripts/checkformat.cmake -VV - . ./env.sh && ctest -S cmake/scripts/checkformat.cmake -VV
CbmRoot_Continuous: CbmRoot_Continuous:
stage: build stage: build
tags: tags:
...@@ -90,7 +117,7 @@ CbmRoot_Continuous: ...@@ -90,7 +117,7 @@ CbmRoot_Continuous:
# - parameters # - parameters
script: script:
- set -xv - set -xv
- mkdir -p build - mkdir -p build
- cd build - cd build
# - find . -name "*.root" -delete # - find . -name "*.root" -delete
# - find . -name "*_ok" -delete # - find . -name "*_ok" -delete
...@@ -139,7 +166,7 @@ CbmRoot_Merge: ...@@ -139,7 +166,7 @@ CbmRoot_Merge:
- echo "export FAIRSOFT_VERSION=jun19p1" >> Dart.cfg - echo "export FAIRSOFT_VERSION=jun19p1" >> Dart.cfg
- echo "export FAIRROOT_VERSION=v18.2.0" >> Dart.cfg - echo "export FAIRROOT_VERSION=v18.2.0" >> Dart.cfg
- echo "export SIMPATH=/cvmfs/fairroot.gsi.de/fairsoft/\${FAIRSOFT_VERSION}" >> Dart.cfg - echo "export SIMPATH=/cvmfs/fairroot.gsi.de/fairsoft/\${FAIRSOFT_VERSION}" >> Dart.cfg
- echo "export FAIRROOTPATH=/cvmfs/fairroot.gsi.de/fairroot/\${FAIRROOT_VERSION}_fairsoft-\${FAIRSOFT_VERSION}" >> Dart.cfg - echo "export FAIRROOTPATH=/cvmfs/fairroot.gsi.de/fairroot/\${FAIRROOT_VERSION}_fairsoft-\${FAIRSOFT_VERSION}" >> Dart.cfg
- echo "export BUILDDIR=$PWD/build" >> Dart.cfg - echo "export BUILDDIR=$PWD/build" >> Dart.cfg
- echo "export SOURCEDIR=$PWD" >> Dart.cfg - echo "export SOURCEDIR=$PWD" >> Dart.cfg
- echo "export NCPU=5" >> Dart.cfg - echo "export NCPU=5" >> Dart.cfg
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment