UI: Add CircleCI job (#6125)

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.
This commit is contained in:
Buck Doyle 2019-08-21 08:56:37 -05:00 committed by GitHub
parent 050cc32fde
commit 2900659a3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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