Skip to content

Commit

Permalink
test: generate e2e coverage profile
Browse files Browse the repository at this point in the history
Signed-off-by: Billy Zha <jinzha1@microsoft.com>

try remove shell indication
  • Loading branch information
qweeah committed May 16, 2023
1 parent 5516199 commit 0cbd1e8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ jobs:
- name: Run unit tests
run: make test
- name: Run e2e tests
run: make e2e
run: |
if [[ $GITHUB_REF_NAME == v* && $GITHUB_REF_TYPE == tag ]]; then
make e2e
else
make e2e-covdata
fi
- name: Upload coverage to codecov.io
uses: codecov/codecov-action@v3
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@
bin/
vendor/
coverage.txt
test/e2e/coverage.txt
**/covcounters.*
**/covmeta.*
dist/
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ all: build
FORCE:

bin/%: cmd/% FORCE
go build $(GO_BUILD_FLAGS) -o $@ ./$<
go build $(GO_INSTRUMENT_FLAGS) $(GO_BUILD_FLAGS) -o $@ ./$<

.PHONY: download
download: ## download dependencies via go mod
Expand All @@ -48,7 +48,16 @@ test: vendor check-line-endings ## run unit tests
e2e: build ## build notation cli and run e2e test
NOTATION_BIN_PATH=`pwd`/bin/$(COMMANDS); \
cd ./test/e2e; \
./run.sh zot $$NOTATION_BIN_PATH
./run.sh zot $$NOTATION_BIN_PATH; \

.PHONY: e2e-covdata
e2e-covdata:
export GOCOVERDIR=$(CURDIR)/test/e2e/.cover; \
rm $$GOCOVERDIR -rf; \
mkdir -p $$GOCOVERDIR; \
export GO_INSTRUMENT_FLAGS='-coverpkg "github.com/notaryproject/notation/internal/...,github.com/notaryproject/notation/pkg/...,github.com/notaryproject/notation/cmd/..."'; \
$(MAKE) e2e; \
go tool covdata textfmt -i=$$GOCOVERDIR -o "$(CURDIR)/test/e2e/coverage.txt"

.PHONY: clean
clean:
Expand Down

0 comments on commit 0cbd1e8

Please sign in to comment.