From 44e2834960c5a41cfe97b4273a261fbf70ce1249 Mon Sep 17 00:00:00 2001 From: Levi Harrison Date: Tue, 10 Aug 2021 10:50:09 -0400 Subject: [PATCH] Split Go and React Tests (#8897) * Added go-ci and react-ci Co-authored-by: Julien Pivotto Signed-off-by: Levi Harrison --- .circleci/config.yml | 36 +++++++++++++++++++++++++----------- Makefile | 7 +++++++ 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5ec210d76..47539d729 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,21 +17,17 @@ executors: - image: circleci/golang:1.15-node jobs: - test: + test_go: executor: golang steps: - prometheus/setup_environment - go/load-cache: key: v1 - - restore_cache: - keys: - - v3-npm-deps-{{ checksum "web/ui/react-app/yarn.lock" }} - - v3-npm-deps- - run: command: sudo apt-get install -y yamllint - run: - command: make + command: make GO_ONLY=1 environment: # Run garbage collection more aggressively to avoid getting OOMed during the lint phase. GOGC: "20" @@ -50,12 +46,24 @@ jobs: file: promtool - go/save-cache: key: v1 + - store_test_results: + path: test-results + + test_react: + executor: golang + + steps: + - checkout + - restore_cache: + keys: + - v3-npm-deps-{{ checksum "web/ui/react-app/yarn.lock" }} + - v3-npm-deps- + - run: + command: make react-app-test - save_cache: key: v3-npm-deps-{{ checksum "web/ui/react-app/yarn.lock" }} paths: - /home/circleci/.cache/yarn - - store_test_results: - path: test-results test_windows: executor: @@ -121,7 +129,11 @@ workflows: version: 2 prometheus: jobs: - - test: + - test_go: + filters: + tags: + only: /.*/ + - test_react: filters: tags: only: /.*/ @@ -146,7 +158,8 @@ workflows: - prometheus/publish_main: context: org-context requires: - - test + - test_go + - test_react - build filters: branches: @@ -155,7 +168,8 @@ workflows: - prometheus/publish_release: context: org-context requires: - - test + - test_go + - test_react - build filters: tags: diff --git a/Makefile b/Makefile index a940b1f91..17e14c968 100644 --- a/Makefile +++ b/Makefile @@ -64,7 +64,14 @@ react-app-test: | $(REACT_APP_NODE_MODULES_PATH) react-app-lint cd $(REACT_APP_PATH) && yarn test --no-watch --coverage .PHONY: test +# If we only want to only test go code we have to change the test target +# which is called by all. +ifeq ($(GO_ONLY),1) +test: common-test +else test: common-test react-app-test +endif + .PHONY: npm_licenses npm_licenses: $(REACT_APP_NODE_MODULES_PATH)