diff --git a/.circleci/config.yml b/.circleci/config.yml index 47ea9a22..99ff83c0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2.1 orbs: - prometheus: prometheus/prometheus@0.11.0 + prometheus: prometheus/prometheus@0.16.0 go: circleci/go@1.7.0 executors: @@ -12,18 +12,14 @@ executors: - image: circleci/golang:1.17-node jobs: - test: + test_go: executor: golang steps: - prometheus/setup_environment - go/load-cache - - restore_cache: - keys: - - v2-npm-deps-{{ checksum "web/ui/react-app/package-lock.json" }} - - v2-npm-deps- - run: - command: make + command: make GO_ONLY=1 environment: # By default, Go uses GOMAXPROCS but a Circle CI executor has many # cores (> 30) while the CPU and RAM resources are throttled. If we @@ -36,6 +32,17 @@ jobs: file: prometheus-webhook-dingtalk - go/save-cache: path: /go/pkg/mod + + test_react: + executor: golang + steps: + - checkout + - restore_cache: + keys: + - v2-npm-deps-{{ checksum "web/ui/react-app/package-lock.json" }} + - v2-npm-deps- + - run: + command: make react-app-test - save_cache: key: v2-npm-deps-{{ checksum "web/ui/react-app/package-lock.json" }} paths: @@ -45,7 +52,11 @@ workflows: version: 2 prometheus-webhook-dingtalk: jobs: - - test: + - test_go: + filters: + tags: + only: /.*/ + - test_react: filters: tags: only: /.*/ @@ -58,7 +69,8 @@ workflows: - prometheus/publish_main: context: timonwong-context requires: - - test + - test_go + - test_react - build filters: branches: @@ -69,7 +81,8 @@ workflows: - prometheus/publish_release: context: timonwong-context requires: - - test + - test_go + - test_react - build filters: tags: diff --git a/Makefile b/Makefile index 4e6ea352..0cb18061 100644 --- a/Makefile +++ b/Makefile @@ -54,8 +54,13 @@ react-app-test: | $(REACT_APP_NODE_MODULES_PATH) react-app-lint cd $(REACT_APP_PATH) && npm run test --no-watch --coverage .PHONY: test -#test: common-test react-app-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: clean clean: