<commit_before>variables:
  GIT_SSL_NO_VERIFY: "1"
  GIT_SUBMODULES_STRATEGY: "recursive"

stages:
  - lint
  - build

############################################################
# Linting
############################################################

ghc-linters:
  stage: lint
  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

############################################################
# Validation via Pipelines (hadrian)
############################################################

.validate-hadrian:
  stage: build
  allow_failure: true
  script:
    - bash .circleci/prepare-system.sh
    - if [[ -d ./cabal-cache ]]; then cp -R ./.cabal-cache ~/.cabal-cache; fi
    - ./boot
    - ./configure $CONFIGURE_ARGS
    - hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh`
  cache:
    key: hadrian
    paths:
      - cabal-cache

validate-x86_64-linux-deb8-hadrian:
  extends: .validate-hadrian
  image: ghcci/x86_64-linux-deb8:0.1
  before_script:
    # workaround for docker permissions
    - sudo chown ghc:ghc -R .
  tags:
    - x86_64-linux

############################################################
# Validation via Pipelines (make)
############################################################

.validate:
  stage: build
  variables:
    TEST_TYPE: test
  script:
    - make clean || true
    - ./boot
    - ./configure $CONFIGURE_ARGS
    - |
      THREADS=`mk/detect-cpu-count.sh`
      make V=0 -j$THREADS
    - |
      make binary-dist TAR_COMP_OPTS="-1"
      mv ghc-*.tar.xz ghc.tar.xz
    - |
      THREADS=`mk/detect-cpu-count.sh`
      make $TEST_TYPE THREADS=$THREADS JUNIT_FILE=../../junit.xml
  artifacts:
    reports:
      junit: junit.xml
    expire_in: 2 week
    paths:
      - ghc.tar.xz
      - junit.xml

validate-x86_64-darwin:
  extends: .validate
  allow_failure: true
  tags:
    - x86_64-darwin
  variables:
    GHC_VERSION: 8.6.3
    MACOSX_DEPLOYMENT_TARGET: "10.7"
    # Only Sierra and onwards supports clock_gettime. See #12858
    ac_cv_func_clock_gettime: "no"
  before_script:
    - bash .gitlab/darwin-init.sh
    - PATH="`pwd`/toolchain/bin:$PATH"
      # Disable sphinx PDF output as MacTeX apparently doesn't provide xelatex
    - echo "BUILD_SPHINX_PDF=NO" >> mk/build.mk
  after_script:
    - cp -Rf $HOME/.cabal cabal-cache
  artifacts:
    when: always
    expire_in: 2 week
  cache:
    key: darwin
    paths:
      - cabal-cache
      - toolchain

.validate-linux:
  extends: .validate
  tags:
    - x86_64-linux
  before_script:
    - bash .circleci/prepare-system.sh<commit_msg>darwin: Build with in-tree GMP<commit_after>variables:
  GIT_SSL_NO_VERIFY: "1"
  GIT_SUBMODULES_STRATEGY: "recursive"

stages:
  - lint
  - build

############################################################
# Linting
############################################################

ghc-linters:
  stage: lint
  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

############################################################
# Validation via Pipelines (hadrian)
############################################################

.validate-hadrian:
  stage: build
  allow_failure: true
  script:
    - bash .circleci/prepare-system.sh
    - if [[ -d ./cabal-cache ]]; then cp -R ./.cabal-cache ~/.cabal-cache; fi
    - ./boot
    - ./configure $CONFIGURE_ARGS
    - hadrian/build.cabal.sh -j`mk/detect-cpu-count.sh`
  cache:
    key: hadrian
    paths:
      - cabal-cache

validate-x86_64-linux-deb8-hadrian:
  extends: .validate-hadrian
  image: ghcci/x86_64-linux-deb8:0.1
  before_script:
    # workaround for docker permissions
    - sudo chown ghc:ghc -R .
  tags:
    - x86_64-linux

############################################################
# Validation via Pipelines (make)
############################################################

.validate:
  stage: build
  variables:
    TEST_TYPE: test
  script:
    - make clean || true
    - ./boot
    - ./configure $CONFIGURE_ARGS
    - |
      THREADS=`mk/detect-cpu-count.sh`
      make V=0 -j$THREADS
    - |
      make binary-dist TAR_COMP_OPTS="-1"
      mv ghc-*.tar.xz ghc.tar.xz
    - |
      THREADS=`mk/detect-cpu-count.sh`
      make $TEST_TYPE THREADS=$THREADS JUNIT_FILE=../../junit.xml
  artifacts:
    reports:
      junit: junit.xml
    expire_in: 2 week
    paths:
      - ghc.tar.xz
      - junit.xml

validate-x86_64-darwin:
  extends: .validate
  allow_failure: true
  tags:
    - x86_64-darwin
  variables:
    GHC_VERSION: 8.6.3
    MACOSX_DEPLOYMENT_TARGET: "10.7"
    # Only Sierra and onwards supports clock_gettime. See #12858
    ac_cv_func_clock_gettime: "no"
  before_script:
    - bash .gitlab/darwin-init.sh
    - PATH="`pwd`/toolchain/bin:$PATH"
      # Disable sphinx PDF output as MacTeX apparently doesn't provide xelatex
    - echo "BUILD_SPHINX_PDF=NO" >> mk/build.mk
    - echo "libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-intree-gmp" >> mk/build.mk
  after_script:
    - cp -Rf $HOME/.cabal cabal-cache
  artifacts:
    when: always
    expire_in: 2 week
  cache:
    key: darwin
    paths:
      - cabal-cache
      - toolchain

.validate-linux:
  extends: .validate
  tags:
    - x86_64-linux
  before_script:
    - bash .circleci/prepare-system.sh
{'fraction_non_alphanumeric': 0.225928360170884, 'fraction_numerical': 0.01511666118961551, 'mean_word_length': 2.914469453376206, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '600419', 'n_tokens_mistral': 2237, 'n_tokens_neox': 2124, 'n_words': 403}