From 11f707d27762053507366f80fdfaf979abc35b6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Sch=C3=BCller?= Date: Wed, 14 Aug 2024 16:50:39 +0200 Subject: [PATCH] workflows: include splunk_logger sub module in tests --- .github/workflows/tests.yml | 2 +- .gitignore | 3 +++ Makefile | 7 ++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e49714f7b..a16fea8f5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -33,7 +33,7 @@ jobs: run: git config --global --add safe.directory "$(pwd)" - name: Run unit tests - run: go test -race -covermode=atomic -coverprofile=coverage.txt -coverpkg=$(go list ./... | grep -v rpmmd/test$ | tr "\n" ",") ./... + run: make unit-tests - uses: codecov/codecov-action@v4 if: env.CODECOV_TOKEN diff --git a/.gitignore b/.gitignore index b83ec1955..2056a883b 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ __pycache__ container_composer_golangci_built.info processed-templates +coverage.txt + +coverage_splunk_logger.txt diff --git a/Makefile b/Makefile index 92be7c001..04ddd2274 100644 --- a/Makefile +++ b/Makefile @@ -234,8 +234,13 @@ worker-key-pair: ca rm /etc/osbuild-composer/worker-csr.pem .PHONY: unit-tests +.ONESHELL: unit-tests: - go test -race ./... + go test -race -covermode=atomic -coverprofile=coverage.txt -coverpkg=$$(go list ./... | grep -v rpmmd/test$ | tr "\n" ",") ./... + # go modules with go.mod in subdirs are not tested automatically + cd pkg/splunk_logger + go test -race -covermode=atomic -coverprofile=../../coverage_splunk_logger.txt -coverpkg=$$(go list ./... | grep -v rpmmd/test$ | tr "\n" ",") ./... + # # Building packages