version: '1.0'

steps:

  agent_test:
    image: node:7.2.0
    working_directory: ${{main_clone}}/agent
    commands:
      - npm i -g yarn
      - yarn install
      - yarn test

  agent_build:
    type: build
    working_directory: ${{main_clone}}/agent
    tag: latest
    image_name: httpmark-test-agent

  agent_push:
    type: push
    candidate: ${{agent_build}}
    provider: ecr
    tag: latest
    accessKeyId: ${{AWS_ACCESS_KEY_ID}}
    secretAccessKey: ${{AWS_SECRET_ACCESS_KEY}}
    region: eu-west-1

  app_test:
    image: node:7.2.0
    working_directory: ${{main_clone}}/app
    commands:
      - npm i -g yarn
      - npm i -g elm@0.18.0
      - cd ui && yarn install
      - make test

version: '1.0'

steps:

  agent_test:
    image: node:7.2.0
    working_directory: ${{main_clone}}/agent
    commands:
      - npm i -g yarn
      - yarn install
      - yarn test

  agent_build:
    type: build
    working_directory: ${{main_clone}}/agent
    tag: latest
    image_name: httpmark-test-agent
    when:
      branch:
        only: [ master ]

  agent_push:
    type: push
    candidate: ${{agent_build}}
    provider: ecr
    tag: latest
    accessKeyId: ${{AWS_ACCESS_KEY_ID}}
    secretAccessKey: ${{AWS_SECRET_ACCESS_KEY}}
    region: eu-west-1
    when:
      branch:
        only: [ master ]

  app_test:
    image: node:7.2.0
    working_directory: ${{main_clone}}/app
    commands:
      - npm i -g yarn
      - npm i -g elm@0.18.0
      - cd ui && yarn install
      - make test

Add build and push steps as conditional
Add build and push steps as conditional
