version: 2
jobs:
    prepare_dapp:
        docker:
            - image: node:8.7
        working_directory: ~/project/dapp
        steps:
            - checkout:
                path: ~/project
            - run: mkdir ~/project/dapp/junit
            - run: yarn

    lint_dapp:
        docker:
            - image: node:8.7
        working_directory: ~/project/dapp
        steps:
            - checkout:
                path: ~/project
            - run: yarn run solium --dir contracts/

    test_dapp:
        docker:
            - image: node:8.7
        working_directory: ~/project/dapp
        steps:
            - checkout:
                path: ~/project
            - run: mkdir ~/project/dapp/junit
            - run:
                command: sh test.sh
                environment:
                    MOCHA_FILE: junit/test-results.xml
            - store_test_results:
                path: ~/project/dapp/junit
            - store_artifacts:
                path: ~/project/dapp/junit
workflows:
    version: 2
    dapp:
        jobs:
            - prepare_dapp
            - test_dapp:
                requires:
                    - prepare_dapp
            - lint_dapp:
                requires:
                    - prepare_dapp

version: 2
jobs:
    dapp_lint:
        docker:
            - image: node:8.7
        working_directory: ~/project/dapp
        steps:
            - checkout:
                path: ~/project
            - run: yarn
            - run: yarn run solium --dir contracts/

    dapp_test:
        docker:
            - image: node:8.7
        working_directory: ~/project/dapp
        steps:
            - checkout:
                path: ~/project
            - run: mkdir ~/project/dapp/junit
            - restore_cache:
                keys:
                    - dapp1-modules-{{ checksum "yarn.lock" }}
                    - dapp1-modules
            - run: yarn
            - save_cache:
                keys:
                    - dapp1-modules-{{ checksum "yarn.lock" }}
                paths:
                    - node_modules/
            - run:
                command: sh test.sh
                environment:
                    MOCHA_FILE: junit/test-results.xml
            - store_test_results:
                path: ~/project/dapp/junit
            - store_artifacts:
                path: ~/project/dapp/junit
workflows:
    version: 2
    dapp:
        jobs:
            - dapp_test:
            - dapp_lint:

Use CircleCI caches for node_modules
Use CircleCI caches for node_modules
