<commit_before>language: generic

env:
  global:
    - CACHE="$HOME/.local"
    - MPICH_VER="3.2"
    - MPICH_URL_HEAD="http://www.mpich.org/static/downloads/$MPICH_VER"
    - MPICH_URL_TAIL="mpich-${MPICH_VER}.tar.gz"
    - MPICH_DIR="$HOME/.local/usr/mpich"
    - MPICH_BOT_URL_HEAD="https://github.com/sourceryinstitute/OpenCoarrays/files/976766/"
    - MPICH_BOT_URL_TAIL="mpich-3.2_3.yosemite.bottle.1.tar.gz"
    - FC=gfortran-6
    - CC=gcc-6
    - CXX=g++-6

matrix:
  include:
    - os: osx
      env:
        - BUILD_TYPE="CodeCoverage"
          OSX_PACKAGES="gcc@6 cmake"
    - os: osx
      env:
       - BUILD_TYPE="Release"
         OSX_PACKAGES="gcc@6 cmake"
    - os: osx
      env:
       - BUILD_TYPE="InstallScript"
         OSX_PACKAGES="gcc@6"
    - &ubuntu
      os: linux
      sudo: false
      env:
        - BUILD_TYPE="CodeCoverage"
      cache:
        apt: false
        directories:
          - "$CACHE"
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
            - george-edison55-precise-backports
          packages:
            - gcc-6
            - gfortran-6
            - g++-6
            - binutils
            - cmake-data
            - cmake
    -
      <<: *ubuntu
      env:
        - BUILD_TYPE="Release"
    -
      <<: *ubuntu
      env:
        - BUILD_TYPE="InstallScript"
      cache: false
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - gcc-6
            - gfortran-6
            - g++-6

before_install:
  - |
    set -o errexit
    if [[ "$TRAVIS_TAG" ]] && [[ "X$TRAVIS_OS_NAME" = "Xosx" ]] && $TRAVIS_SECURE_ENV_VARS ; then
      brew update > /dev/null
      [[ "$(brew ls --versions gpg2)" ]] || brew install gpg2
      brew outdated gpg2 || brew upgrade gpg2
      which openssl || brew install openssl
    fi
    if ! [[ "$TRAVIS_TAG" ]] || ! $TRAVIS_SECURE_ENV_VARS ; then
      unset encrypted_ef4535c39461_key || true
      unset encrypted_ef4535c39461_iv || true
      rm subkey-328B3A0E-secret.asc{,.enc} || true

    fi
    if [[ "$TRAVIS_TAG" ]] ; then
      curl https://izaakbeekman.com/izaak.pubkey.txt | gpg --import
      git tag -v ${TRAVIS_TAG}
    fi
    set +o errexit
  -
  -
  -
  - |
    set -o errexit
    if [[ $TRAVIS ]] && [[ "X$TRAVIS_OS_NAME" = "Xosx" ]]; then
      export PATH="$PATH:$HOME/Library/Python/2.7/bin"
    else
      [[ -d "$CACHE/bin" ]] || mkdir -p "$CACHE/bin"
      [[ -d "$MPICH_DIR" ]] || mkdir -p "$MPICH_DIR"
      export PATH="$CACHE/bin:$PATH"
      $FC --version
      $CC --version
      $CXX --version
    fi
    set +o errexit

install:
  - |
    set -o errexit
    if [[ $TRAVIS ]] && [[ "X$TRAVIS_OS_NAME" = "Xosx" ]]; then
      brew update > /dev/null

      for pkg in $OSX_PACKAGES; do
        [[ "$(brew ls --versions $pkg)" ]] || brew install --force-bottle $pkg
        brew outdated $pkg || brew upgrade --force-bottle $pkg
      done
      if ! [[ "$(brew ls --versions mpich)" ]] && [[ "X$BUILD_TYPE" != "XInstallScript" ]]; then
        wget ${MPICH_BOT_URL_HEAD}${MPICH_BOT_URL_TAIL}
        brew install --force-bottle ${MPICH_BOT_URL_TAIL}
        if ! [[ "$(brew ls --versions mpich)" ]]; then
          brew install --force-bottle mpich
        fi
        rm -rf /usr/local/opt/gcc || true
        ln -s /usr/local/opt/gcc@6 /usr/local/opt/gcc # hack to get dynamic linker to find gcc 6 stuff
        mpif90 --version || mpif90 -show
        mpicc --version || mpicc -show
        cmake --version
      elif [[ "X$BUILD_TYPE" = "XInstallScript" ]]; then # uninstall some stuff if present
        [[ "$(brew ls --versions cmake)" ]] && brew rm cmake || true
        [[ "$(brew ls --versions mpich)" ]] && brew rm mpich || true
        [[ "$(brew ls --versions openmpi)" ]] && brew rm openmpi || true
      fi
    elif [[ "X$BUILD_TYPE" != "XInstallScript" ]]; then # Ubuntu on Travis-CI, NOT testing install.sh
      if ! ( [[ -x "$HOME/.local/bin/mpif90" ]] && [[ -x "$HOME/.local/bin/mpicc" ]] ); then
        # mpich install not cached
        # could use prerequisites/build instead...
        wget "${MPICH_URL_HEAD}/${MPICH_URL_TAIL}"
        mv "$MPICH_URL_TAIL" "$MPICH_DIR/.."
        pushd "$MPICH_DIR/.."
        tar -xzvf "$MPICH_URL_TAIL"
        cd "${MPICH_URL_TAIL%.tar.gz}"
        ./configure --prefix="$MPICH_DIR"
        make -j 4
        make install
        popd
        for f in "$MPICH_DIR/bin/"*; do
          if [[ -x "$f" ]]; then
            ln -fs "$f" "$HOME/.local/bin/${f##*/}"
          fi
        done
      fi
      mpif90 --version
      mpicc --version
      cmake --version
    fi
    set +o errexit

script:
  - |
    set -o errexit
    if [[ "X$BUILD_TYPE" = "XInstallScript" ]]; then
      [[ -d "$HOME/opt" ]] || mkdir "$HOME/opt"
      [[ -d "$HOME/bin" ]] || mkdir "$HOME/bin"
      ln -fs "$(which gfortran-6)" "$HOME/bin/gfortran"
      ln -fs "$(which gcc-6)" "$HOME/bin/gcc"
      ln -fs "$(which g++-6)" "$HOME/bin/g++"
      export PATH="$PATH:$HOME/bin"
      ./install.sh --yes-to-all -i "$HOME/opt/opencoarrays" -j 4 -f "$HOME/bin/gfortran" -c "$HOME/bin/gcc" -C "$HOME/bin/g++"
      cd prerequisites/builds/opencoarrays/*
      ../../../installations/cmake/*/bin/ctest --output-on-failure --schedule-random --repeat-until-fail 7
      cd -
    else
      mkdir cmake-build
      cd cmake-build
      cmake -DCMAKE_INSTALL_PREFIX:PATH="$HOME/OpenCoarrays" -DCMAKE_BUILD_TYPE="$BUILD_TYPE" ..
      make -j 4
      ctest --output-on-failure --schedule-random --repeat-until-fail 7
      make install
      cd ..
    fi
    set +o errexit

after_script:
  - |
    if [ "$TRAVIS_TAG" ]; then
      if [[ "v$TRAVIS_TAG" != "v$(sed -n 's/\([0-9]\{1,\}\(\.[0-9]\{1,\}\)\{1,\}\)/\1/p' .VERSION)" ]]; then
        echo "ERROR: You are trying to tag a new release but have a version missmatch in \`.VERSION\`"
        false # throw an error
      fi
    fi

after_success:
  - find . -name '*.gcno' -print
  - gcov-6 --version<commit_msg>Update Travis-CI to handle MPICH bottle correctly<commit_after>language: generic

env:
  global:
    - CACHE="$HOME/.local"
    - MPICH_VER="3.2"
    - MPICH_URL_HEAD="http://www.mpich.org/static/downloads/$MPICH_VER"
    - MPICH_URL_TAIL="mpich-${MPICH_VER}.tar.gz"
    - MPICH_DIR="$HOME/.local/usr/mpich"
    - MPICH_BOT_URL_HEAD="https://github.com/sourceryinstitute/OpenCoarrays/files/979804/"
    - MPICH_BOT_URL_TAIL="mpich-3.2_3.yosemite.bottle.1.tar.gz"
    - FC=gfortran-6
    - CC=gcc-6
    - CXX=g++-6

matrix:
  include:
    - os: osx
      env:
        - BUILD_TYPE="CodeCoverage"
          OSX_PACKAGES="gcc@6 cmake"
    - os: osx
      env:
       - BUILD_TYPE="Release"
         OSX_PACKAGES="gcc@6 cmake"
    - os: osx
      env:
       - BUILD_TYPE="InstallScript"
         OSX_PACKAGES="gcc@6"
    - &ubuntu
      os: linux
      sudo: false
      env:
        - BUILD_TYPE="CodeCoverage"
      cache:
        apt: false
        directories:
          - "$CACHE"
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
            - george-edison55-precise-backports
          packages:
            - gcc-6
            - gfortran-6
            - g++-6
            - binutils
            - cmake-data
            - cmake
    -
      <<: *ubuntu
      env:
        - BUILD_TYPE="Release"
    -
      <<: *ubuntu
      env:
        - BUILD_TYPE="InstallScript"
      cache: false
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - gcc-6
            - gfortran-6
            - g++-6

before_install:
  - |
    set -o errexit
    if [[ "$TRAVIS_TAG" ]] && [[ "X$TRAVIS_OS_NAME" = "Xosx" ]] && $TRAVIS_SECURE_ENV_VARS ; then
      brew update > /dev/null
      [[ "$(brew ls --versions gpg2)" ]] || brew install gpg2
      brew outdated gpg2 || brew upgrade gpg2
      which openssl || brew install openssl
    fi
    if ! [[ "$TRAVIS_TAG" ]] || ! $TRAVIS_SECURE_ENV_VARS ; then
      unset encrypted_ef4535c39461_key || true
      unset encrypted_ef4535c39461_iv || true
      rm subkey-328B3A0E-secret.asc{,.enc} || true

    fi
    if [[ "$TRAVIS_TAG" ]] ; then
      curl https://izaakbeekman.com/izaak.pubkey.txt | gpg --import
      git tag -v ${TRAVIS_TAG}
    fi
    set +o errexit
  -
  -
  -
  - |
    set -o errexit
    if [[ $TRAVIS ]] && [[ "X$TRAVIS_OS_NAME" = "Xosx" ]]; then
      export PATH="$PATH:$HOME/Library/Python/2.7/bin"
    else
      [[ -d "$CACHE/bin" ]] || mkdir -p "$CACHE/bin"
      [[ -d "$MPICH_DIR" ]] || mkdir -p "$MPICH_DIR"
      export PATH="$CACHE/bin:$PATH"
      $FC --version
      $CC --version
      $CXX --version
    fi
    set +o errexit

install:
  - |
    set -o errexit
    if [[ $TRAVIS ]] && [[ "X$TRAVIS_OS_NAME" = "Xosx" ]]; then
      brew update > /dev/null

      for pkg in $OSX_PACKAGES; do
        [[ "$(brew ls --versions $pkg)" ]] || brew install --force-bottle $pkg
        brew outdated $pkg || brew upgrade --force-bottle $pkg
      done
      if ! [[ "$(brew ls --versions mpich)" ]] && [[ "X$BUILD_TYPE" != "XInstallScript" ]]; then
        wget ${MPICH_BOT_URL_HEAD}${MPICH_BOT_URL_TAIL}
        brew install --force-bottle ${MPICH_BOT_URL_TAIL}
        if ! [[ "$(brew ls --versions mpich)" ]]; then
          brew install --force-bottle mpich
        fi
        mpif90 --version || mpif90 -show
        mpicc --version || mpicc -show
        cmake --version
      elif [[ "X$BUILD_TYPE" = "XInstallScript" ]]; then # uninstall some stuff if present
        [[ "$(brew ls --versions cmake)" ]] && brew rm cmake || true
        [[ "$(brew ls --versions mpich)" ]] && brew rm mpich || true
        [[ "$(brew ls --versions openmpi)" ]] && brew rm openmpi || true
      fi
    elif [[ "X$BUILD_TYPE" != "XInstallScript" ]]; then # Ubuntu on Travis-CI, NOT testing install.sh
      if ! ( [[ -x "$HOME/.local/bin/mpif90" ]] && [[ -x "$HOME/.local/bin/mpicc" ]] ); then
        # mpich install not cached
        # could use prerequisites/build instead...
        wget "${MPICH_URL_HEAD}/${MPICH_URL_TAIL}"
        mv "$MPICH_URL_TAIL" "$MPICH_DIR/.."
        pushd "$MPICH_DIR/.."
        tar -xzvf "$MPICH_URL_TAIL"
        cd "${MPICH_URL_TAIL%.tar.gz}"
        ./configure --prefix="$MPICH_DIR"
        make -j 4
        make install
        popd
        for f in "$MPICH_DIR/bin/"*; do
          if [[ -x "$f" ]]; then
            ln -fs "$f" "$HOME/.local/bin/${f##*/}"
          fi
        done
      fi
      mpif90 --version
      mpicc --version
      cmake --version
    fi
    set +o errexit

script:
  - |
    set -o errexit
    if [[ "X$BUILD_TYPE" = "XInstallScript" ]]; then
      [[ -d "$HOME/opt" ]] || mkdir "$HOME/opt"
      [[ -d "$HOME/bin" ]] || mkdir "$HOME/bin"
      ln -fs "$(which gfortran-6)" "$HOME/bin/gfortran"
      ln -fs "$(which ${CC})" "$HOME/bin/gcc"
      ln -fs "$(which ${CXX})" "$HOME/bin/g++"
      export PATH="$PATH:$HOME/bin"
      ./install.sh --yes-to-all -i "$HOME/opt/opencoarrays" -j 4 -f "$HOME/bin/gfortran" -c "$HOME/bin/gcc" -C "$HOME/bin/g++"
      cd prerequisites/builds/opencoarrays/*
      ../../../installations/cmake/*/bin/ctest --output-on-failure --schedule-random --repeat-until-fail 7
      cd -
    else
      mkdir cmake-build
      cd cmake-build
      cmake -DCMAKE_INSTALL_PREFIX:PATH="$HOME/OpenCoarrays" -DCMAKE_BUILD_TYPE="$BUILD_TYPE" ..
      make -j 4
      ctest --output-on-failure --schedule-random --repeat-until-fail 7
      make install
      cd ..
    fi
    set +o errexit

after_script:
  - |
    if [ "$TRAVIS_TAG" ]; then
      if [[ "v$TRAVIS_TAG" != "v$(sed -n 's/\([0-9]\{1,\}\(\.[0-9]\{1,\}\)\{1,\}\)/\1/p' .VERSION)" ]]; then
        echo "ERROR: You are trying to tag a new release but have a version missmatch in \`.VERSION\`"
        false # throw an error
      fi
    fi

after_success:
  - find . -name '*.gcno' -print
  - gcov-6 --version
{'fraction_non_alphanumeric': 0.16269907795473595, 'fraction_numerical': 0.013411567476948869, 'mean_word_length': 1.8461354961832062, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2580579', 'n_tokens_mistral': 4565, 'n_tokens_neox': 4309, 'n_words': 935}