diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a39ce85ce111a797a3c8479995fdd08be776a78f..5df3afc8c1b8b9ced48c5c89510d92adfbc728fa 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -232,6 +232,24 @@ typecheck-testsuite: - _build/stage0/bin/lint-submodule-refs . $(git rev-list $base..$CI_COMMIT_SHA) dependencies: [] +# We allow the submodule checker to fail when run on merge requests (to +# accommodate, e.g., haddock changes not yet upstream) but not on `master` or +# Marge jobs. +lint-author: + image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10:$DOCKER_REV" + extends: .lint-params + variables: + BUILD_FLAVOUR: default + script: + - git fetch "$CI_MERGE_REQUEST_PROJECT_URL" $CI_MERGE_REQUEST_TARGET_BRANCH_NAME + - base="$(git merge-base FETCH_HEAD $CI_COMMIT_SHA)" + - "echo Linting authors between $base..$CI_COMMIT_SHA" + - .gitlab/ci.sh lint_author $base $CI_COMMIT_SHA + dependencies: [] + rules: + - if: $CI_MERGE_REQUEST_ID + - *drafts-can-fail-lint + lint-submods: extends: .lint-submods # Allow failure on merge requests since any necessary submodule patches may diff --git a/.gitlab/ci.sh b/.gitlab/ci.sh index 917e9d5e4deaee731b66519fee3b3b0e879174c2..f04b3861e03b27f5c99c193927401f06d7cac8ff 100755 --- a/.gitlab/ci.sh +++ b/.gitlab/ci.sh @@ -675,6 +675,18 @@ function shell() { run "$cmd" } +function lint_author(){ + base=$1 + head=$2 + for email in $(git log --format='%ae' $base..$head); do + if [ $email == "ghc-ci@gitlab-haskell.org" ]; + then + fail "Commit has GHC CI author, please amend the author information." + fi + done +} + + setup_locale # Platform-specific environment initialization @@ -772,6 +784,7 @@ case $1 in run_hadrian) shift; run_hadrian "$@" ;; perf_test) run_perf_test ;; cabal_test) cabal_test ;; + lint_author) shift; lint_author "$@" ;; clean) clean ;; save_cache) save_cache ;; shell) shift; shell "$@" ;;