Skip to content

chore: split go and react tests #186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -45,7 +52,11 @@ workflows:
version: 2
prometheus-webhook-dingtalk:
jobs:
- test:
- test_go:
filters:
tags:
only: /.*/
- test_react:
filters:
tags:
only: /.*/
Expand All @@ -58,7 +69,8 @@ workflows:
- prometheus/publish_main:
context: timonwong-context
requires:
- test
- test_go
- test_react
- build
filters:
branches:
Expand All @@ -69,7 +81,8 @@ workflows:
- prometheus/publish_release:
context: timonwong-context
requires:
- test
- test_go
- test_react
- build
filters:
tags:
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down