|
| 1 | +version: 2 |
| 2 | + |
| 3 | +jobs: |
| 4 | + checkout_and_compile: |
| 5 | + docker: |
| 6 | + - image: circleci/node:12.16.0 |
| 7 | + environment: |
| 8 | + NODE_OPTIONS: --max_old_space_size=8192 |
| 9 | + resource_class: large |
| 10 | + working_directory: ~/set-v2-strategies |
| 11 | + steps: |
| 12 | + - checkout |
| 13 | + - restore_cache: |
| 14 | + key: module-cache-{{ checksum "yarn.lock" }} |
| 15 | + - run: |
| 16 | + name: Set Up Environment Variables |
| 17 | + command: cp .env.default .env |
| 18 | + - run: |
| 19 | + name: Fetch Dependencies |
| 20 | + command: yarn install |
| 21 | + - save_cache: |
| 22 | + key: module-cache-{{ checksum "yarn.lock" }} |
| 23 | + paths: |
| 24 | + - node_modules |
| 25 | + - run: |
| 26 | + name: Transpile Contracts |
| 27 | + command: yarn build |
| 28 | + - save_cache: |
| 29 | + key: compiled-env-{{ .Environment.CIRCLE_SHA1 }} |
| 30 | + paths: |
| 31 | + - ~/set-v2-strategies |
| 32 | + test: |
| 33 | + docker: |
| 34 | + - image: circleci/node:12.16.0 |
| 35 | + working_directory: ~/set-v2-strategies |
| 36 | + parallelism: 3 |
| 37 | + steps: |
| 38 | + - restore_cache: |
| 39 | + key: compiled-env-{{ .Environment.CIRCLE_SHA1 }} |
| 40 | + - run: |
| 41 | + name: Set Up Environment Variables |
| 42 | + command: cp .env.default .env |
| 43 | + - run: |
| 44 | + name: Test RPC |
| 45 | + command: yarn chain |
| 46 | + background: true |
| 47 | + - run: |
| 48 | + name: Hardhat Test |
| 49 | + command: | |
| 50 | + TEST_FILES="$(circleci tests glob "./test/**/*.spec.ts" | circleci tests split)" |
| 51 | + yarn test ${TEST_FILES} |
| 52 | +
|
| 53 | + test_forked_network: |
| 54 | + docker: |
| 55 | + - image: circleci/node:12.16.0 |
| 56 | + working_directory: ~/set-v2-strategies |
| 57 | + steps: |
| 58 | + - restore_cache: |
| 59 | + key: compiled-env-{{ .Environment.CIRCLE_SHA1 }} |
| 60 | + - run: |
| 61 | + name: Set Up Environment Variables |
| 62 | + command: cp .env.default .env |
| 63 | + - run: |
| 64 | + name: Hardhat Test |
| 65 | + command: yarn test:fork |
| 66 | + |
| 67 | + coverage: |
| 68 | + docker: |
| 69 | + - image: circleci/node:12.16.0 |
| 70 | + working_directory: ~/set-v2-strategies |
| 71 | + # When changing the parallelism value, you also |
| 72 | + # need to update the `persist_to_workspace` paths |
| 73 | + # in this job (below) as well as the list of files passed |
| 74 | + # to istanbul-combine in the `report_coverage` job |
| 75 | + parallelism: 5 |
| 76 | + steps: |
| 77 | + - restore_cache: |
| 78 | + key: compiled-env-{{ .Environment.CIRCLE_SHA1 }} |
| 79 | + - run: |
| 80 | + name: Set Up Environment Variables |
| 81 | + command: cp .env.default .env |
| 82 | + - run: |
| 83 | + name: Create shared coverage outputs folder |
| 84 | + command: mkdir -p /tmp/coverage |
| 85 | + - run: |
| 86 | + name: Coverage |
| 87 | + command: | |
| 88 | + TEST_FILES="{$(circleci tests glob "./test/**/*.spec.ts" | \ |
| 89 | + circleci tests split | xargs | sed -e 's/ /,/g')}" |
| 90 | + yarn coverage -- --testfiles "$TEST_FILES" |
| 91 | + - run: |
| 92 | + name: Save coverage |
| 93 | + command: | |
| 94 | + cp coverage.json /tmp/coverage/cov_$CIRCLE_NODE_INDEX.json |
| 95 | + chmod -R 777 /tmp/coverage/cov_$CIRCLE_NODE_INDEX.json |
| 96 | + - persist_to_workspace: |
| 97 | + root: /tmp/coverage |
| 98 | + paths: |
| 99 | + - cov_0.json |
| 100 | + - cov_1.json |
| 101 | + - cov_2.json |
| 102 | + - cov_3.json |
| 103 | + - cov_4.json |
| 104 | + |
| 105 | + report_coverage: |
| 106 | + docker: |
| 107 | + - image: circleci/node:12.16.0 |
| 108 | + working_directory: ~/set-v2-strategies |
| 109 | + steps: |
| 110 | + - attach_workspace: |
| 111 | + at: /tmp/coverage |
| 112 | + - restore_cache: |
| 113 | + key: compiled-env-{{ .Environment.CIRCLE_SHA1 }} |
| 114 | + - run: |
| 115 | + name: Combine coverage reports |
| 116 | + command: | |
| 117 | + cp -R /tmp/coverage/* . |
| 118 | + npx istanbul-combine-updated -r lcov \ |
| 119 | + cov_0.json \ |
| 120 | + cov_1.json \ |
| 121 | + cov_2.json \ |
| 122 | + cov_3.json \ |
| 123 | + cov_4.json |
| 124 | + - run: |
| 125 | + name: Upload coverage |
| 126 | + command: | |
| 127 | + cat coverage/lcov.info | node_modules/.bin/coveralls |
| 128 | +
|
| 129 | +workflows: |
| 130 | + version: 2 |
| 131 | + build-and-test: |
| 132 | + jobs: |
| 133 | + - checkout_and_compile |
| 134 | + - test: |
| 135 | + requires: |
| 136 | + - checkout_and_compile |
| 137 | + - test_forked_network: |
| 138 | + requires: |
| 139 | + - checkout_and_compile |
| 140 | + - coverage: |
| 141 | + requires: |
| 142 | + - checkout_and_compile |
| 143 | + - report_coverage: |
| 144 | + requires: |
| 145 | + - coverage |
0 commit comments