mirror of https://github.com/status-im/go-waku.git
test: build example in jenkins
Add command for generating coverage
This commit is contained in:
parent
268767262b
commit
94e8b9cf86
|
@ -8,11 +8,16 @@ nodekey
|
|||
*.so
|
||||
*.dylib
|
||||
|
||||
# output binaries
|
||||
main
|
||||
go-waku
|
||||
|
||||
# Test binary, built with `go test -c`
|
||||
*.test
|
||||
|
||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||
*.out
|
||||
coverage.html
|
||||
|
||||
# Dependency directories (remove the comment below to include it)
|
||||
# vendor/
|
||||
|
|
21
Makefile
21
Makefile
|
@ -1,4 +1,4 @@
|
|||
.PHONY: all build lint test
|
||||
.PHONY: all build lint test coverage build-example
|
||||
|
||||
all: build
|
||||
|
||||
|
@ -24,9 +24,28 @@ test:
|
|||
generate:
|
||||
go generate ./waku/v2/protocol/pb/generate.go
|
||||
|
||||
coverage:
|
||||
go test -count 1 -coverprofile=coverage.out ./...
|
||||
go tool cover -html=coverage.out -o=coverage.html
|
||||
|
||||
# build a docker image for the fleet
|
||||
docker-image: DOCKER_IMAGE_TAG ?= latest
|
||||
docker-image: DOCKER_IMAGE_NAME ?= statusteam/go-waku:$(DOCKER_IMAGE_TAG)
|
||||
docker-image:
|
||||
docker build --tag $(DOCKER_IMAGE_NAME) \
|
||||
--build-arg="GIT_COMMIT=$(shell git rev-parse HEAD)" .
|
||||
|
||||
build-example-basic2:
|
||||
go build examples/basic2/main.go
|
||||
|
||||
build-example-chat-2:
|
||||
# TODO: require UI + Chat which are gone
|
||||
# go build examples/chat2/main.go
|
||||
|
||||
build-example-filter2:
|
||||
go build examples/filter2/main.go
|
||||
|
||||
build-example-peer-events:
|
||||
go build examples/peer_events/main.go
|
||||
|
||||
build-example: build-example-basic2 build-example-chat-2 build-example-filter2 build-example-peer-events
|
|
@ -28,6 +28,10 @@ pipeline {
|
|||
stage('Test') {
|
||||
steps { sh 'make test' }
|
||||
}
|
||||
|
||||
stage('Build example') {
|
||||
steps { sh 'make build-example' }
|
||||
}
|
||||
}
|
||||
post {
|
||||
always { cleanWs() }
|
||||
|
|
|
@ -40,7 +40,7 @@ func main() {
|
|||
|
||||
wakuNode, err := node.New(ctx,
|
||||
node.WithPrivateKey(prvKey),
|
||||
node.WithHostAddress([]net.Addr{hostAddr}),
|
||||
node.WithHostAddress([]*net.TCPAddr{hostAddr}),
|
||||
node.WithWakuRelay(),
|
||||
)
|
||||
if err != nil {
|
||||
|
@ -93,7 +93,7 @@ func write(ctx context.Context, wakuNode *node.WakuNode, msgContent string) {
|
|||
Timestamp: timestamp,
|
||||
}
|
||||
|
||||
_, err = wakuNode.Publish(ctx, msg, nil)
|
||||
_, err = wakuNode.Relay().Publish(ctx, msg, nil)
|
||||
if err != nil {
|
||||
log.Error("Error sending a message: ", err)
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ func writeLoop(ctx context.Context, wakuNode *node.WakuNode) {
|
|||
}
|
||||
|
||||
func readLoop(ctx context.Context, wakuNode *node.WakuNode) {
|
||||
sub, err := wakuNode.Subscribe(ctx, nil)
|
||||
sub, err := wakuNode.Relay().Subscribe(ctx, nil)
|
||||
if err != nil {
|
||||
log.Error("Could not subscribe: ", err)
|
||||
return
|
||||
|
|
|
@ -146,7 +146,7 @@ func write(ctx context.Context, wakuNode *node.WakuNode, msgContent string) {
|
|||
Timestamp: timestamp,
|
||||
}
|
||||
|
||||
_, err := wakuNode.Publish(ctx, msg, nil)
|
||||
_, err := wakuNode.Relay().Publish(ctx, msg, nil)
|
||||
if err != nil {
|
||||
log.Error("Error sending a message: ", err)
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ func writeLoop(ctx context.Context, wakuNode *node.WakuNode) {
|
|||
}
|
||||
|
||||
func readLoop(ctx context.Context, wakuNode *node.WakuNode) {
|
||||
sub, err := wakuNode.Subscribe(ctx, &pubSubTopic)
|
||||
sub, err := wakuNode.Relay().Subscribe(ctx, &pubSubTopic)
|
||||
if err != nil {
|
||||
log.Error("Could not subscribe: ", err)
|
||||
return
|
||||
|
|
|
@ -62,7 +62,7 @@ func main() {
|
|||
log.Info("### create relayNode1")
|
||||
relayNode1, err := node.New(ctx,
|
||||
node.WithPrivateKey(addrsAndKeys[0].key),
|
||||
node.WithHostAddress([]net.Addr{addrsAndKeys[0].addr}),
|
||||
node.WithHostAddress([]*net.TCPAddr{addrsAndKeys[0].addr}),
|
||||
node.WithWakuRelay(),
|
||||
//node.WithConnStatusChan(connStatusChan),
|
||||
node.WithWakuStore(true, false),
|
||||
|
@ -198,7 +198,7 @@ func write(ctx context.Context, wakuNode *node.WakuNode, msgContent string) {
|
|||
Timestamp: timestamp,
|
||||
}
|
||||
|
||||
_, err = wakuNode.Publish(ctx, msg, nil)
|
||||
_, err = wakuNode.Relay().Publish(ctx, msg, nil)
|
||||
if err != nil {
|
||||
log.Error("Error sending a message: ", err)
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ func writeLoop(ctx context.Context, wakuNode *node.WakuNode) {
|
|||
}
|
||||
|
||||
func readLoop(ctx context.Context, wakuNode *node.WakuNode) {
|
||||
sub, err := wakuNode.Subscribe(ctx, &pubSubTopic)
|
||||
sub, err := wakuNode.Relay().Subscribe(ctx, &pubSubTopic)
|
||||
if err != nil {
|
||||
log.Error("Could not subscribe: ", err)
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue