mirror of
https://github.com/absmach/magistrala.git
synced 2026-06-23 04:10:28 +00:00
NOISSUE - Fix build tags (#2817)
Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com>
This commit is contained in:
@@ -51,11 +51,11 @@ jobs:
|
||||
|
||||
- name: Compile check for rabbitmq
|
||||
run: |
|
||||
SMQ_MESSAGE_BROKER_TYPE=rabbitmq make mqtt
|
||||
SMQ_MESSAGE_BROKER_TYPE=msg_rabbitmq make mqtt
|
||||
|
||||
- name: Compile check for redis
|
||||
run: |
|
||||
SMQ_ES_TYPE=redis make mqtt
|
||||
SMQ_ES_TYPE=es_redis make mqtt
|
||||
|
||||
- name: Build and push Dockers
|
||||
run: |
|
||||
|
||||
@@ -43,11 +43,11 @@ jobs:
|
||||
|
||||
- name: Compile check for rabbitmq
|
||||
run: |
|
||||
SMQ_MESSAGE_BROKER_TYPE=rabbitmq make mqtt
|
||||
SMQ_MESSAGE_BROKER_TYPE=msg_rabbitmq make mqtt
|
||||
|
||||
- name: Compile check for redis
|
||||
run: |
|
||||
SMQ_ES_TYPE=redis make mqtt
|
||||
SMQ_ES_TYPE=es_redis make mqtt
|
||||
|
||||
run-tests:
|
||||
name: Run tests
|
||||
|
||||
@@ -29,18 +29,18 @@ INTERNAL_PROTO_FILES := $(shell find $(INTERNAL_PROTO_DIR) -name "*.proto" | sed
|
||||
ifneq ($(SMQ_MESSAGE_BROKER_TYPE),)
|
||||
SMQ_MESSAGE_BROKER_TYPE := $(SMQ_MESSAGE_BROKER_TYPE)
|
||||
else
|
||||
SMQ_MESSAGE_BROKER_TYPE=nats
|
||||
SMQ_MESSAGE_BROKER_TYPE=msg_nats
|
||||
endif
|
||||
|
||||
ifneq ($(SMQ_ES_TYPE),)
|
||||
SMQ_ES_TYPE := $(SMQ_ES_TYPE)
|
||||
else
|
||||
SMQ_ES_TYPE=nats
|
||||
SMQ_ES_TYPE=es_nats
|
||||
endif
|
||||
|
||||
define compile_service
|
||||
CGO_ENABLED=$(CGO_ENABLED) GOOS=$(GOOS) GOARCH=$(GOARCH) GOARM=$(GOARM) \
|
||||
go build -tags $(SMQ_MESSAGE_BROKER_TYPE) --tags $(SMQ_ES_TYPE) -ldflags "-s -w \
|
||||
go build -tags $(SMQ_MESSAGE_BROKER_TYPE) -tags $(SMQ_ES_TYPE) -ldflags "-s -w \
|
||||
-X 'github.com/absmach/supermq.BuildTime=$(TIME)' \
|
||||
-X 'github.com/absmach/supermq.Version=$(VERSION)' \
|
||||
-X 'github.com/absmach/supermq.Commit=$(COMMIT)'" \
|
||||
@@ -127,9 +127,9 @@ DIRS = consumers readers postgres internal
|
||||
test: mocks
|
||||
mkdir -p coverage
|
||||
@for dir in $(DIRS); do \
|
||||
go test -v --race -count 1 -tags test -coverprofile=coverage/$$dir.out $$(go list ./... | grep $$dir | grep -v 'cmd'); \
|
||||
go test -v --race -failfast -count 1 -tags test -coverprofile=coverage/$$dir.out $$(go list ./... | grep $$dir | grep -v 'cmd'); \
|
||||
done
|
||||
go test -v --race -count 1 -tags test -coverprofile=coverage/coverage.out $$(go list ./... | grep -v 'consumers\|readers\|postgres\|internal\|cmd\|middleware')
|
||||
go test -v --race -failfast -count 1 -tags test -coverprofile=coverage/coverage.out $$(go list ./... | grep -v 'consumers\|readers\|postgres\|internal\|cmd\|middleware')
|
||||
|
||||
define test_api_service
|
||||
$(eval svc=$(subst test_api_,,$(1)))
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ SMQ_RABBITMQ_MQTT_QOS=0
|
||||
SMQ_RABBITMQ_WS_TARGET_PATH=/ws
|
||||
|
||||
## Message Broker
|
||||
SMQ_MESSAGE_BROKER_TYPE=nats
|
||||
SMQ_MESSAGE_BROKER_TYPE=msg_nats
|
||||
SMQ_MESSAGE_BROKER_URL=${SMQ_NATS_URL}
|
||||
|
||||
## MQTT Broker
|
||||
|
||||
+5
-5
@@ -49,24 +49,24 @@ Therefore, the following combinations are possible:
|
||||
For Message brokers other than NATS, you would need to build the docker images with RabbitMQ as the build tag and change the `docker/.env`. For example, to use RabbitMQ as a message broker:
|
||||
|
||||
```bash
|
||||
SMQ_MESSAGE_BROKER_TYPE=rabbitmq make dockers
|
||||
SMQ_MESSAGE_BROKER_TYPE=msg_rabbitmq make dockers
|
||||
```
|
||||
|
||||
```env
|
||||
SMQ_MESSAGE_BROKER_TYPE=rabbitmq
|
||||
SMQ_MESSAGE_BROKER_TYPE=msg_rabbitmq
|
||||
SMQ_MESSAGE_BROKER_URL=${SMQ_RABBITMQ_URL}
|
||||
```
|
||||
|
||||
For Redis as an events store, you would need to run RabbitMQ or NATS as a message broker. For example, to use Redis as an events store with rabbitmq as a message broker:
|
||||
|
||||
```bash
|
||||
SMQ_ES_TYPE=redis SMQ_MESSAGE_BROKER_TYPE=rabbitmq make dockers
|
||||
SMQ_ES_TYPE=es_redis SMQ_MESSAGE_BROKER_TYPE=msg_rabbitmq make dockers
|
||||
```
|
||||
|
||||
```env
|
||||
SMQ_MESSAGE_BROKER_TYPE=rabbitmq
|
||||
SMQ_MESSAGE_BROKER_TYPE=msg_rabbitmq
|
||||
SMQ_MESSAGE_BROKER_URL=${SMQ_RABBITMQ_URL}
|
||||
SMQ_ES_TYPE=redis
|
||||
SMQ_ES_TYPE=es_redis
|
||||
SMQ_ES_URL=${SMQ_REDIS_URL}
|
||||
```
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright (c) Abstract Machines
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
//go:build nats
|
||||
// +build nats
|
||||
//go:build es_nats
|
||||
// +build es_nats
|
||||
|
||||
package store
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
const StreamAllEvents = "events.>"
|
||||
|
||||
func init() {
|
||||
log.Println("The binary was build using nats as the events store")
|
||||
log.Println("The binary was build using Nats as the events store")
|
||||
}
|
||||
|
||||
func NewPublisher(ctx context.Context, url string) (events.Publisher, error) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright (c) Abstract Machines
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
//go:build rabbitmq
|
||||
// +build rabbitmq
|
||||
//go:build es_rabbitmq
|
||||
// +build es_rabbitmq
|
||||
|
||||
package store
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
const StreamAllEvents = "events.#"
|
||||
|
||||
func init() {
|
||||
log.Println("The binary was build using rabbitmq as the events store")
|
||||
log.Println("The binary was build using RabbitMQ as the events store")
|
||||
}
|
||||
|
||||
func NewPublisher(ctx context.Context, url string) (events.Publisher, error) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright (c) Abstract Machines
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
//go:build !nats && !rabbitmq
|
||||
// +build !nats,!rabbitmq
|
||||
//go:build !es_nats && !es_rabbitmq
|
||||
// +build !es_nats,!es_rabbitmq
|
||||
|
||||
package store
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright (c) Abstract Machines
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
//go:build !rabbitmq
|
||||
// +build !rabbitmq
|
||||
//go:build !msg_rabbitmq
|
||||
// +build !msg_rabbitmq
|
||||
|
||||
package brokers
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright (c) Abstract Machines
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
//go:build rabbitmq
|
||||
// +build rabbitmq
|
||||
//go:build msg_rabbitmq
|
||||
// +build msg_rabbitmq
|
||||
|
||||
package brokers
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright (c) Abstract Machines
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
//go:build !rabbitmq
|
||||
// +build !rabbitmq
|
||||
//go:build !msg_rabbitmq
|
||||
// +build !msg_rabbitmq
|
||||
|
||||
package brokers
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright (c) Abstract Machines
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
//go:build rabbitmq
|
||||
// +build rabbitmq
|
||||
//go:build msg_rabbitmq
|
||||
// +build msg_rabbitmq
|
||||
|
||||
package brokers
|
||||
|
||||
|
||||
+2
-2
@@ -70,9 +70,9 @@ setup_mg() {
|
||||
fi
|
||||
done
|
||||
echo "Compile check for rabbitmq..."
|
||||
SMQ_MESSAGE_BROKER_TYPE=rabbitmq make http
|
||||
SMQ_MESSAGE_BROKER_TYPE=msg_rabbitmq make http
|
||||
echo "Compile check for redis..."
|
||||
SMQ_ES_TYPE=redis make http
|
||||
SMQ_ES_TYPE=es_redis make http
|
||||
make -j$NPROC
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user