mirror of
https://github.com/mainflux/mainflux.git
synced 2025-04-24 13:48:49 +08:00

* Refactor message broker implementation This commit refactors the Nats message broker implementation to include pubsub options. These changes include: - Adding `Option` func that takes in the URL and prefix - Implement `WithStream` option which can create a different stream for nats stream - Implement `WithExchange` option which can create a different exchaange for rabbitmq channel - Implement `WithPrefix` option which allows to you change the publisher prefix These changes improve the organization and readability of the codebase. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Use redis URL to configure username, password and db Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Make event store configurable on dev deployment Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix adds options to messaging `PubSub` interface Adding options to PubSub interface allows the use of messaging package to do es. The changes in this commit ensure that the code handles errors properly and provides more informative error messages when encountering unexpected types. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Add NATS event publisher implementation This commit adds the implementation of the NATS event publisher. The NATS event publisher is responsible for publishing events to a NATS messaging system. It uses the `messaging` package to interact with the messaging system. The implementation includes the following features: - Publishing events to NATS using the `Publish` method. - Marshaling events to JSON before publishing. - Setting the message subject and headers based on the event. - Handling errors during publishing. This implementation is built with the `!rabbitmq` build tag, which means it will only be compiled if the `rabbitmq` build tag is not present. The NATS event publisher is part of the Mainflux events package and provides support for the Mainflux NATS events source service functionality. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Add RabbitMQ event publisher implementation This commit adds the implementation of the RabbitMQ event publisher. The RabbitMQ event publisher is responsible for publishing events to a RabbitMQ messaging system. It uses the `messaging` package to interact with the messaging system. The implementation includes the following features: - Publishing events to RabbitMQ using the `Publish` method. - Marshaling events to JSON before publishing. - Setting the message subject and headers based on the event. - Handling errors during publishing. This implementation is built with the `rabbitmq` build tag, which means it will only be compiled if the `rabbitmq` build tag is present. The RabbitMQ event publisher is part of the Mainflux events package and provides support for the Mainflux RabbitMQ events source service functionality. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Add configurable implementation for events store This commit adds a new file `brokers_*.go` which contains the implementation for the different event store. The file includes functions for creating a new publisher and subscriber using different es store. This commit also includes an `init` function that logs a message indicating that the binary was built using the respective package as the events store. The purpose of this commit is to add support for alternative events store. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix build flags Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Refactor Makefile and Semaphore configuration The Makefile has been refactored to include the `MF_ES_STORE_TYPE` tag in the `go build` command. Additionally, the Semaphore configuration has been updated to include a new task for compiling with Redis as the broker type. This commit addresses the need to compile the codebase with Redis as the event store type and includes the necessary changes in the Makefile and Semaphore configuration. Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Reduced due to memory on testing Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix tests for es Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix grammar Co-authored-by: Sammy Kerata Oina <44265300+SammyOina@users.noreply.github.com> Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix linting Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * feat(docker): update environment variables for message broker The commit updates the environment variable `MF_ES_STORE_TYPE` in the `docker/.env` file. The variable is changed from `${MF_MQTT_BROKER_TYPE}` to `${MF_MESSAGE_BROKER_TYPE}` to accurately reflect the type of message broker being used. This change ensures that the correct message broker is configured for the Event Store. Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * feat: Update docker environment variables - Removed the unused MF_ES_URL variable in the .env file - Updated the MF_ES_STORE_TYPE and MF_ES_STORE_URL variables in the .env file to match the MF_MESSAGE_BROKER_TYPE and MF_NATS_URL variables respectively Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix after rebase Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Add godocs for option parameters for brokers Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * pass by value exchange and prefix names Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Rename option functions Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * move variables to constants Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * fix: option example comment Signed-off-by: rodneyosodo <blackd0t@protonmail.com> --------- Signed-off-by: Rodney Osodo <socials@rodneyosodo.com> Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com> Signed-off-by: rodneyosodo <blackd0t@protonmail.com> Co-authored-by: Sammy Kerata Oina <44265300+SammyOina@users.noreply.github.com>
708 lines
22 KiB
YAML
708 lines
22 KiB
YAML
version: v1.0
|
|
name: CI Pipeline
|
|
agent:
|
|
machine:
|
|
type: e1-standard-2
|
|
os_image: ubuntu2004
|
|
auto_cancel:
|
|
running:
|
|
when: branch != 'master'
|
|
global_job_config:
|
|
prologue:
|
|
commands:
|
|
- checkout
|
|
- sem-version go 1.21
|
|
blocks:
|
|
- name: Setup
|
|
dependencies: []
|
|
task:
|
|
jobs:
|
|
- name: Setup Codecov
|
|
commands:
|
|
- "curl -Os https://uploader.codecov.io/latest/linux/codecov"
|
|
- chmod +x codecov
|
|
- ./codecov
|
|
- cache store codecov ./codecov
|
|
- name: Setup Golangci-lint
|
|
commands:
|
|
- "curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.53.3"
|
|
- cache store linter ./bin/golangci-lint
|
|
secrets:
|
|
- name: codecov
|
|
- name: Check Generated Protocol Buffer Files
|
|
dependencies: []
|
|
run:
|
|
when: "change_in(['./auth.proto', 'pkg/messaging/message.proto'])"
|
|
task:
|
|
jobs:
|
|
- name: Check Generated Protocol Buffer Files
|
|
commands:
|
|
- PROTOC_VERSION=24.3
|
|
- PROTOC_GEN_VERSION=v1.31.0
|
|
- PROTOC_GRPC_VERSION=v1.3.0
|
|
- PROTOC_ZIP=protoc-$PROTOC_VERSION-linux-x86_64.zip
|
|
|
|
- curl -0L https://github.com/google/protobuf/releases/download/v$PROTOC_VERSION/$PROTOC_ZIP -o $PROTOC_ZIP
|
|
- unzip -o $PROTOC_ZIP -d protoc3
|
|
- sudo mv protoc3/bin/* /usr/local/bin/
|
|
- sudo mv protoc3/include/* /usr/local/include/
|
|
- rm -rf $PROTOC_ZIP protoc3
|
|
|
|
- go install google.golang.org/protobuf/cmd/protoc-gen-go@$PROTOC_GEN_VERSION
|
|
- go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@$PROTOC_GRPC_VERSION
|
|
|
|
- export PATH=$PATH:/usr/local/bin/protoc
|
|
- export PATH=$PATH:$HOME/go/bin
|
|
|
|
- |
|
|
echo "Setting up Mainflux..."
|
|
for p in $(ls ./*.pb.go); do
|
|
mv $p $p.tmp
|
|
done
|
|
for p in $(ls pkg/messaging/*.pb.go); do
|
|
mv $p $p.tmp
|
|
done
|
|
- make proto
|
|
- |
|
|
for p in $(ls ./*.pb.go); do
|
|
if ! cmp -s $p $p.tmp; then
|
|
echo "Proto file and generated Go file $p are out of sync!"
|
|
exit 1
|
|
fi
|
|
done
|
|
- |
|
|
for p in $(ls pkg/messaging/*.pb.go); do
|
|
if ! cmp -s $p $p.tmp; then
|
|
echo "Proto file and generated Go file $p are out of sync!"
|
|
exit 1
|
|
fi
|
|
done
|
|
- name: Lint and Test Users
|
|
run:
|
|
when: "change_in(['users', 'cmd/users', 'auth/service.go', 'auth/api/grpc/client.go'])"
|
|
dependencies:
|
|
- Setup
|
|
- Check Generated Protocol Buffer Files
|
|
task:
|
|
jobs:
|
|
- name: Lint Users
|
|
commands:
|
|
- cd users
|
|
- cache restore linter
|
|
- "./bin/golangci-lint run"
|
|
- name: Test Users
|
|
commands:
|
|
- cd users
|
|
- go test ./... --race -v -coverprofile=coverage.out
|
|
- go tool cover -html=coverage.out -o coverage.html
|
|
- cache restore codecov
|
|
- ./codecov
|
|
secrets:
|
|
- name: codecov
|
|
- name: Build Users
|
|
dependencies:
|
|
- Lint and Test Users
|
|
run:
|
|
when: "change_in(['users', 'cmd/users'])"
|
|
task:
|
|
jobs:
|
|
- name: Build Users
|
|
commands:
|
|
- make docker_users
|
|
secrets:
|
|
- name: docker_hub
|
|
- name: Lint and Test Things
|
|
run:
|
|
when: "change_in(['things', 'cmd/things', 'auth/service.go', 'auth/api/grpc/client.go'])"
|
|
dependencies:
|
|
- Setup
|
|
- Check Generated Protocol Buffer Files
|
|
task:
|
|
jobs:
|
|
- name: Lint Things
|
|
commands:
|
|
- cd things
|
|
- cache restore linter
|
|
- "./bin/golangci-lint run"
|
|
- name: Test Things
|
|
commands:
|
|
- cd things
|
|
- go test ./... --race -v -coverprofile=coverage.out
|
|
- go tool cover -html=coverage.out -o coverage.html
|
|
- cache restore codecov
|
|
- ./codecov
|
|
secrets:
|
|
- name: codecov
|
|
- name: Build Things
|
|
dependencies:
|
|
- Lint and Test Things
|
|
run:
|
|
when: "change_in(['things', 'cmd/things'])"
|
|
task:
|
|
jobs:
|
|
- name: Build Things
|
|
commands:
|
|
- make docker_things
|
|
secrets:
|
|
- name: docker_hub
|
|
- name: Lint and Test CoAP
|
|
run:
|
|
when: "change_in(['coap', 'cmd/coap', 'things/api/grpc', 'auth/service.go', 'auth/api/grpc/client.go'])"
|
|
dependencies:
|
|
- Setup
|
|
- Check Generated Protocol Buffer Files
|
|
task:
|
|
jobs:
|
|
- name: Lint CoAP
|
|
commands:
|
|
- cd coap
|
|
- cache restore linter
|
|
- "./bin/golangci-lint run"
|
|
- name: Test CoAP
|
|
commands:
|
|
- cd coap
|
|
- go test ./... --race -v -coverprofile=coverage.out
|
|
- go tool cover -html=coverage.out -o coverage.html
|
|
- cache restore codecov
|
|
- ./codecov
|
|
secrets:
|
|
- name: codecov
|
|
- name: Build CoAP
|
|
dependencies:
|
|
- Lint and Test CoAP
|
|
run:
|
|
when: "change_in(['coap', 'cmd/coap'])"
|
|
task:
|
|
jobs:
|
|
- name: Build CoAP
|
|
commands:
|
|
- make docker_coap
|
|
secrets:
|
|
- name: docker_hub
|
|
- name: Lint and Test HTTP
|
|
run:
|
|
when: "change_in(['http', 'cmd/http', 'things/api/grpc', 'auth/service.go', 'auth/api/grpc/client.go'])"
|
|
dependencies:
|
|
- Setup
|
|
- Check Generated Protocol Buffer Files
|
|
task:
|
|
jobs:
|
|
- name: Lint HTTP
|
|
commands:
|
|
- cd http
|
|
- cache restore linter
|
|
- "./bin/golangci-lint run"
|
|
- name: Test HTTP
|
|
commands:
|
|
- cd http
|
|
- go test ./... --race -v -coverprofile=coverage.out
|
|
- go tool cover -html=coverage.out -o coverage.html
|
|
- cache restore codecov
|
|
- ./codecov
|
|
secrets:
|
|
- name: codecov
|
|
- name: Build HTTP
|
|
dependencies:
|
|
- Lint and Test HTTP
|
|
run:
|
|
when: "change_in(['http', 'cmd/http'])"
|
|
task:
|
|
jobs:
|
|
- name: Build HTTP
|
|
commands:
|
|
- echo $DOCKER_TOKEN | docker login --username "$DOCKER_USERNAME" --password-stdin
|
|
- docker push mainflux/http:latest
|
|
secrets:
|
|
- name: docker_hub
|
|
- name: Lint and Test MQTT
|
|
run:
|
|
when: "change_in(['mqtt', 'cmd/mqtt', 'things/api/grpc', 'auth/service.go', 'auth/api/grpc/client.go'])"
|
|
dependencies:
|
|
- Setup
|
|
- Check Generated Protocol Buffer Files
|
|
task:
|
|
jobs:
|
|
- name: Lint MQTT
|
|
commands:
|
|
- cd mqtt
|
|
- cache restore linter
|
|
- "./bin/golangci-lint run"
|
|
- name: Test MQTT
|
|
commands:
|
|
- cd mqtt
|
|
- go test ./... --race -v -coverprofile=coverage.out
|
|
- go tool cover -html=coverage.out -o coverage.html
|
|
- cache restore codecov
|
|
- ./codecov
|
|
secrets:
|
|
- name: codecov
|
|
- name: Build MQTT
|
|
dependencies:
|
|
- Lint and Test MQTT
|
|
run:
|
|
when: "change_in(['mqtt', 'cmd/mqtt'])"
|
|
task:
|
|
jobs:
|
|
- name: Build MQTT
|
|
commands:
|
|
- echo $DOCKER_TOKEN | docker login --username "$DOCKER_USERNAME" --password-stdin
|
|
- docker push mainflux/mqtt:latest
|
|
secrets:
|
|
- name: docker_hub
|
|
- name: Lint and Test WS
|
|
run:
|
|
when: "change_in(['ws', 'cmd/ws', 'things/api/grpc', 'auth/service.go', 'auth/api/grpc/client.go'])"
|
|
dependencies:
|
|
- Setup
|
|
- Check Generated Protocol Buffer Files
|
|
task:
|
|
jobs:
|
|
- name: Lint WS
|
|
commands:
|
|
- cd ws
|
|
- cache restore linter
|
|
- "./bin/golangci-lint run"
|
|
- name: Test WS
|
|
commands:
|
|
- cd ws
|
|
- go test ./... --race -v -coverprofile=coverage.out
|
|
- go tool cover -html=coverage.out -o coverage.html
|
|
- cache restore codecov
|
|
- ./codecov
|
|
secrets:
|
|
- name: codecov
|
|
- name: Build WS
|
|
dependencies:
|
|
- Lint and Test WS
|
|
run:
|
|
when: "change_in(['ws', 'cmd/ws', 'things/api/grpc', 'auth/service.go', 'auth/api/grpc/client.go'])"
|
|
task:
|
|
jobs:
|
|
- name: Build WS
|
|
commands:
|
|
- echo $DOCKER_TOKEN | docker login --username "$DOCKER_USERNAME" --password-stdin
|
|
- docker push mainflux/ws:latest
|
|
secrets:
|
|
- name: docker_hub
|
|
- name: Lint and Test Bootstrap
|
|
run:
|
|
when: "change_in(['bootstrap', 'cmd/bootstrap','things/policies/postgres/policies.go', 'things/policies/api/grpc/client.go'])"
|
|
dependencies:
|
|
- Setup
|
|
- Check Generated Protocol Buffer Files
|
|
task:
|
|
jobs:
|
|
- name: Lint Bootstrap
|
|
commands:
|
|
- cd bootstrap
|
|
- cache restore linter
|
|
- "./bin/golangci-lint run"
|
|
- name: Test Bootstrap
|
|
commands:
|
|
- cd bootstrap
|
|
- go test ./... --race -v -coverprofile=coverage.out
|
|
- go tool cover -html=coverage.out -o coverage.html
|
|
- cache restore codecov
|
|
- ./codecov
|
|
secrets:
|
|
- name: codecov
|
|
- name: Build Bootstrap
|
|
dependencies:
|
|
- Lint and Test Bootstrap
|
|
run:
|
|
when: "change_in(['bootstrap', 'cmd/bootstrap'])"
|
|
task:
|
|
jobs:
|
|
- name: Build Bootstrap
|
|
commands:
|
|
- echo $DOCKER_TOKEN | docker login --username "$DOCKER_USERNAME" --password-stdin
|
|
- docker push mainflux/bootstrap:latest
|
|
secrets:
|
|
- name: docker_hub
|
|
- name: Lint and Test Certs
|
|
run:
|
|
when: "change_in(['certs', 'cmd/certs', 'things/api/grpc', 'auth/service.go', 'auth/api/grpc/client.go'])"
|
|
dependencies:
|
|
- Setup
|
|
- Check Generated Protocol Buffer Files
|
|
task:
|
|
jobs:
|
|
- name: Lint Certs
|
|
commands:
|
|
- cd certs
|
|
- cache restore linter
|
|
- "./bin/golangci-lint run"
|
|
- name: Test Certs
|
|
commands:
|
|
- cd certs
|
|
- go test ./... --race -v -coverprofile=coverage.out
|
|
- go tool cover -html=coverage.out -o coverage.html
|
|
- cache restore codecov
|
|
- ./codecov
|
|
secrets:
|
|
- name: codecov
|
|
- name: Build Certs
|
|
dependencies:
|
|
- Lint and Test Certs
|
|
run:
|
|
when: "change_in(['certs', 'cmd/certs'])"
|
|
task:
|
|
jobs:
|
|
- name: Build Certs
|
|
commands:
|
|
- echo $DOCKER_TOKEN | docker login --username "$DOCKER_USERNAME" --password-stdin
|
|
- docker push mainflux/certs:latest
|
|
secrets:
|
|
- name: docker_hub
|
|
- name: Lint and Test Provision
|
|
dependencies:
|
|
- Setup
|
|
- Check Generated Protocol Buffer Files
|
|
run:
|
|
when: "change_in(['provision', 'cmd/provision'])"
|
|
task:
|
|
jobs:
|
|
- name: Lint Provision
|
|
commands:
|
|
- cd provision
|
|
- cache restore linter
|
|
- "./bin/golangci-lint run"
|
|
- name: Test Provision
|
|
commands:
|
|
- cd provision
|
|
- go test ./... --race -v -coverprofile=coverage.out
|
|
- go tool cover -html=coverage.out -o coverage.html
|
|
- cache restore codecov
|
|
- ./codecov
|
|
secrets:
|
|
- name: codecov
|
|
- name: Build Provision
|
|
dependencies:
|
|
- Lint and Test Provision
|
|
run:
|
|
when: "change_in(['provision', 'cmd/provision', 'things/api/grpc', 'auth/service.go', 'auth/api/grpc/client.go'])"
|
|
task:
|
|
jobs:
|
|
- name: Build Provision
|
|
commands:
|
|
- echo $DOCKER_TOKEN | docker login --username "$DOCKER_USERNAME" --password-stdin
|
|
- docker push mainflux/http:latest
|
|
secrets:
|
|
- name: docker_hub
|
|
- name: Lint and Test Twins
|
|
run:
|
|
when: "change_in(['twins', 'cmd/twins', 'things/api/grpc', 'auth/service.go', 'auth/api/grpc/client.go'])"
|
|
dependencies:
|
|
- Setup
|
|
- Check Generated Protocol Buffer Files
|
|
task:
|
|
jobs:
|
|
- name: Lint Twins
|
|
commands:
|
|
- cd twins
|
|
- cache restore linter
|
|
- "./bin/golangci-lint run"
|
|
- name: Test Twins
|
|
commands:
|
|
- cd twins
|
|
- go test ./... --race -v -coverprofile=coverage.out
|
|
- go tool cover -html=coverage.out -o coverage.html
|
|
- cache restore codecov
|
|
- ./codecov
|
|
secrets:
|
|
- name: codecov
|
|
- name: Build Twins
|
|
dependencies:
|
|
- Lint and Test Twins
|
|
run:
|
|
when: "change_in(['twins', 'cmd/twins'])"
|
|
task:
|
|
jobs:
|
|
- name: Build Twins
|
|
commands:
|
|
- echo $DOCKER_TOKEN | docker login --username "$DOCKER_USERNAME" --password-stdin
|
|
- docker push mainflux/twins:latest
|
|
secrets:
|
|
- name: docker_hub
|
|
- name: Lint and Test Readers
|
|
run:
|
|
when: "change_in(['/readers', 'cmd/cassandra-reader', 'cmd/influxdb-reader', 'cmd/mongodb-reader', 'cmd/postgres-reader', 'cmd/timescale-reader', 'things/api/grpc', 'auth/service.go', 'auth/api/grpc/client.go'])"
|
|
dependencies:
|
|
- Setup
|
|
- Check Generated Protocol Buffer Files
|
|
task:
|
|
jobs:
|
|
- name: Lint Readers
|
|
commands:
|
|
- cd readers
|
|
- cache restore linter
|
|
- "./bin/golangci-lint run"
|
|
- name: Test Twins
|
|
commands:
|
|
- cd readers
|
|
- go test ./... --race -v -coverprofile=coverage.out
|
|
- go tool cover -html=coverage.out -o coverage.html
|
|
- cache restore codecov
|
|
- ./codecov
|
|
secrets:
|
|
- name: codecov
|
|
- name: Build Readers
|
|
dependencies:
|
|
- Lint and Test Readers
|
|
run:
|
|
when: "change_in(['readers', 'cmd/cassandra-reader', 'cmd/influxdb-reader', 'cmd/mongodb-reader', 'cmd/postgres-reader', 'cmd/timescale-reader', 'things/api/grpc', 'auth/service.go', 'auth/api/grpc/client.go'])"
|
|
task:
|
|
jobs:
|
|
- name: Build Readers
|
|
commands:
|
|
- echo $DOCKER_TOKEN | docker login --username "$DOCKER_USERNAME" --password-stdin
|
|
- docker push mainflux/cassandra-reader:latest
|
|
- docker push mainflux/influxdb-reader:latest
|
|
- docker push mainflux/mongodb-reader:latest
|
|
- docker push mainflux/postgres-reader:latest
|
|
- docker push mainflux/timescale-reader:latest
|
|
secrets:
|
|
- name: docker_hub
|
|
- name: Lint and Test Consumers
|
|
run:
|
|
when: "change_in(['consumers', 'cmd/cassandra-writer', 'cmd/influxdb-writer', 'cmd/mongodb-writer', 'cmd/postgres-writer', 'cmd/timescale-writer', 'cmd/smpp-notifier', 'cmd/smtp-notifier', 'things/api/grpc', 'auth/service.go', 'auth/api/grpc/client.go'])"
|
|
dependencies:
|
|
- Setup
|
|
- Check Generated Protocol Buffer Files
|
|
task:
|
|
jobs:
|
|
- name: Lint Consumers
|
|
commands:
|
|
- cd consumers
|
|
- cache restore linter
|
|
- "./bin/golangci-lint run"
|
|
- name: Test Consumers
|
|
commands:
|
|
- cd consumers
|
|
- go test ./... --race -v -coverprofile=coverage.out
|
|
- go tool cover -html=coverage.out -o coverage.html
|
|
- cache restore codecov
|
|
- ./codecov
|
|
secrets:
|
|
- name: codecov
|
|
- name: Build Consumers
|
|
dependencies:
|
|
- Lint and Test Consumers
|
|
run:
|
|
when: "change_in(['consumers', 'cmd/cassandra-writer', 'cmd/influxdb-writer', 'cmd/mongodb-writer', 'cmd/postgres-writer', 'cmd/timescale-writer', 'cmd/smpp-notifier', 'cmd/smtp-notifier', 'things/api/grpc', 'auth/service.go', 'auth/api/grpc/client.go'])"
|
|
task:
|
|
jobs:
|
|
- name: Build Consumers
|
|
commands:
|
|
- echo $DOCKER_TOKEN | docker login --username "$DOCKER_USERNAME" --password-stdin
|
|
- docker push mainflux/cassandra-writer:latest
|
|
- docker push mainflux/influxdb-writer:latest
|
|
- docker push mainflux/mongodb-writer:latest
|
|
- docker push mainflux/postgres-writer:latest
|
|
- docker push mainflux/timescale-writer:latest
|
|
- docker push mainflux/smtp-notifier:latest
|
|
secrets:
|
|
- name: docker_hub
|
|
- name: Lint and Test CLI
|
|
run:
|
|
when: "change_in(['cli', 'cmd/cli'])"
|
|
dependencies:
|
|
- Setup
|
|
- Check Generated Protocol Buffer Files
|
|
task:
|
|
jobs:
|
|
- name: Lint CLI
|
|
commands:
|
|
- cd cli
|
|
- cache restore linter
|
|
- "./bin/golangci-lint run"
|
|
- name: Test CLI
|
|
commands:
|
|
- cd cli
|
|
- go test ./... --race -v -coverprofile=coverage.out
|
|
- go tool cover -html=coverage.out -o coverage.html
|
|
- cache restore codecov
|
|
- ./codecov
|
|
secrets:
|
|
- name: codecov
|
|
- name: Build CLI
|
|
dependencies:
|
|
- Lint and Test CLI
|
|
run:
|
|
when: "change_in(['cli', 'cmd/cli'])"
|
|
task:
|
|
jobs:
|
|
- name: Build CLI
|
|
commands:
|
|
- echo $DOCKER_TOKEN | docker login --username "$DOCKER_USERNAME" --password-stdin
|
|
- docker push mainflux/cli:latest
|
|
secrets:
|
|
- name: docker_hub
|
|
- name: Lint and Test LoRa
|
|
run:
|
|
when: "change_in(['lora', 'cmd/lora'])"
|
|
dependencies:
|
|
- Setup
|
|
- Check Generated Protocol Buffer Files
|
|
task:
|
|
jobs:
|
|
- name: Lint LoRa
|
|
commands:
|
|
- cd lora
|
|
- cache restore linter
|
|
- "./bin/golangci-lint run"
|
|
- name: Test LoRa
|
|
commands:
|
|
- cd lora
|
|
- go test ./... --race -v -coverprofile=coverage.out
|
|
- go tool cover -html=coverage.out -o coverage.html
|
|
- cache restore codecov
|
|
- ./codecov
|
|
secrets:
|
|
- name: codecov
|
|
- name: Build LoRa
|
|
dependencies:
|
|
- Lint and Test LoRa
|
|
run:
|
|
when: "change_in(['lora', 'cmd/lora'])"
|
|
task:
|
|
jobs:
|
|
- name: Build LoRa
|
|
commands:
|
|
- echo $DOCKER_TOKEN | docker login --username "$DOCKER_USERNAME" --password-stdin
|
|
- docker push mainflux/lora:latest
|
|
secrets:
|
|
- name: docker_hub
|
|
- name: Lint and Test OPC-UA
|
|
run:
|
|
when: "change_in(['/opcua', 'cmd/opcua', 'things/api/grpc', 'auth/service.go', 'auth/api/grpc/client.go'])"
|
|
dependencies:
|
|
- Setup
|
|
- Check Generated Protocol Buffer Files
|
|
task:
|
|
jobs:
|
|
- name: Lint OPC-UA
|
|
commands:
|
|
- cd opcua
|
|
- cache restore linter
|
|
- "./bin/golangci-lint run"
|
|
- name: Test OPC-UA
|
|
commands:
|
|
- cd opcua
|
|
- go test ./... --race -v -coverprofile=coverage.out
|
|
- go tool cover -html=coverage.out -o coverage.html
|
|
- cache restore codecov
|
|
- ./codecov
|
|
secrets:
|
|
- name: codecov
|
|
- name: Build OPC-UA
|
|
dependencies:
|
|
- Lint and Test OPC-UA
|
|
run:
|
|
when: "change_in(['/opcua', 'cmd/opcua'])"
|
|
task:
|
|
jobs:
|
|
- name: Build OPC-UA
|
|
commands:
|
|
- echo $DOCKER_TOKEN | docker login --username "$DOCKER_USERNAME" --password-stdin
|
|
- docker push mainflux/opcua:latest
|
|
secrets:
|
|
- name: docker_hub
|
|
- name: Lint and Test Internal
|
|
run:
|
|
when: "change_in('/internal')"
|
|
dependencies:
|
|
- Setup
|
|
- Check Generated Protocol Buffer Files
|
|
task:
|
|
jobs:
|
|
- name: Lint Internal
|
|
commands:
|
|
- cd internal
|
|
- cache restore linter
|
|
- "./bin/golangci-lint run"
|
|
- name: Test Internal
|
|
commands:
|
|
- cd internal
|
|
- go test ./... --race -v -coverprofile=coverage.out
|
|
- go tool cover -html=coverage.out -o coverage.html
|
|
- cache restore codecov
|
|
- ./codecov
|
|
- name: Lint and Test Logger
|
|
run:
|
|
when: "change_in('/logger')"
|
|
dependencies:
|
|
- Setup
|
|
- Check Generated Protocol Buffer Files
|
|
task:
|
|
jobs:
|
|
- name: Lint Logger
|
|
commands:
|
|
- cd logger
|
|
- cache restore linter
|
|
- "./bin/golangci-lint run"
|
|
- name: Test Logger
|
|
commands:
|
|
- cd logger
|
|
- go test ./... --race -v -coverprofile=coverage.out
|
|
- go tool cover -html=coverage.out -o coverage.html
|
|
- cache restore codecov
|
|
- ./codecov
|
|
- name: Lint and Test PKG
|
|
run:
|
|
when: "change_in('/pkg')"
|
|
dependencies:
|
|
- Setup
|
|
- Check Generated Protocol Buffer Files
|
|
task:
|
|
jobs:
|
|
- name: Lint PKG
|
|
commands:
|
|
- cd pkg
|
|
- cache restore linter
|
|
- "./bin/golangci-lint run"
|
|
- name: Test PKG
|
|
commands:
|
|
- cd pkg
|
|
- go test ./... --race -v -coverprofile=coverage.out
|
|
- go tool cover -html=coverage.out -o coverage.html
|
|
- cache restore codecov
|
|
- ./codecov
|
|
- name: Lint and Test Tools
|
|
run:
|
|
when: "change_in('/tools')"
|
|
dependencies:
|
|
- Setup
|
|
- Check Generated Protocol Buffer Files
|
|
task:
|
|
jobs:
|
|
- name: Lint Tools
|
|
commands:
|
|
- cd tools
|
|
- cache restore linter
|
|
- "./bin/golangci-lint run"
|
|
- name: Test Tools
|
|
commands:
|
|
- cd tools
|
|
- go test ./... --race -v -coverprofile=coverage.out
|
|
- go tool cover -html=coverage.out -o coverage.html
|
|
- cache restore codecov
|
|
- ./codecov
|
|
- name: Compile Check For RabbitMQ
|
|
dependencies:
|
|
- Setup
|
|
task:
|
|
jobs:
|
|
- name: Compile For RabbitMQ
|
|
commands:
|
|
- MF_MESSAGE_BROKER_TYPE=rabbitmq make mqtt
|
|
|
|
- name: Compile Check For Redis
|
|
dependencies:
|
|
- Setup
|
|
task:
|
|
jobs:
|
|
- name: Compile For Redis
|
|
commands:
|
|
- MF_ES_STORE_TYPE=redis make mqtt
|