From 6dcf4f29b1494571d31068e62920fe4601df8bd8 Mon Sep 17 00:00:00 2001 From: Buck Doyle Date: Wed, 21 Aug 2019 08:56:37 -0500 Subject: [PATCH] UI: Add CircleCI job (#6125) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds a job to test the UI on CircleCI, including the sort of branch pattern-matching from #5839, so .-ui/ branches only have that job and not the non-UI ones. I considered having an entire workflow for UI, which could have separate jobs for linting vs Ember tests, but the lint commands take so little time that it didn’t seem worth it. There’s no use of nvm to change the Node version as the Docker image is what controls that. It’s annoying to have to update the version in multiple places, but probably infrequent. --- .circleci/config.yml | 50 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 35e42c7dd..220532aae 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,38 +5,54 @@ references: GOMAXPROCS: 1 NOMAD_SLOW_TEST: 1 GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml + ignore_for_ui_branches: &IGNORE_FOR_UI_BRANCHES + filters: + branches: + ignore: /^.-ui\b.*/ + workflows: build-test: jobs: - - lint + - lint-go: + <<: *IGNORE_FOR_UI_BRANCHES - test-machine: name: "test-client" test_packages: "./client/..." + <<: *IGNORE_FOR_UI_BRANCHES - test-machine: name: "test-nomad" test_packages: "./nomad/..." + <<: *IGNORE_FOR_UI_BRANCHES - test-machine: # API Tests run in a VM rather than container due to the FS tests # requiring `mount` priviliges. name: "test-api" test_packages: "./api/..." + <<: *IGNORE_FOR_UI_BRANCHES - test-container: name: "test-devices" test_packages: "./devices/..." + <<: *IGNORE_FOR_UI_BRANCHES - test-machine: name: "test-other" exclude_packages: "./api|./client|./drivers/docker|./drivers/exec|./drivers/rkt|./drivers/shared/executor|./nomad|./devices" + <<: *IGNORE_FOR_UI_BRANCHES - test-machine: name: "test-docker" test_packages: "./drivers/docker" + <<: *IGNORE_FOR_UI_BRANCHES - test-machine: name: "test-exec" test_packages: "./drivers/exec" + <<: *IGNORE_FOR_UI_BRANCHES - test-machine: name: "test-shared-exec" test_packages: "./drivers/shared/executor" - - test-rkt + <<: *IGNORE_FOR_UI_BRANCHES + - test-rkt: + <<: *IGNORE_FOR_UI_BRANCHES + - test-ui # - build-deps-image: # context: dani-test # filters: @@ -71,7 +87,7 @@ jobs: - run: docker build -t hashicorpnomad/ci-build-image:$CIRCLE_SHA1 . -f ./Dockerfile.ci - run: docker push hashicorpnomad/ci-build-image:$CIRCLE_SHA1 - lint: + lint-go: executor: go environment: <<: *COMMON_ENVS @@ -154,6 +170,34 @@ jobs: path: /tmp/test-reports - store_artifacts: path: /tmp/test-reports + test-ui: + docker: + - image: circleci/node:10-browsers + environment: + # See https://git.io/vdao3 for details. + JOBS: 2 + steps: + - checkout + - restore_cache: + keys: + - v1-deps-{{ checksum "ui/yarn.lock" }} + - v1-deps- + - run: + name: yarn install + command: cd ui && yarn install + - save_cache: + key: v1-deps-{{ checksum "ui/yarn.lock" }} + paths: + - ./ui/node_modules + - run: + name: lint:js + command: cd ui && yarn run lint:js + - run: + name: lint:hbs + command: cd ui && yarn run lint:hbs + - run: + name: Ember tests + command: cd ui && yarn test build-website: # setting the working_directory along with the checkout path allows us to not have