# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
# Template for Circle CI taken from https://gist.github.com/asselstine/0584a60ea00b171a98a7ac213074c390
version: 2
jobs:
  build:
    docker:
      # The primary container is an instance of the first image listed. The job's commands run in this container.
      - image: circleci/node:8.11
      # The secondary container is an instance of the second listed image which is run in a common network where ports exposed on the primary container are available on localhost.
      - image: trufflesuite/ganache-cli
        command: ganache-cli

    working_directory: ~/repo

    steps:
      - checkout
      # - restore_cache:
      #     keys:
      #       - v1-dependencies-{{ checksum "package.json" }}
      #       - v1-dependencies-
      - run: npm install
      - save_cache:
          paths:
            - node_modules
          key: v1-dependencies-{{ checksum "package.json" }}
      - run: npx truffle compile --all
      - run: npx zos push --network development
      - run: npx zos publish --network development
      - run: npm test
