pipelines:
  default:
    - step:
        name: fetch code
        image: alpine/git
        script:
          - git submodule update --init
        artifacts:
          - pswgcommon/**
          - client-holocore/**
    - step:
        name: test, build, and deploy
        image: openjdk:12
        caches:
          - docker
          - gradle
          - gradlewrapper
        script:
          - ./gradlew test
          - ./gradlew jlink
          - docker login -u $DOCKER_HUB_USER -p $DOCKER_HUB_PASSWORD
          - docker build -t $DOCKER_HUB_REPO/holocore:$BITBUCKET_BRANCH .
          - docker push $DOCKER_HUB_REPO/holocore:$BITBUCKET_BRANCH
        artifacts:
          - pswgcommon/**
          - client-holocore/**
          - .gradle/**
          - build/**
        services:
          - docker

definitions:
  caches:
    gradlewrapper: ~/.gradle/wrapper
