github.com/marwan-at-work/consul@v1.4.5/.circleci/config.yml (about) 1 --- 2 version: 2 3 4 references: 5 images: 6 go: &GOLANG_IMAGE circleci/golang:1.11.4 7 middleman: &MIDDLEMAN_IMAGE hashicorp/middleman-hashicorp:0.3.35 8 ember: &EMBER_IMAGE circleci/node:8-browsers 9 10 paths: 11 test-results: &TEST_RESULTS_DIR /tmp/test-results 12 13 cache: 14 yarn: &YARN_CACHE_KEY consul-ui-v1-{{ checksum "ui-v2/yarn.lock" }} 15 rubygem: &RUBYGEM_CACHE_KEY static-site-gems-v1-{{ checksum "Gemfile.lock" }} 16 17 environment: &ENVIRONMENT 18 TEST_RESULTS_DIR: *TEST_RESULTS_DIR 19 GOTESTSUM_RELEASE: 0.3.3 20 EMAIL: noreply@hashicorp.com 21 GIT_AUTHOR_NAME: circleci-consul 22 GIT_COMMITTER_NAME: circleci-consul 23 24 jobs: 25 dev-build: 26 docker: 27 - image: *GOLANG_IMAGE 28 working_directory: /go/src/github.com/hashicorp/consul 29 steps: 30 - checkout 31 - run: make dev 32 33 # save dev build to CircleCI 34 - store_artifacts: 35 path: /go/bin/consul 36 37 # save dev build to pass to downstream jobs 38 - persist_to_workspace: 39 root: /go/bin 40 paths: 41 - consul 42 43 # Nomad 0.8 builds on go0.10 44 # Run integration tests on nomad/v0.8.7 45 nomad-integration-0_8: 46 docker: 47 - image: circleci/golang:1.10 48 environment: 49 <<: *ENVIRONMENT 50 NOMAD_WORKING_DIR: &NOMAD_WORKING_DIR /go/src/github.com/hashicorp/nomad 51 NOMAD_VERSION: v0.8.7 52 steps: &NOMAD_INTEGRATION_TEST_STEPS 53 - run: git clone https://github.com/hashicorp/nomad.git --branch ${NOMAD_VERSION} ${NOMAD_WORKING_DIR} 54 55 # get consul binary 56 - attach_workspace: 57 at: /go/bin 58 59 # make test result directory 60 - run: mkdir -p $TEST_RESULTS_DIR 61 62 # make dev build of nomad 63 - run: 64 command: make dev 65 working_directory: *NOMAD_WORKING_DIR 66 67 # update gotestsum 68 - run: curl -sSL "https://github.com/gotestyourself/gotestsum/releases/download/v${GOTESTSUM_RELEASE}/gotestsum_${GOTESTSUM_RELEASE}_linux_amd64.tar.gz" | tar --overwrite -xz -C /usr/local/bin gotestsum 69 70 # run integration tests 71 - run: 72 command: gotestsum --format=short-verbose --junitfile $TEST_RESULTS_DIR/results.xml -- ./command/agent/consul -run TestConsul 73 working_directory: *NOMAD_WORKING_DIR 74 75 # store test results for CircleCI 76 - store_test_results: 77 path: *TEST_RESULTS_DIR 78 - store_artifacts: 79 path: *TEST_RESULTS_DIR 80 81 # run integration tests on nomad/master 82 nomad-integration-master: 83 docker: 84 - image: *GOLANG_IMAGE 85 environment: 86 <<: *ENVIRONMENT 87 NOMAD_WORKING_DIR: /go/src/github.com/hashicorp/nomad 88 NOMAD_VERSION: master 89 steps: *NOMAD_INTEGRATION_TEST_STEPS 90 91 build-website: 92 # setting the working_directory along with the checkout path allows us to not have 93 # to cd into the website/ directory for commands 94 working_directory: ~/project/website 95 docker: 96 - image: *MIDDLEMAN_IMAGE 97 steps: 98 - checkout: 99 path: ~/project 100 101 # restores gem cache 102 - restore_cache: 103 key: *RUBYGEM_CACHE_KEY 104 105 - run: 106 name: install gems 107 command: bundle check || bundle install --path vendor/bundle --retry=3 108 109 # saves gem cache if we have changed the Gemfile 110 - save_cache: 111 key: *RUBYGEM_CACHE_KEY 112 paths: 113 - ~/project/website/vendor/bundle 114 115 - run: 116 name: middleman build 117 command: bundle exec middleman build 118 119 - run: 120 name: website deploy 121 command: ./scripts/deploy.sh 122 123 # build frontend yarn cache 124 frontend-cache: 125 docker: 126 - image: *EMBER_IMAGE 127 steps: 128 - checkout 129 130 # cache yarn deps 131 - restore_cache: 132 key: *YARN_CACHE_KEY 133 134 - run: 135 name: install yarn packages 136 command: cd ui-v2 && yarn install 137 138 - save_cache: 139 key: *YARN_CACHE_KEY 140 paths: 141 - ui-v2/node_modules 142 143 # build ember so frontend tests run faster 144 ember-build: 145 docker: 146 - image: *EMBER_IMAGE 147 steps: 148 - checkout 149 - restore_cache: 150 key: *YARN_CACHE_KEY 151 - run: cd ui-v2 && yarn build-ci --output-path=dist 152 153 # saves the build to a workspace to be passed to a downstream job 154 - persist_to_workspace: 155 root: ui-v2 156 paths: 157 - dist 158 159 # run ember frontend tests 160 ember-test: 161 docker: 162 - image: *EMBER_IMAGE 163 environment: 164 EMBER_TEST_PARALLEL: true #enables test parallelization with ember-exam 165 EMBER_TEST_REPORT: test-results/report.xml #outputs test report for CircleCI test summary 166 parallelism: 4 167 steps: 168 - checkout 169 - restore_cache: 170 key: *YARN_CACHE_KEY 171 - attach_workspace: 172 at: ui-v2 173 - run: 174 working_directory: ui-v2 175 command: node_modules/ember-cli/bin/ember exam --split=$CIRCLE_NODE_TOTAL --partition=`expr $CIRCLE_NODE_INDEX + 1` --path dist --silent -r xunit 176 - store_test_results: 177 path: ui-v2/test-results 178 179 workflows: 180 version: 2 181 test-integrations: 182 jobs: 183 - dev-build 184 - nomad-integration-master: 185 requires: 186 - dev-build 187 - nomad-integration-0_8: 188 requires: 189 - dev-build 190 website: 191 jobs: 192 - build-website: 193 context: static-sites 194 filters: 195 branches: 196 only: stable-website 197 frontend: 198 jobs: 199 - frontend-cache 200 - ember-build: 201 requires: 202 - frontend-cache 203 - ember-test: 204 requires: 205 - ember-build