From 8be42c4b722c01e1506c518a0e22a053e01413e8 Mon Sep 17 00:00:00 2001 From: Matt Mendick Date: Tue, 28 Jan 2020 13:05:08 -0500 Subject: [PATCH 1/6] Trying to get circle to run some tests/coverage --- .circleci/config.yml | 12 +++++++++++- Makefile | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3de2b6e099b9..7ed7d59d329c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,7 +15,7 @@ version: 2 branches: { ignore: master } workflows: - version: 2 + version: 2.1 default: jobs: # publish jobs depend on this as well, @@ -43,6 +43,8 @@ workflows: requires: [ test-helm ] filters: {<<: *tag-or-master} +orbs: + codecov: codecov/codecov@1.0.2 # https://circleci.com/blog/circleci-hacks-reuse-yaml-in-your-circleci-config-with-yaml/ .defaults: &defaults @@ -55,9 +57,17 @@ jobs: <<: *defaults steps: - checkout + - run: + name: "Create a temp directory for artifacts" + command: | + mkdir -p /tmp/artifacts - run: name: Unit Tests command: make BUILD_IN_CONTAINER=false test + - store_artifacts: + path: /tmp/artifacts + - codecov/upload + file: /tmp/artifacts/coverage.html # Promtail build/promtail-windows: diff --git a/Makefile b/Makefile index 52feb25505d7..98707cb78d58 100644 --- a/Makefile +++ b/Makefile @@ -242,7 +242,8 @@ lint: ######## test: all - GOGC=10 go test $(MOD_FLAG) -p=4 ./... + GOGC=10 go test -coverprofile=coverage.out $(MOD_FLAG) -p=4 ./... + GOGC=10 go tool cover -html=coverage.out -o coverage.html ######### # Clean # From 6f8a4f613231a3ab379b81abd5d1b4717f58dbdb Mon Sep 17 00:00:00 2001 From: Matt Mendick Date: Tue, 28 Jan 2020 15:58:35 -0500 Subject: [PATCH 2/6] Trying again --- .circleci/config.yml | 16 +++++----------- .gitignore | 1 + Makefile | 3 +-- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7ed7d59d329c..4e9c94eabad5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,7 +15,7 @@ version: 2 branches: { ignore: master } workflows: - version: 2.1 + version: 2 default: jobs: # publish jobs depend on this as well, @@ -43,8 +43,6 @@ workflows: requires: [ test-helm ] filters: {<<: *tag-or-master} -orbs: - codecov: codecov/codecov@1.0.2 # https://circleci.com/blog/circleci-hacks-reuse-yaml-in-your-circleci-config-with-yaml/ .defaults: &defaults @@ -57,17 +55,13 @@ jobs: <<: *defaults steps: - checkout - - run: - name: "Create a temp directory for artifacts" - command: | - mkdir -p /tmp/artifacts - run: name: Unit Tests command: make BUILD_IN_CONTAINER=false test - - store_artifacts: - path: /tmp/artifacts - - codecov/upload - file: /tmp/artifacts/coverage.html + - run: + name: Uplode Codecov + command: | + bash <(curl -s https://codecov.io/bash) # Promtail build/promtail-windows: diff --git a/.gitignore b/.gitignore index 740b3407676c..c8cb7d3ccc55 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ cmd/fluent-bit/out_loki.h dlv rootfs/ dist +coverage.txt diff --git a/Makefile b/Makefile index 98707cb78d58..efc57a7dc5b4 100644 --- a/Makefile +++ b/Makefile @@ -242,8 +242,7 @@ lint: ######## test: all - GOGC=10 go test -coverprofile=coverage.out $(MOD_FLAG) -p=4 ./... - GOGC=10 go tool cover -html=coverage.out -o coverage.html + GOGC=10 go test -covermode=atomic -coverprofile=coverage.txt $(MOD_FLAG) -p=4 ./... ######### # Clean # From 62801b8cebe45692e3d63f45efc1cb73c40d9d87 Mon Sep 17 00:00:00 2001 From: Matt Mendick Date: Tue, 28 Jan 2020 16:18:52 -0500 Subject: [PATCH 3/6] Misspelling --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4e9c94eabad5..e339d02a5e6d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -59,7 +59,7 @@ jobs: name: Unit Tests command: make BUILD_IN_CONTAINER=false test - run: - name: Uplode Codecov + name: Upload Codecov command: | bash <(curl -s https://codecov.io/bash) From 484be4bf7e476b6ce07f7c1d6b412800c1a24d0a Mon Sep 17 00:00:00 2001 From: Matt Mendick Date: Tue, 28 Jan 2020 16:54:09 -0500 Subject: [PATCH 4/6] Adding codecov.yml Adding codecov.yml with defaults, and adding in ignoring protobuf generated files --- codecov.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 codecov.yml diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 000000000000..d5312a0f833f --- /dev/null +++ b/codecov.yml @@ -0,0 +1,23 @@ +codecov: + require_ci_to_pass: yes + +coverage: + precision: 2 + round: down + range: "70...100" + +parsers: + gcov: + branch_detection: + conditional: yes + loop: yes + method: no + macro: no + +comment: + layout: "reach,diff,flags,tree" + behavior: default + require_changes: no + +ignore: + - "**/*.pb.go" \ No newline at end of file From 4cbf448dec3b69a309cb76faa7e92e141a2a6555 Mon Sep 17 00:00:00 2001 From: Matt Mendick Date: Tue, 28 Jan 2020 17:00:49 -0500 Subject: [PATCH 5/6] Adding yacc generated files to codecov ignore Adding yacc generated files to codecov ignore --- codecov.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/codecov.yml b/codecov.yml index d5312a0f833f..d8390ec7d556 100644 --- a/codecov.yml +++ b/codecov.yml @@ -20,4 +20,6 @@ comment: require_changes: no ignore: - - "**/*.pb.go" \ No newline at end of file + - "**/*.pb.go" + - "**/*.y.go" + \ No newline at end of file From f4169d44b8b52ad48594cad405fcc7565933c25d Mon Sep 17 00:00:00 2001 From: Matt Mendick Date: Tue, 28 Jan 2020 17:15:21 -0500 Subject: [PATCH 6/6] Newline? Newline? --- codecov.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/codecov.yml b/codecov.yml index d8390ec7d556..3bc3fcff10d8 100644 --- a/codecov.yml +++ b/codecov.yml @@ -22,4 +22,3 @@ comment: ignore: - "**/*.pb.go" - "**/*.y.go" - \ No newline at end of file