version: 2

defaults: &defaults
  working_directory: ~/go/src/github.com/docker/libnetwork
  docker:
    # the following image is irrelevant for the build, everything is built inside a container, check the Makefile
    - image: 'circleci/golang:latest'
      environment:
          dockerbuildargs: .
          dockerargs:  --privileged -e CIRCLECI

jobs:
  builder:
    <<: *defaults
    steps:
      - checkout
      - setup_remote_docker:
          version: 18.05.0-ce
          reusable: true
          exclusive: false
      - run: make builder

  build:
    <<: *defaults
    steps:
      - checkout
      - setup_remote_docker:
          version: 18.05.0-ce
          reusable: true
          exclusive: false
      - run: make build

  check:
    <<: *defaults
    steps:
      - checkout
      - setup_remote_docker:
          version: 18.05.0-ce
          reusable: true
          exclusive: false
      - run: make check

  cross:
    <<: *defaults
    steps:
      - checkout
      - setup_remote_docker:
          version: 18.05.0-ce
          reusable: true
          exclusive: false
      - run: make cross

  unit-tests:
    <<: *defaults
    steps:
      - checkout
      - setup_remote_docker:
          version: 18.05.0-ce
          reusable: true
          exclusive: false
      - run: make unit-tests

workflows:
  version: 2
  ci:
    jobs:
      - builder
      - build:
          requires:
            - builder
      - check:
          requires:
            - builder
      - cross:
          requires:
            - builder
      - unit-tests:
          requires:
            - builder

version: 2

defaults: &defaults
  working_directory: ~/go/src/github.com/docker/libnetwork
  docker:
    # the following image is irrelevant for the build, everything is built inside a container, check the Makefile
    - image: 'circleci/golang:latest'
      environment:
          dockerbuildargs: .
          dockerargs:  --privileged -e CIRCLECI

jobs:
  builder:
    <<: *defaults
    steps:
      - checkout
      - setup_remote_docker:
          version: stable
          reusable: true
          exclusive: false
      - run: make builder

  build:
    <<: *defaults
    steps:
      - checkout
      - setup_remote_docker:
          version: stable
          reusable: true
          exclusive: false
      - run: make build

  check:
    <<: *defaults
    steps:
      - checkout
      - setup_remote_docker:
          version: stable
          reusable: true
          exclusive: false
      - run: make check

  cross:
    <<: *defaults
    steps:
      - checkout
      - setup_remote_docker:
          version: stable
          reusable: true
          exclusive: false
      - run: make cross

  unit-tests:
    <<: *defaults
    steps:
      - checkout
      - setup_remote_docker:
          version: stable
          reusable: true
          exclusive: false
      - run: make unit-tests

workflows:
  version: 2
  ci:
    jobs:
      - builder
      - build:
          requires:
            - builder
      - check:
          requires:
            - builder
      - cross:
          requires:
            - builder
      - unit-tests:
          requires:
            - builder

Build with latest docker stable engine
Build with latest docker stable engine

Signed-off-by: Flavio Crisciani <59eae1aa696b1b39cd87a38bdba3f0b2630647f9@docker.com>
