diff --git a/.github/workflows/shellspec-push.yml b/.github/workflows/shellspec-push.yml index 4169f90b6..bbe6f8fbd 100644 --- a/.github/workflows/shellspec-push.yml +++ b/.github/workflows/shellspec-push.yml @@ -56,3 +56,11 @@ jobs: if: ${{ steps.get_file_path.outputs.shell_file_path }} run: | make scripts-test + + - name: Upload coverage + if: ${{ steps.get_file_path.outputs.shell_file_path }} + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + run: | + bash <(curl -s https://codecov.io/bash) -s coverage + diff --git a/Makefile b/Makefile index 15b389043..76e31f1f0 100644 --- a/Makefile +++ b/Makefile @@ -112,4 +112,9 @@ endif # run shellspec tests .PHONY: scripts-test scripts-test: install-shellspec ## Run shellspec unit test cases. - @shellspec --load-path $(SHELLSPEC_LOAD_PATH) --default-path $(SHELLSPEC_DEFAULT_PATH) --shell $(SHELLSPEC_DEFAULT_SHELL) \ No newline at end of file + @shellspec --load-path $(SHELLSPEC_LOAD_PATH) --default-path $(SHELLSPEC_DEFAULT_PATH) --shell $(SHELLSPEC_DEFAULT_SHELL) + +# run shellspec tests with coverage report +.PHONY: scripts-test-kcov +scripts-test-kcov: install-shellspec ## Run shellspec unit test cases. + @shellspec --load-path $(SHELLSPEC_LOAD_PATH) --default-path $(SHELLSPEC_DEFAULT_PATH) --shell $(SHELLSPEC_DEFAULT_SHELL) --kcov diff --git a/addons/postgresql/scripts-ut-spec/pgbouncer_setup_spec.sh b/addons/postgresql/scripts-ut-spec/pgbouncer_setup_spec.sh index 1ffcf6d59..4c127584b 100644 --- a/addons/postgresql/scripts-ut-spec/pgbouncer_setup_spec.sh +++ b/addons/postgresql/scripts-ut-spec/pgbouncer_setup_spec.sh @@ -7,6 +7,7 @@ if ! validate_shell_type_and_version "bash" 4 &>/dev/null; then exit 0 fi + source ./utils.sh # The unit test needs to rely on the common library functions defined in kblib.