Add Go code coverage report to CI (#2914)
* Upgrade npm in build-ubuntu * npm i -S moment * Don't upgrade npm * macos-latest on build-mac * Update dev-release.yml * Add code coverage to server-test-sqlite * Run coverage for mysql and postgres as well * Add coverage for mysql, postgres, and plugin tests * Fix makefile
This commit is contained in:
parent
5cd2c5116f
commit
7bd6f47eb9
2 changed files with 12 additions and 5 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -67,3 +67,5 @@ mattermost-plugin/dist
|
|||
.idea
|
||||
docker/certs
|
||||
docker/data
|
||||
server/**/*.coverage
|
||||
mattermost-plugin/**/*.coverage
|
||||
|
|
15
Makefile
15
Makefile
|
@ -118,7 +118,8 @@ server-test: server-test-sqlite server-test-mysql server-test-postgres ## Run se
|
|||
server-test-sqlite: export FB_UNIT_TESTING=1
|
||||
|
||||
server-test-sqlite: templates-archive ## Run server tests using sqlite
|
||||
cd server; go test -tags '$(BUILD_TAGS)' -race -v -count=1 -timeout=30m ./...
|
||||
cd server; go test -tags '$(BUILD_TAGS)' -race -v -coverpkg=./... -coverprofile=server-sqlite-profile.coverage -count=1 -timeout=30m ./...
|
||||
cd server; go tool cover -func server-sqlite-profile.coverage
|
||||
|
||||
server-test-mini-sqlite: export FB_UNIT_TESTING=1
|
||||
|
||||
|
@ -133,8 +134,10 @@ server-test-mysql: templates-archive ## Run server tests using mysql
|
|||
@echo Starting docker container for mysql
|
||||
docker-compose -f ./docker-testing/docker-compose-mysql.yml down -v --remove-orphans
|
||||
docker-compose -f ./docker-testing/docker-compose-mysql.yml run start_dependencies
|
||||
cd server; go test -tags '$(BUILD_TAGS)' -race -v -count=1 -timeout=30m ./...
|
||||
cd mattermost-plugin/server; go test -tags '$(BUILD_TAGS)' -race -v -count=1 -timeout=30m ./...
|
||||
cd server; go test -tags '$(BUILD_TAGS)' -race -v -coverpkg=./... -coverprofile=server-mysql-profile.coverage -count=1 -timeout=30m ./...
|
||||
cd server; go tool cover -func server-mysql-profile.coverage
|
||||
cd mattermost-plugin/server; go test -tags '$(BUILD_TAGS)' -race -v -coverpkg=./... -coverprofile=plugin-mysql-profile.coverage -count=1 -timeout=30m ./...
|
||||
cd mattermost-plugin/server; go tool cover -func plugin-mysql-profile.coverage
|
||||
docker-compose -f ./docker-testing/docker-compose-mysql.yml down -v --remove-orphans
|
||||
|
||||
server-test-postgres: export FB_UNIT_TESTING=1
|
||||
|
@ -145,8 +148,10 @@ server-test-postgres: templates-archive ## Run server tests using postgres
|
|||
@echo Starting docker container for postgres
|
||||
docker-compose -f ./docker-testing/docker-compose-postgres.yml down -v --remove-orphans
|
||||
docker-compose -f ./docker-testing/docker-compose-postgres.yml run start_dependencies
|
||||
cd server; go test -tags '$(BUILD_TAGS)' -race -v -count=1 -timeout=30m ./...
|
||||
cd mattermost-plugin/server; go test -tags '$(BUILD_TAGS)' -race -v -count=1 -timeout=30m ./...
|
||||
cd server; go test -tags '$(BUILD_TAGS)' -race -v -coverpkg=./... -coverprofile=server-postgres-profile.coverage -count=1 -timeout=30m ./...
|
||||
cd server; go tool cover -func server-postgres-profile.coverage
|
||||
cd mattermost-plugin/server; go test -tags '$(BUILD_TAGS)' -race -v -coverpkg=./... -coverprofile=plugin-postgres-profile.coverage -count=1 -timeout=30m ./...
|
||||
cd mattermost-plugin/server; go tool cover -func plugin-postgres-profile.coverage
|
||||
docker-compose -f ./docker-testing/docker-compose-postgres.yml down -v --remove-orphans
|
||||
|
||||
webapp: ## Build webapp.
|
||||
|
|
Loading…
Reference in a new issue