dist: bionic
language: go
go_import_path: github.com/godbus/dbus

go:
  - 1.11.x
  - 1.12.x
  - 1.13.x
  - tip

matrix:
  fast_finish: true
  allow_failures:
    - go: tip

addons:
  apt:
    packages:
    - dbus
    - dbus-x11

before_install:
  - export GO111MODULE=on

script:
  - go test -v -race -mod=readonly ./...     # Run all the tests with the race detector enabled
  - go vet ./...                             # go vet is the official Go static analyzer

jobs:
  include:
    # The build matrix doesn't cover build stages, so manually expand
    # the jobs with anchors
    - &multiarch
      stage: "Multiarch Test"
      go: 1.11.x
      env: TARGETS="386 arm arm64 ppc64le"
      before_install:
        - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
      script:
        - |
          set -e
          for target in $TARGETS; do
            printf "\e[1mRunning test suite under ${target}.\e[0m\n"
            GOARCH="$target" go test -v ./...
            printf "\n\n"
          done
    - <<: *multiarch
      go: 1.12.x
    - <<: *multiarch
      go: 1.13.x