From 9c3ee38683821d8d3a45e9d1a1567fc726a51459 Mon Sep 17 00:00:00 2001 From: Simon Pasquier Date: Thu, 4 Jun 2020 09:49:32 +0200 Subject: [PATCH] .circleci/config.yml: collect test metadata (#2211) * .circleci/config.yml: collect test metadata Signed-off-by: Simon Pasquier * Store frontend test results too Signed-off-by: Simon Pasquier --- .circleci/config.yml | 7 ++++++- ui/app/Makefile | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 303b8f5f..2994dc53 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -27,6 +27,8 @@ jobs: name: Generate front-end code command: make all working_directory: ~/project/ui/app + environment: + JUNIT_DIR: ~/test-results - run: name: Generate assets command: make assets @@ -34,6 +36,8 @@ jobs: name: Generate API v2 code command: make apiv2 - run: git diff --exit-code + - store_test_results: + path: ~/test-results test: docker: @@ -92,7 +96,8 @@ jobs: file: amtool - go/save-cache: key: v1-go-mod - + - store_test_results: + path: test-results workflows: version: 2 diff --git a/ui/app/Makefile b/ui/app/Makefile index 76de51bf..d26603f7 100644 --- a/ui/app/Makefile +++ b/ui/app/Makefile @@ -9,6 +9,8 @@ TEMPFILE := $(shell mktemp ./elm-XXXXXXXXXX) # --output flag for elm make must end in .js or .html. TEMPFILE_JS := "$(TEMPFILE).js" TEMPOPENAPI := $(shell mktemp -d ./openapi-XXXXXXXXXX) +# If JUNIT_DIR is set, the tests are executed with the JUnit reporter and the result is stored in the given directory. +JUNIT_DIR ?= ifeq ($(NO_DOCKER), true) DOCKER_CMD= @@ -29,7 +31,12 @@ format: elm-env $(ELM_FILES) test: src/Data elm-env @$(DOCKER_CMD) rm -rf elm-stuff/generated-code @$(DOCKER_CMD) elm-format $(ELM_FILES) --validate +ifneq ($(JUNIT_DIR),) + mkdir -p $(JUNIT_DIR) + @$(DOCKER_CMD) elm-test --report=junit | tee $(JUNIT_DIR)/junit.xml +else @$(DOCKER_CMD) elm-test +endif dev-server: elm reactor