<commit_before>language: go
cache:
  directories:
    - ~/bitcoin/bitcoin-0.19.1/bin
    - $DOWNLOAD_CACHE
    - $GOCACHE
    - $GOPATH/pkg/mod
    - $GOPATH/src/github.com/btcsuite
    - $GOPATH/src/github.com/golang
    - $GOPATH/src/github.com/grpc-ecosystem
    - $GOPATH/src/gopkg.in/alecthomas
    - $GOPATH/src/google.golang.org

# Remove Travis' default flag --depth=50 from the git clone command to make sure
# we have the whole git history, including the commit we lint against.
git:
  depth: false

go:
  - "1.14.x"

env:
  global:
    - GOCACHE=$HOME/.go-build
    - DOWNLOAD_CACHE=$HOME/download_cache

sudo: required

jobs:
  include:
    - stage: Sanity Check
      name: Lint and compile
      before_script:
        # Install the RPC tools as a before step so Travis collapses the output
        # after it's done.
        - ./scripts/install_travis_proto.sh

      script:
        # Step 1: Make sure no diff is produced when compiling with the correct
        # version.
        - make rpc-check

        # Step 2: Make sure the unit tests compile, but don't run them. They run
        # in a GitHub Workflow.
        - make unit pkg=... case=_NONE_

        # Step 3: Lint go code. Limit to 1 worker to reduce memory usage.
        - make lint workers=1

    - stage: Integration Test
      name: Btcd Integration
      script:
        - make itest

    - name: Bitcoind Integration
      script:
        - bash ./scripts/install_bitcoind.sh
        - make itest backend=bitcoind

    - name: Neutrino Integration
      script:
        - make itest backend=neutrino

    - name: Btcd Integration ARM
      script:
        - GOARM=7 GOARCH=arm GOOS=linux CGO_ENABLED=0 make btcd build-itest
        - file lnd-itest
        - GOARM=7 GOARCH=arm GOOS=linux CGO_ENABLED=0 make itest-only
      arch: arm64

    - name: Btcd Integration Windows
      script:
        - make itest-windows
      os: windows
      before_install:
        - choco upgrade --no-progress -y make netcat curl findutils
        - export MAKE=mingw32-make
      after_script:
        - |-
          case $TRAVIS_OS_NAME in
            windows)
              echo "Uploading to termbin.com..."
              for f in ./lntest/itest/*.log; do cat $f | nc termbin.com 9999 | xargs -r0 printf "$f"' uploaded to %s'; done
              ;;
          esac

after_script:
  - |-
    case $TRAVIS_OS_NAME in
      windows)
        # Needs other commands, see after_script of the Windows build
        ;;

      *)
        LOG_FILES=./lntest/itest/*.log
        echo "Uploading to termbin.com..." && find $LOG_FILES | xargs -I{} sh -c "cat {} | nc termbin.com 9999 | xargs -r0 printf '{} uploaded to %s'"
        echo "Uploading to file.io..." && tar -zcvO $LOG_FILES | curl -s -F 'file=@-;filename=logs.tar.gz' https://file.io | xargs -r0 printf 'logs.tar.gz uploaded to %s\n'
        ;;
    esac<commit_msg>travis: only upload log files on test failure<commit_after>language: go
cache:
  directories:
    - ~/bitcoin/bitcoin-0.19.1/bin
    - $DOWNLOAD_CACHE
    - $GOCACHE
    - $GOPATH/pkg/mod
    - $GOPATH/src/github.com/btcsuite
    - $GOPATH/src/github.com/golang
    - $GOPATH/src/github.com/grpc-ecosystem
    - $GOPATH/src/gopkg.in/alecthomas
    - $GOPATH/src/google.golang.org

# Remove Travis' default flag --depth=50 from the git clone command to make sure
# we have the whole git history, including the commit we lint against.
git:
  depth: false

go:
  - "1.14.x"

env:
  global:
    - GOCACHE=$HOME/.go-build
    - DOWNLOAD_CACHE=$HOME/download_cache

sudo: required

jobs:
  include:
    - stage: Sanity Check
      name: Lint and compile
      before_script:
        # Install the RPC tools as a before step so Travis collapses the output
        # after it's done.
        - ./scripts/install_travis_proto.sh

      script:
        # Step 1: Make sure no diff is produced when compiling with the correct
        # version.
        - make rpc-check

        # Step 2: Make sure the unit tests compile, but don't run them. They run
        # in a GitHub Workflow.
        - make unit pkg=... case=_NONE_

        # Step 3: Lint go code. Limit to 1 worker to reduce memory usage.
        - make lint workers=1

    - stage: Integration Test
      name: Btcd Integration
      script:
        - make itest

    - name: Bitcoind Integration
      script:
        - bash ./scripts/install_bitcoind.sh
        - make itest backend=bitcoind

    - name: Neutrino Integration
      script:
        - make itest backend=neutrino

    - name: Btcd Integration ARM
      script:
        - GOARM=7 GOARCH=arm GOOS=linux CGO_ENABLED=0 make btcd build-itest
        - file lnd-itest
        - GOARM=7 GOARCH=arm GOOS=linux CGO_ENABLED=0 make itest-only
      arch: arm64

    - name: Btcd Integration Windows
      script:
        - make itest-windows
      os: windows
      before_install:
        - choco upgrade --no-progress -y make netcat curl findutils
        - export MAKE=mingw32-make
      after_failure:
        - |-
          case $TRAVIS_OS_NAME in
            windows)
              echo "Uploading to termbin.com..."
              for f in ./lntest/itest/*.log; do cat $f | nc termbin.com 9999 | xargs -r0 printf "$f"' uploaded to %s'; done
              ;;
          esac

after_failure:
  - |-
    case $TRAVIS_OS_NAME in
      windows)
        # Needs other commands, see after_script of the Windows build
        ;;

      *)
        LOG_FILES=./lntest/itest/*.log
        echo "Uploading to termbin.com..." && find $LOG_FILES | xargs -I{} sh -c "cat {} | nc termbin.com 9999 | xargs -r0 printf '{} uploaded to %s'"
        echo "Uploading to file.io..." && tar -zcvO $LOG_FILES | curl -s -F 'file=@-;filename=logs.tar.gz' https://file.io | xargs -r0 printf 'logs.tar.gz uploaded to %s\n'
        ;;
    esac
{'fraction_non_alphanumeric': 0.1002751977984176, 'fraction_numerical': 0.011351909184726523, 'mean_word_length': 1.9729038854805725, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, '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': '591186', 'n_tokens_mistral': 1994, 'n_tokens_neox': 1894, 'n_words': 568}