sudo: required
# Ubuntu 18.04 "Bionic", https://docs.travis-ci.com/user/reference/bionic/
# Kernel 5.0.0-1026-gcp
dist: bionic

language: go
go_import_path: github.com/hanwen/go-fuse

go:
  - 1.10.x
  - 1.11.x
  - 1.12.x
  - 1.13.x
  - 1.14.x
  - 1.15.x
  - master

env:
  - GOMAXPROCS=1
  # vvv = native `nproc`
  - GOMAXPROCS=

matrix:
 fast_finish: true
 allow_failures:
   - go: master

before_install:
  - sudo apt-get install -qq pkg-config fuse
  - sudo modprobe fuse
  - sudo chmod 666 /dev/fuse
  - sudo chown root:$USER /etc/fuse.conf

install:
  - go get -t ./...
  - go get -t -race ./...

# Travis CI has a no-output-timeout of 10 minutes.
# Set "go test -timeout" lower so we get proper backtraces
# on a hung test.
# The tests sometimes hang in a way that "go test -timeout"
# does not work anymore. Use the external "timeout" command
# as backup, triggering 1 minute later.
script:
  - set -e # fail fast
  - timeout -s QUIT -k 10s 90s go test -failfast -timeout 1m -p 1 -v ./fs
  - timeout -s QUIT -k 10s 6m  go test -failfast -timeout 5m -p 1 -v ./...
  - set +e # restore
