gitlab-ci: Pass --target explicitly to configure on Windows
[ghc.git] / .gitlab-ci.yml
index 5f741e1..0364cec 100644 (file)
@@ -2,7 +2,7 @@ variables:
   GIT_SSL_NO_VERIFY: "1"
 
   # Commit of ghc/ci-images repository from which to pull Docker images
-  DOCKER_REV: 6d19c3adc1f5c28c82aed8c5b1ac40931ac60f3f
+  DOCKER_REV: cefaee3c742af193e0f7783f87edb0d35374515c
 
 before_script:
   - python3 .gitlab/fix-submodules.py
@@ -12,12 +12,19 @@ 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]
-  - packaging
-  - hackage
+  - lint       # Source linting
+  - build      # A quick smoke-test to weed out broken commits
+  - full-build # Build all the things
+  - cleanup    # See Note [Cleanup on Windows]
+  - 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:
@@ -286,7 +329,7 @@ nightly-i386-linux-deb9:
 
 .build-x86_64-linux-deb9:
   extends: .validate-linux
-  stage: build
+  stage: full-build
   image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
   variables:
     TEST_ENV: "x86_64-linux-deb9"
@@ -313,6 +356,7 @@ nightly-x86_64-linux-deb9:
 # N.B. Has DEBUG assertions enabled in stage2
 validate-x86_64-linux-deb9-debug:
   extends: .build-x86_64-linux-deb9
+  stage: build
   variables:
     BUILD_FLAVOUR: validate
     TEST_ENV: "x86_64-linux-deb9-debug"
@@ -395,6 +439,7 @@ validate-x86_64-linux-fedora27:
 ############################################################
 
 .build-windows:
+  <<: *only-default
   before_script:
     - git clean -xdf
     - git submodule foreach git clean -xdf
@@ -470,13 +515,14 @@ nightly-i386-windows-hadrian:
   # due to #16084
   allow_failure: true
   variables:
+    BUILD_FLAVOUR: "quick"
     GHC_VERSION: "8.6.2"
     BIN_DIST_PREP_TAR_COMP: "bindistprep/ghc-x86_64-mingw32.tar.xz"
   script:
     - |
       python boot
-      bash -c './configure --enable-tarballs-autodownload GHC=`pwd`/toolchain/bin/ghc HAPPY=`pwd`/toolchain/bin/happy ALEX=`pwd`/toolchain/bin/alex'
-    - bash -c "echo include mk/flavours/quick.mk > mk/build.mk"
+      bash -c './configure --enable-tarballs-autodownload GHC=`pwd`/toolchain/bin/ghc HAPPY=`pwd`/toolchain/bin/happy ALEX=`pwd`/toolchain/bin/alex $CONFIGURE_ARGS'
+    - bash -c "echo include mk/flavours/${BUILD_FLAVOUR}.mk > mk/build.mk"
     - bash -c "PATH=`pwd`/toolchain/bin:$PATH make -j`mk/detect-cpu-count.sh`"
     - bash -c "PATH=`pwd`/toolchain/bin:$PATH make binary-dist TAR_COMP_OPTS=-1"
     - bash -c 'make V=0 test THREADS=`mk/detect-cpu-count.sh` JUNIT_FILE=../../junit.xml'
@@ -495,15 +541,28 @@ validate-x86_64-windows:
   extends: .build-windows-make
   variables:
     MSYSTEM: MINGW64
+    CONFIGURE_ARGS: "--target=x86_64-unknown-mingw32"
   cache:
     key: x86_64-windows
 
+# Normal Windows validate builds are profiled; that won't do for releases.
+release-x86_64-windows:
+  extends: validate-x86_64-windows
+  variables:
+    MSYSTEM: MINGW64
+    BUILD_FLAVOUR: "perf"
+    CONFIGURE_ARGS: "--target=x86_64-unknown-mingw32"
+  only:
+    - tags
+
 release-i386-windows:
   extends: .build-windows-make
   only:
     - tags
   variables:
     MSYSTEM: MINGW32
+    BUILD_FLAVOUR: "perf"
+    CONFIGURE_ARGS: "--target=i386-unknown-mingw32"
   cache:
     key: i386-windows
 
@@ -514,6 +573,7 @@ nightly-i386-windows:
       - $NIGHTLY
   variables:
     MSYSTEM: MINGW32
+    CONFIGURE_ARGS: "--target=i386-unknown-mingw32"
   cache:
     key: i386-windows
 
@@ -534,6 +594,7 @@ nightly-i386-windows:
 
 # See Note [Cleanup after shell executor]
 cleanup-windows:
+  <<: *only-default
   stage: cleanup
   tags:
     - x86_64-windows
@@ -556,6 +617,7 @@ cleanup-windows:
 
 # See Note [Cleanup after shell executor]
 cleanup-darwin:
+  <<: *only-default
   stage: cleanup
   tags:
     - x86_64-darwin
@@ -577,6 +639,7 @@ cleanup-darwin:
 ############################################################
 
 doc-tarball:
+  <<: *only-default
   stage: packaging
   tags:
     - x86_64-linux
@@ -628,6 +691,7 @@ source-tarball:
 # pipeline.
 
 .hackage:
+  <<: *only-default
   stage: hackage
   image: ghcci/x86_64-linux-deb9:0.2
   tags: