<commit_before>language: rust
cache: cargo
sudo: false

matrix:
  include:
    # Stable
    - os: linux
      dist: trusty
      rust: stable
      addons:
        apt:
          packages:
            # Install libraries for coverage
            - binutils-dev
            - libcurl4-openssl-dev
            - libdw-dev
            - libelf-dev
            - libiberty-dev
            - liblzma-dev
    - os: osx
      rust: stable
    # Beta
    - os: linux
      dist: trusty
      rust: beta
    - os: osx
      rust: beta
    # Nightly
    - os: linux
      dist: trusty
      rust: nightly
    - os: osx
      rust: nightly
  allow_failures:
    - rust: nightly

before_script:
  - cargo --version --verbose
  - rustc --version --verbose
  # Fetch the big list of naughty strings
  - >
    wget -O ./tests/blns/blns.inden.tex
    https://raw.githubusercontent.com/minimaxir/big-list-of-naughty-strings/master/blns.txt
  # Configure only if we're doing coverage
  - >
    if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$TRAVIS_RUST_VERSION" == "stable" ]]; then
      LOCAL="~/.local" && export PATH=$LOCAL/bin:$PATH;
    fi

script:
  - cargo build
  - cargo test
  - cargo run -- -v ./tests/
  - cargo run -- -v ./tests/empty_folder/  # Check how indentex handles empty folders
  - python ./tests/compare_to_reference.py

after_success: >
  if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$TRAVIS_RUST_VERSION" == "stable" ]]; then
    wget https://github.com/SimonKagstrom/kcov/archive/v35.tar.gz &&
    tar xzf v35.tar.gz &&
    mkdir kcov-35/build &&
    cd kcov-35/build &&
    cmake -DCMAKE_INSTALL_PREFIX:PATH=$LOCAL .. &&
    make &&
    make install &&
    cd ../.. &&
    rm -rf kcov-35 &&
    cargo clean &&
    RUSTFLAGS='-C link-dead-code' cargo test --no-run &&
    for file in target/debug/indentex-*; do
      if [[ "${file: -2}" != ".d" ]]; then
        mkdir -p "target/cov/$(basename $file)";
        kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
      fi;
    done &&
    kcov --coveralls-id=$TRAVIS_JOB_ID --merge target/cov target/cov/*;
  fi<commit_msg>Use kcov-36<commit_after>language: rust
cache: cargo
sudo: false

matrix:
  include:
    # Stable
    - os: linux
      dist: trusty
      rust: stable
      addons:
        apt:
          packages:
            # Install libraries for coverage
            - binutils-dev
            - libcurl4-openssl-dev
            - libdw-dev
            - libelf-dev
            - libiberty-dev
            - liblzma-dev
    - os: osx
      rust: stable
    # Beta
    - os: linux
      dist: trusty
      rust: beta
    - os: osx
      rust: beta
    # Nightly
    - os: linux
      dist: trusty
      rust: nightly
    - os: osx
      rust: nightly
  allow_failures:
    - rust: nightly

before_script:
  - cargo --version --verbose
  - rustc --version --verbose
  # Fetch the big list of naughty strings
  - >
    wget -O ./tests/blns/blns.inden.tex
    https://raw.githubusercontent.com/minimaxir/big-list-of-naughty-strings/master/blns.txt
  # Configure only if we're doing coverage
  - >
    if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$TRAVIS_RUST_VERSION" == "stable" ]]; then
      LOCAL="~/.local" && export PATH=$LOCAL/bin:$PATH;
    fi

script:
  - cargo build
  - cargo test
  - cargo run -- -v ./tests/
  - cargo run -- -v ./tests/empty_folder/  # Check how indentex handles empty folders
  - python ./tests/compare_to_reference.py

after_success: >
  if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$TRAVIS_RUST_VERSION" == "stable" ]]; then
    wget https://github.com/SimonKagstrom/kcov/archive/v36.tar.gz &&
    tar xzf v36.tar.gz &&
    mkdir kcov-36/build &&
    cd kcov-36/build &&
    cmake -DCMAKE_INSTALL_PREFIX:PATH=$LOCAL .. &&
    make &&
    make install &&
    cd ../.. &&
    rm -rf kcov-36 &&
    cargo clean &&
    RUSTFLAGS='-C link-dead-code' cargo test --no-run &&
    for file in target/debug/indentex-*; do
      if [[ "${file: -2}" != ".d" ]]; then
        mkdir -p "target/cov/$(basename $file)";
        kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
      fi;
    done &&
    kcov --coveralls-id=$TRAVIS_JOB_ID --merge target/cov target/cov/*;
  fi
{'fraction_non_alphanumeric': 0.14707271010387157, 'fraction_numerical': 0.006137865911237016, 'mean_word_length': 1.9567341242149336, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '1484705', 'n_tokens_mistral': 1526, 'n_tokens_neox': 1476, 'n_words': 344}