<commit_before>language: go

go:
  - 1.3
  - 1.4
  - tip

before_install:
  # linting tools
  - go get github.com/golang/lint/golint
  - go get golang.org/x/tools/cmd/vet
  - go get github.com/fzipp/gocyclo

  # get our dependencies
  - go get -t ./...

install:
  # make sure stuff actually builds
  - go build

script:
  # ensure everything is formatted all pretty like
  - gofmt -l -s .
  # vet out possible issues
  - go vet ./...
  # run tests
  - go test ./...

after_script:
  # check possible styling errors
  - golint ./...
  # check for potentially complex functions but don't false build
  - gocyclo -over 15 . || true
  # refresh godocs in case there were api changes
  - |
    if [[ "$TRAVIS_PULL_REQUEST" == "false" ]] && [[ "$TRAVIS_BRANCH" == "master" ]]; then
      go list ./... | xargs -n 1 -I{} curl http://godoc.org/-/refresh -d path={}
    fi

before_deploy:
  - PLATFORMS=(darwin/386 darwin/amd64 freebsd/386 freebsd/amd64 freebsd/arm linux/386 linux/amd64 linux/arm windows/386 windows/amd64)
  - BINARY=snag
 # compile all go os/archs
  - |
    current_dir=$(pwd)
    cd $(go env GOROOT)/src
    for PLATFORM in "${PLATFORMS[@]}"; do
      if ! GOOS=${PLATFORM%/*} GOARCH=${PLATFORM#*/} ./make.bash --no-clean 2>&1; then
        echo "Failed installed go stdlib for $PLATFORM" && exit 1
      fi
    done
    cd $current_dir
 # build binary for all archs
  - |
    for PLATFORM in "${PLATFORMS[@]}"; do
      echo "Building $PLATFORM"
      GOOS=${PLATFORM%/*}
      GOARCH=${PLATFORM#*/}
      if [ "$GOOS" = "windows" ]; then
        build_cmd="GOOS=$GOOS GOARCH=$GOARCH go build -o snag -ldflags '-w -s'"
      else
        build_cmd="CGO_ENABLED=0 GOOS=$GOOS GOARCH=$GOARCH go build -o snag -ldflags '-d -w -s'"
      fi
      if ! eval $build_cmd; then
        echo "Failed building snag for $PLATFORM" && return 1
      fi
      if ! zip -9 snag-${GOOS}-${GOARCH}.zip snag; then
        echo "Failed to zip snag for $PLATFORM" && return 1
      fi
      echo "snag-${GOOS}-${GOARCH}.zip"
    done

deploy:
  provider: releases
  api_key: $GITHUB_AUTH_TOKEN
  file:
    - "snag-darwin-386.zip"
    - "snag-darwin-amd64.zip"

    - "snag-freebsd-386.zip"
    - "snag-freebsd-arm.zip"
    - "snag-freebsd-amd64.zip"

    - "snag-linux-386.zip"
    - "snag-linux-arm.zip"
    - "snag-linux-amd64.zip"

    - "snag-windows-386.zip"
    - "snag-windows-amd64.zip"

  skip_cleanup: true
  on:
    tags: true<commit_msg>Reinstate coverage reporting<commit_after>language: go

go:
  - 1.3
  - 1.4
  - tip

before_install:
  - go get github.com/golang/lint/golint
  - go get golang.org/x/tools/cmd/vet
  - go get github.com/fzipp/gocyclo
  - go get github.com/mattn/goveralls

  # get our dependencies
  - go get -t ./...

install:
  # make sure stuff actually builds
  - go build

script:
  # ensure everything is formatted all pretty like
  - gofmt -l -s .
  # vet out possible issues
  - go vet ./...
  # run tests
  - go test ./...

after_script:
  # check possible styling errors
  - golint ./...
  # check for potentially complex functions but don't false build
  - gocyclo -over 15 . || true
  # refresh godocs in case there were api changes
  - |
    if [[ "$TRAVIS_PULL_REQUEST" == "false" ]] && [[ "$TRAVIS_BRANCH" == "master" ]]; then
      go list ./... | xargs -n 1 -I{} curl http://godoc.org/-/refresh -d path={}
    fi
  - |
    echo "mode: count" > profile.cov
    for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d);
    do
    if ls $dir/*.go &> /dev/null; then
      go test -short -covermode=count -coverprofile=$dir/profile.tmp $dir
      if [ -f $dir/profile.tmp ]
      then
        cat $dir/profile.tmp | tail -n +2 >> profile.cov
        rm $dir/profile.tmp
      fi
    fi
    done
    go tool cover -func profile.cov
    goveralls -coverprofile=profile.cov -service=travis-ci -repotoken=$COVERALLS -v

before_deploy:
  - PLATFORMS=(darwin/386 darwin/amd64 freebsd/386 freebsd/amd64 freebsd/arm linux/386 linux/amd64 linux/arm windows/386 windows/amd64)
  - BINARY=snag
 # compile all go os/archs
  - |
    current_dir=$(pwd)
    cd $(go env GOROOT)/src
    for PLATFORM in "${PLATFORMS[@]}"; do
      if ! GOOS=${PLATFORM%/*} GOARCH=${PLATFORM#*/} ./make.bash --no-clean 2>&1; then
        echo "Failed installed go stdlib for $PLATFORM" && exit 1
      fi
    done
    cd $current_dir
 # build binary for all archs
  - |
    for PLATFORM in "${PLATFORMS[@]}"; do
      echo "Building $PLATFORM"
      GOOS=${PLATFORM%/*}
      GOARCH=${PLATFORM#*/}
      if [ "$GOOS" = "windows" ]; then
        build_cmd="GOOS=$GOOS GOARCH=$GOARCH go build -o snag -ldflags '-w -s'"
      else
        build_cmd="CGO_ENABLED=0 GOOS=$GOOS GOARCH=$GOARCH go build -o snag -ldflags '-d -w -s'"
      fi
      if ! eval $build_cmd; then
        echo "Failed building snag for $PLATFORM" && return 1
      fi
      if ! zip -9 snag-${GOOS}-${GOARCH}.zip snag; then
        echo "Failed to zip snag for $PLATFORM" && return 1
      fi
      echo "snag-${GOOS}-${GOARCH}.zip"
    done

deploy:
  provider: releases
  api_key: $GITHUB_AUTH_TOKEN
  file:
    - "snag-darwin-386.zip"
    - "snag-darwin-amd64.zip"

    - "snag-freebsd-386.zip"
    - "snag-freebsd-arm.zip"
    - "snag-freebsd-amd64.zip"

    - "snag-linux-386.zip"
    - "snag-linux-arm.zip"
    - "snag-linux-amd64.zip"

    - "snag-windows-386.zip"
    - "snag-windows-amd64.zip"

  skip_cleanup: true
  on:
    tags: true

{'fraction_non_alphanumeric': 0.14692378328741965, 'fraction_numerical': 0.020385674931129475, 'mean_word_length': 2.2886473429951693, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, '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': '2672038', 'n_tokens_mistral': 2148, 'n_tokens_neox': 2023, 'n_words': 530}