version: 2
jobs:
  test:
    docker:
      # specify the version you desire here
      - image: cmeter/clojure-phantomjs
    working_directory: ~/repo

    environment:
      LEIN_ROOT: "true"
      # Customize the JVM maximum heap limit
      JVM_OPTS: -Xmx3200m
    
    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "project.clj" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-
      - run: lein deps
      - save_cache:
          paths:
            - ~/.m2
          key: v1-dependencies-{{ checksum "project.clj" }}

      - run: lein phantomtest

  analysis:
    docker:
      - image: cmeter/clojure-phantomjs
    working_directory: ~/repo

    environment:
      LEIN_ROOT: "true"
      JVM_OPTS: -Xmx3200m
    
    steps:
      - checkout

      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "project.clj" }}
          - v1-dependencies-

      - run: lein do ancient, kibit
      - run:
          name: Analysis failed
          command: echo "Analysis failed"
          when: on_fail

workflows:
  version: 2
  test_analysis:
    jobs:
      - test
      - analysis

version: 2
jobs:
  test:
    docker:
      # specify the version you desire here
      - image: cmeter/clojure-phantomjs
    working_directory: ~/repo

    environment:
      LEIN_ROOT: "true"
      # Customize the JVM maximum heap limit
      JVM_OPTS: -Xmx3200m
    
    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "project.clj" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-
      - run: lein deps
      - save_cache:
          paths:
            - ~/.m2
          key: v1-dependencies-{{ checksum "project.clj" }}

      - run: lein phantomtest
      - run:
        shell: /bin/sh
        command: |
          lein phantomtest


  analysis:
    docker:
      - image: cmeter/clojure-phantomjs
    working_directory: ~/repo

    environment:
      LEIN_ROOT: "true"
      JVM_OPTS: -Xmx3200m
    
    steps:
      - checkout

      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "project.clj" }}
          - v1-dependencies-

      - run: lein do ancient, kibit

workflows:
  version: 2
  test_analysis:
    jobs:
      - test
      - analysis

Use sh to prevent false errors in tests
Use sh to prevent false errors in tests
