diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2019-02-18 17:28:39 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-03-21 23:38:58 -0400 |
commit | 322239de9555ff753db08d1508ee52a484c89093 (patch) | |
tree | 23235c9eee79bb7086517fd1df4e6e4728827e8e /.gitlab-ci.yml | |
parent | 7092b2de6fb8f23e03c0be7bd23bf394e087fc00 (diff) | |
download | haskell-322239de9555ff753db08d1508ee52a484c89093.tar.gz |
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.
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r-- | .gitlab-ci.yml | 68 |
1 files changed, 58 insertions, 10 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 074004734a..84f0816f3e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,7 @@ variables: GIT_SSL_NO_VERIFY: "1" # Commit of ghc/ci-images repository from which to pull Docker images - DOCKER_REV: 07bd4acf4f91b56e22389d7b7f6c13486a7b63de + DOCKER_REV: cefaee3c742af193e0f7783f87edb0d35374515c before_script: - python3 .gitlab/fix-submodules.py @@ -19,6 +19,13 @@ stages: - packaging # Source distribution, etc. - hackage # head.hackage testing +.only-default: &only-default + only: + - master + - /ghc-[0-9]+\.[0-9]+/ + - merge_requests + - tags + ############################################################ # Runner Tags ############################################################ @@ -39,24 +46,58 @@ ghc-linters: stage: lint image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV" 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 dependencies: [] tags: - lint + only: + refs: + - merge_requests + +# We allow the submodule checker to fail when run on merge requests (to +# accomodate, e.g., haddock changes not yet upstream) but not on `master` or +# Marge jobs. +.lint-submods: + stage: lint + image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV" + script: + - submodchecker .git $(git rev-list $base..$CI_COMMIT_SHA) + dependencies: [] + tags: + - lint + +lint-submods: + extends: .lint-submods + only: + refs: + - master + - /ghc-[0-9]+\.[0-9]+/ + - wip/marge_bot_batch_merge_job + +lint-submods-mr: + extends: .lint-submods + allow_failure: true + only: + refs: + - merge_requests ############################################################ # Validation via Pipelines (hadrian) ############################################################ .validate-hadrian: + <<: *only-default allow_failure: true script: - cabal update @@ -92,6 +133,7 @@ validate-x86_64-linux-deb8-hadrian: - x86_64-linux hadrian-ghc-in-ghci: + <<: *only-default stage: build image: ghcci/x86_64-linux-deb8:0.1 before_script: @@ -122,6 +164,7 @@ hadrian-ghc-in-ghci: ############################################################ .validate: + <<: *only-default variables: TEST_TYPE: test before_script: @@ -396,6 +439,7 @@ validate-x86_64-linux-fedora27: ############################################################ .build-windows: + <<: *only-default before_script: - git clean -xdf - git submodule foreach git clean -xdf @@ -535,6 +579,7 @@ nightly-i386-windows: # See Note [Cleanup after shell executor] cleanup-windows: + <<: *only-default stage: cleanup tags: - x86_64-windows @@ -557,6 +602,7 @@ cleanup-windows: # See Note [Cleanup after shell executor] cleanup-darwin: + <<: *only-default stage: cleanup tags: - x86_64-darwin @@ -578,6 +624,7 @@ cleanup-darwin: ############################################################ doc-tarball: + <<: *only-default stage: packaging tags: - x86_64-linux @@ -629,6 +676,7 @@ source-tarball: # pipeline. .hackage: + <<: *only-default stage: hackage image: ghcci/x86_64-linux-deb9:0.2 tags: |