[commit: ghc] wip/linters: Run linters on merge requests (24c0402)

git at git.haskell.org git at git.haskell.org
Tue Feb 19 14:13:30 UTC 2019


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/linters
Link       : http://ghc.haskell.org/trac/ghc/changeset/24c040202a3c948631625b73e3edcb5adac66004/ghc

>---------------------------------------------------------------

commit 24c040202a3c948631625b73e3edcb5adac66004
Author: Matthew Pickering <matthewtpickering at gmail.com>
Date:   Mon Feb 18 17:28:39 2019 +0000

    Run linters on merge requests
    
    It seems that it has failed to execute at all since it was implemented.
    
    We now run the linters on merge requests.


>---------------------------------------------------------------

24c040202a3c948631625b73e3edcb5adac66004
 .gitlab-ci.yml | 39 ++++++++++++++++++++++++++++-----------
 1 file changed, 28 insertions(+), 11 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b630d9f..de7e733 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -9,11 +9,17 @@ before_script:
   - "git fetch https://gitlab.haskell.org/ghc/ghc-performance-notes.git refs/notes/perf:refs/notes/perf || true"
 
 stages:
-  - lint
   - build
   - full-build
   - cleanup # See Note [Cleanup on Windows]
 
+.only-default: &only-default
+  only:
+    - master
+    - merge_requests
+    - tags
+    - branches
+
 ############################################################
 # Runner Tags
 ############################################################
@@ -31,27 +37,34 @@ stages:
 ############################################################
 
 ghc-linters:
-  stage: lint
+  stage: build
   image: ghcci/linters:0.1
   script:
-    - |
-      if [ -n "$CI_MERGE_REQUEST_ID" ]; then
-        base="$(git merge-base $CI_MERGE_REQUEST_BRANCH_NAME HEAD)"
-        validate-commit-msg .git $(git rev-list $base..$CI_COMMIT_SHA)
-        submodchecker .git $(git rev-list $base..$CI_COMMIT_SHA)
-        validate-whitespace .git $(git rev-list $base..$CI_COMMIT_SHA)
-        .gitlab/linters/check-makefiles.py $base $CI_COMMIT_SHA
-        .gitlab/linters/check-cpp.py $base $CI_COMMIT_SHA
-      fi
+    - git fetch origin
+    - git checkout "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
+    - git reset --hard "origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
+    - echo "$CI_MERGE_REQUEST_ID"
+    - echo "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
+    - echo "$CI_COMMIT_SHA"
+    - base="$(git merge-base $CI_MERGE_REQUEST_TARGET_BRANCH_NAME $CI_COMMIT_SHA)"
+    - echo $base
+    #    - validate-commit-msg .git $(git rev-list $base..$CI_COMMIT_SHA)
+    - validate-whitespace .git $(git rev-list $base..$CI_COMMIT_SHA)
+    - .gitlab/linters/check-makefiles.py $base $CI_COMMIT_SHA
+    - .gitlab/linters/check-cpp.py $base $CI_COMMIT_SHA
+    - submodchecker .git $(git rev-list $base..$CI_COMMIT_SHA)
   dependencies: []
   tags:
     - lint
+  only:
+   - merge_requests
 
 ############################################################
 # Validation via Pipelines (hadrian)
 ############################################################
 
 .validate-hadrian:
+  <<: *only-default
   allow_failure: true
   script:
     - git clean -xdf && git submodule foreach git clean -xdf
@@ -86,6 +99,7 @@ validate-x86_64-linux-deb8-hadrian:
 ############################################################
 
 .validate:
+  <<: *only-default
   variables:
     TEST_TYPE: test
   before_script:
@@ -336,6 +350,7 @@ validate-x86_64-linux-deb9-unreg:
 ############################################################
 
 .validate-windows:
+  <<: *only-default
   before_script:
     - git clean -xdf
     - git submodule foreach git clean -xdf
@@ -432,6 +447,7 @@ validate-x86_64-windows:
 
 # See Note [Cleanup after shell executor]
 cleanup-windows:
+  <<: *only-default
   stage: cleanup
   tags:
     - x86_64-windows
@@ -454,6 +470,7 @@ cleanup-windows:
 
 # See Note [Cleanup after shell executor]
 cleanup-darwin:
+  <<: *only-default
   stage: cleanup
   tags:
     - x86_64-darwin



More information about the ghc-commits mailing list