2023-07-26 17:27:11 +03:00
|
|
|
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
|
2023-10-16 12:46:07 +03:00
|
|
|
- sem-version go 1.21
|
2023-07-26 17:27:11 +03:00
|
|
|
blocks:
|
|
|
|
- name: Setup
|
|
|
|
dependencies: []
|
|
|
|
task:
|
|
|
|
jobs:
|
|
|
|
- name: Setup Codecov
|
|
|
|
commands:
|
2023-10-24 18:22:53 +03:00
|
|
|
- "curl -Os https://uploader.codecov.io/latest/linux/codecov"
|
2023-07-26 17:27:11 +03:00
|
|
|
- chmod +x codecov
|
|
|
|
- ./codecov
|
|
|
|
- cache store codecov ./codecov
|
|
|
|
- name: Setup Golangci-lint
|
|
|
|
commands:
|
2023-10-24 18:22:53 +03:00
|
|
|
- "curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.53.3"
|
2023-07-26 17:27:11 +03:00
|
|
|
- cache store linter ./bin/golangci-lint
|
|
|
|
secrets:
|
2023-10-16 12:55:10 +02:00
|
|
|
- name: codecov
|
2023-07-26 17:27:11 +03:00
|
|
|
- name: Check Generated Protocol Buffer Files
|
|
|
|
dependencies: []
|
|
|
|
run:
|
2023-10-16 12:55:10 +02:00
|
|
|
when: "change_in(['./auth.proto', 'pkg/messaging/message.proto'])"
|
2023-07-26 17:27:11 +03:00
|
|
|
task:
|
|
|
|
jobs:
|
|
|
|
- name: Check Generated Protocol Buffer Files
|
|
|
|
commands:
|
2023-10-16 12:55:10 +02:00
|
|
|
- PROTOC_VERSION=24.3
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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
|
2023-10-24 18:22:53 +03:00
|
|
|
|
2023-07-26 17:27:11 +03:00
|
|
|
- export PATH=$PATH:/usr/local/bin/protoc
|
|
|
|
- export PATH=$PATH:$HOME/go/bin
|
2023-10-24 18:22:53 +03:00
|
|
|
|
2023-07-26 17:27:11 +03:00
|
|
|
- |
|
|
|
|
echo "Setting up Mainflux..."
|
2023-10-16 12:55:10 +02:00
|
|
|
for p in $(ls ./*.pb.go); do
|
2023-07-26 17:27:11 +03:00
|
|
|
mv $p $p.tmp
|
|
|
|
done
|
|
|
|
for p in $(ls pkg/messaging/*.pb.go); do
|
|
|
|
mv $p $p.tmp
|
|
|
|
done
|
2023-10-16 12:55:10 +02:00
|
|
|
- make proto
|
2023-07-26 17:27:11 +03:00
|
|
|
- |
|
2023-10-16 12:55:10 +02:00
|
|
|
for p in $(ls ./*.pb.go); do
|
2023-07-26 17:27:11 +03:00
|
|
|
if ! cmp -s $p $p.tmp; then
|
|
|
|
echo "Proto file and generated Go file $p are out of sync!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
2023-10-24 18:22:53 +03:00
|
|
|
- |
|
2023-07-26 17:27:11 +03:00
|
|
|
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:
|
2023-10-16 12:55:10 +02:00
|
|
|
when: "change_in(['users', 'cmd/users', 'auth/service.go', 'auth/api/grpc/client.go'])"
|
2023-07-26 17:27:11 +03:00
|
|
|
dependencies:
|
|
|
|
- Setup
|
|
|
|
- Check Generated Protocol Buffer Files
|
|
|
|
task:
|
|
|
|
jobs:
|
|
|
|
- name: Lint Users
|
|
|
|
commands:
|
|
|
|
- cd users
|
|
|
|
- cache restore linter
|
2023-10-24 18:22:53 +03:00
|
|
|
- "./bin/golangci-lint run"
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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:
|
2023-10-16 12:55:10 +02:00
|
|
|
- name: codecov
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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:
|
2023-10-24 18:22:53 +03:00
|
|
|
- name: docker_hub
|
2023-07-26 17:27:11 +03:00
|
|
|
- name: Lint and Test Things
|
|
|
|
run:
|
2023-10-16 12:55:10 +02:00
|
|
|
when: "change_in(['things', 'cmd/things', 'auth/service.go', 'auth/api/grpc/client.go'])"
|
2023-07-26 17:27:11 +03:00
|
|
|
dependencies:
|
|
|
|
- Setup
|
|
|
|
- Check Generated Protocol Buffer Files
|
|
|
|
task:
|
|
|
|
jobs:
|
|
|
|
- name: Lint Things
|
|
|
|
commands:
|
|
|
|
- cd things
|
|
|
|
- cache restore linter
|
2023-10-24 18:22:53 +03:00
|
|
|
- "./bin/golangci-lint run"
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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:
|
2023-10-16 12:55:10 +02:00
|
|
|
- name: codecov
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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:
|
2023-10-24 18:22:53 +03:00
|
|
|
- name: docker_hub
|
2023-07-26 17:27:11 +03:00
|
|
|
- name: Lint and Test CoAP
|
|
|
|
run:
|
2023-10-16 12:55:10 +02:00
|
|
|
when: "change_in(['coap', 'cmd/coap', 'things/api/grpc', 'auth/service.go', 'auth/api/grpc/client.go'])"
|
2023-07-26 17:27:11 +03:00
|
|
|
dependencies:
|
|
|
|
- Setup
|
|
|
|
- Check Generated Protocol Buffer Files
|
|
|
|
task:
|
|
|
|
jobs:
|
|
|
|
- name: Lint CoAP
|
|
|
|
commands:
|
|
|
|
- cd coap
|
|
|
|
- cache restore linter
|
2023-10-24 18:22:53 +03:00
|
|
|
- "./bin/golangci-lint run"
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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:
|
2023-10-16 12:55:10 +02:00
|
|
|
- name: codecov
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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:
|
2023-10-24 18:22:53 +03:00
|
|
|
- name: docker_hub
|
2023-07-26 17:27:11 +03:00
|
|
|
- name: Lint and Test HTTP
|
|
|
|
run:
|
2023-10-16 12:55:10 +02:00
|
|
|
when: "change_in(['http', 'cmd/http', 'things/api/grpc', 'auth/service.go', 'auth/api/grpc/client.go'])"
|
2023-07-26 17:27:11 +03:00
|
|
|
dependencies:
|
|
|
|
- Setup
|
|
|
|
- Check Generated Protocol Buffer Files
|
|
|
|
task:
|
|
|
|
jobs:
|
|
|
|
- name: Lint HTTP
|
|
|
|
commands:
|
|
|
|
- cd http
|
|
|
|
- cache restore linter
|
2023-10-24 18:22:53 +03:00
|
|
|
- "./bin/golangci-lint run"
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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:
|
2023-10-16 12:55:10 +02:00
|
|
|
- name: codecov
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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:
|
2023-10-24 18:22:53 +03:00
|
|
|
- name: docker_hub
|
2023-07-26 17:27:11 +03:00
|
|
|
- name: Lint and Test MQTT
|
|
|
|
run:
|
2023-10-16 12:55:10 +02:00
|
|
|
when: "change_in(['mqtt', 'cmd/mqtt', 'things/api/grpc', 'auth/service.go', 'auth/api/grpc/client.go'])"
|
2023-07-26 17:27:11 +03:00
|
|
|
dependencies:
|
|
|
|
- Setup
|
|
|
|
- Check Generated Protocol Buffer Files
|
|
|
|
task:
|
|
|
|
jobs:
|
|
|
|
- name: Lint MQTT
|
|
|
|
commands:
|
|
|
|
- cd mqtt
|
|
|
|
- cache restore linter
|
2023-10-24 18:22:53 +03:00
|
|
|
- "./bin/golangci-lint run"
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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:
|
2023-10-16 12:55:10 +02:00
|
|
|
- name: codecov
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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:
|
2023-10-24 18:22:53 +03:00
|
|
|
- name: docker_hub
|
2023-07-26 17:27:11 +03:00
|
|
|
- name: Lint and Test WS
|
|
|
|
run:
|
2023-10-16 12:55:10 +02:00
|
|
|
when: "change_in(['ws', 'cmd/ws', 'things/api/grpc', 'auth/service.go', 'auth/api/grpc/client.go'])"
|
2023-07-26 17:27:11 +03:00
|
|
|
dependencies:
|
|
|
|
- Setup
|
|
|
|
- Check Generated Protocol Buffer Files
|
|
|
|
task:
|
|
|
|
jobs:
|
|
|
|
- name: Lint WS
|
|
|
|
commands:
|
|
|
|
- cd ws
|
|
|
|
- cache restore linter
|
2023-10-24 18:22:53 +03:00
|
|
|
- "./bin/golangci-lint run"
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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:
|
2023-10-16 12:55:10 +02:00
|
|
|
- name: codecov
|
2023-07-26 17:27:11 +03:00
|
|
|
- name: Build WS
|
|
|
|
dependencies:
|
|
|
|
- Lint and Test WS
|
|
|
|
run:
|
2023-10-16 12:55:10 +02:00
|
|
|
when: "change_in(['ws', 'cmd/ws', 'things/api/grpc', 'auth/service.go', 'auth/api/grpc/client.go'])"
|
2023-07-26 17:27:11 +03:00
|
|
|
task:
|
|
|
|
jobs:
|
|
|
|
- name: Build WS
|
|
|
|
commands:
|
|
|
|
- echo $DOCKER_TOKEN | docker login --username "$DOCKER_USERNAME" --password-stdin
|
|
|
|
- docker push mainflux/ws:latest
|
|
|
|
secrets:
|
2023-10-24 18:22:53 +03:00
|
|
|
- name: docker_hub
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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
|
2023-10-24 18:22:53 +03:00
|
|
|
- "./bin/golangci-lint run"
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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:
|
2023-10-16 12:55:10 +02:00
|
|
|
- name: codecov
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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:
|
2023-10-24 18:22:53 +03:00
|
|
|
- name: docker_hub
|
2023-07-26 17:27:11 +03:00
|
|
|
- name: Lint and Test Certs
|
|
|
|
run:
|
2023-10-16 12:55:10 +02:00
|
|
|
when: "change_in(['certs', 'cmd/certs', 'things/api/grpc', 'auth/service.go', 'auth/api/grpc/client.go'])"
|
2023-07-26 17:27:11 +03:00
|
|
|
dependencies:
|
|
|
|
- Setup
|
|
|
|
- Check Generated Protocol Buffer Files
|
|
|
|
task:
|
|
|
|
jobs:
|
|
|
|
- name: Lint Certs
|
|
|
|
commands:
|
|
|
|
- cd certs
|
|
|
|
- cache restore linter
|
2023-10-24 18:22:53 +03:00
|
|
|
- "./bin/golangci-lint run"
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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:
|
2023-10-16 12:55:10 +02:00
|
|
|
- name: codecov
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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:
|
2023-10-24 18:22:53 +03:00
|
|
|
- name: docker_hub
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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
|
2023-10-24 18:22:53 +03:00
|
|
|
- "./bin/golangci-lint run"
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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:
|
2023-10-16 12:55:10 +02:00
|
|
|
- name: codecov
|
2023-07-26 17:27:11 +03:00
|
|
|
- name: Build Provision
|
|
|
|
dependencies:
|
|
|
|
- Lint and Test Provision
|
|
|
|
run:
|
2023-10-16 12:55:10 +02:00
|
|
|
when: "change_in(['provision', 'cmd/provision', 'things/api/grpc', 'auth/service.go', 'auth/api/grpc/client.go'])"
|
2023-07-26 17:27:11 +03:00
|
|
|
task:
|
|
|
|
jobs:
|
|
|
|
- name: Build Provision
|
|
|
|
commands:
|
|
|
|
- echo $DOCKER_TOKEN | docker login --username "$DOCKER_USERNAME" --password-stdin
|
|
|
|
- docker push mainflux/http:latest
|
|
|
|
secrets:
|
2023-10-24 18:22:53 +03:00
|
|
|
- name: docker_hub
|
2023-07-26 17:27:11 +03:00
|
|
|
- name: Lint and Test Twins
|
|
|
|
run:
|
2023-10-16 12:55:10 +02:00
|
|
|
when: "change_in(['twins', 'cmd/twins', 'things/api/grpc', 'auth/service.go', 'auth/api/grpc/client.go'])"
|
2023-07-26 17:27:11 +03:00
|
|
|
dependencies:
|
|
|
|
- Setup
|
|
|
|
- Check Generated Protocol Buffer Files
|
|
|
|
task:
|
|
|
|
jobs:
|
|
|
|
- name: Lint Twins
|
|
|
|
commands:
|
|
|
|
- cd twins
|
|
|
|
- cache restore linter
|
2023-10-24 18:22:53 +03:00
|
|
|
- "./bin/golangci-lint run"
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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:
|
2023-10-16 12:55:10 +02:00
|
|
|
- name: codecov
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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:
|
2023-10-24 18:22:53 +03:00
|
|
|
- name: docker_hub
|
2023-07-26 17:27:11 +03:00
|
|
|
- name: Lint and Test Readers
|
|
|
|
run:
|
2023-10-16 12:55:10 +02:00
|
|
|
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'])"
|
2023-07-26 17:27:11 +03:00
|
|
|
dependencies:
|
|
|
|
- Setup
|
|
|
|
- Check Generated Protocol Buffer Files
|
|
|
|
task:
|
|
|
|
jobs:
|
|
|
|
- name: Lint Readers
|
|
|
|
commands:
|
|
|
|
- cd readers
|
|
|
|
- cache restore linter
|
2023-10-24 18:22:53 +03:00
|
|
|
- "./bin/golangci-lint run"
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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:
|
2023-10-16 12:55:10 +02:00
|
|
|
- name: codecov
|
2023-07-26 17:27:11 +03:00
|
|
|
- name: Build Readers
|
|
|
|
dependencies:
|
|
|
|
- Lint and Test Readers
|
|
|
|
run:
|
2023-10-16 12:55:10 +02:00
|
|
|
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'])"
|
2023-07-26 17:27:11 +03:00
|
|
|
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:
|
2023-10-24 18:22:53 +03:00
|
|
|
- name: docker_hub
|
2023-07-26 17:27:11 +03:00
|
|
|
- name: Lint and Test Consumers
|
|
|
|
run:
|
2023-10-16 12:55:10 +02:00
|
|
|
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'])"
|
2023-07-26 17:27:11 +03:00
|
|
|
dependencies:
|
|
|
|
- Setup
|
|
|
|
- Check Generated Protocol Buffer Files
|
|
|
|
task:
|
|
|
|
jobs:
|
|
|
|
- name: Lint Consumers
|
|
|
|
commands:
|
|
|
|
- cd consumers
|
|
|
|
- cache restore linter
|
2023-10-24 18:22:53 +03:00
|
|
|
- "./bin/golangci-lint run"
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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:
|
2023-10-16 12:55:10 +02:00
|
|
|
- name: codecov
|
2023-07-26 17:27:11 +03:00
|
|
|
- name: Build Consumers
|
|
|
|
dependencies:
|
|
|
|
- Lint and Test Consumers
|
|
|
|
run:
|
2023-10-16 12:55:10 +02:00
|
|
|
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'])"
|
2023-07-26 17:27:11 +03:00
|
|
|
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:
|
2023-10-24 18:22:53 +03:00
|
|
|
- name: docker_hub
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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
|
2023-10-24 18:22:53 +03:00
|
|
|
- "./bin/golangci-lint run"
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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:
|
2023-10-16 12:55:10 +02:00
|
|
|
- name: codecov
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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:
|
2023-10-24 18:22:53 +03:00
|
|
|
- name: docker_hub
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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
|
2023-10-24 18:22:53 +03:00
|
|
|
- "./bin/golangci-lint run"
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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:
|
2023-10-16 12:55:10 +02:00
|
|
|
- name: codecov
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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:
|
2023-10-24 18:22:53 +03:00
|
|
|
- name: docker_hub
|
2023-07-26 17:27:11 +03:00
|
|
|
- name: Lint and Test OPC-UA
|
|
|
|
run:
|
2023-10-16 12:55:10 +02:00
|
|
|
when: "change_in(['/opcua', 'cmd/opcua', 'things/api/grpc', 'auth/service.go', 'auth/api/grpc/client.go'])"
|
2023-07-26 17:27:11 +03:00
|
|
|
dependencies:
|
|
|
|
- Setup
|
|
|
|
- Check Generated Protocol Buffer Files
|
|
|
|
task:
|
|
|
|
jobs:
|
|
|
|
- name: Lint OPC-UA
|
|
|
|
commands:
|
|
|
|
- cd opcua
|
|
|
|
- cache restore linter
|
2023-10-24 18:22:53 +03:00
|
|
|
- "./bin/golangci-lint run"
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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:
|
2023-10-16 12:55:10 +02:00
|
|
|
- name: codecov
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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:
|
2023-10-24 18:22:53 +03:00
|
|
|
- name: docker_hub
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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
|
2023-10-24 18:22:53 +03:00
|
|
|
- "./bin/golangci-lint run"
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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
|
2023-10-24 18:22:53 +03:00
|
|
|
- "./bin/golangci-lint run"
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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
|
2023-10-24 18:22:53 +03:00
|
|
|
- "./bin/golangci-lint run"
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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
|
2023-10-24 18:22:53 +03:00
|
|
|
- "./bin/golangci-lint run"
|
2023-07-26 17:27:11 +03:00
|
|
|
- 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:
|
NOISSUE - Make MQTT Broker Configurable (#1904)
* Minor changes on mqtt publisher using nats
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
* Remove vernemq dependencies
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
* Restore VerneMQ config files
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
* Fix Makefile to support custom Docker profiles
The Makefile has been updated to support custom Docker profiles.
Previously, the Makefile only supported the default profiles for the
message broker and MQTT broker. Now, the Makefile allows for custom
profiles to be specified using environment variables. If the
MF_BROKER_TYPE or MF_MQTT_BROKER_TYPE variables are not set, the
default values "nats" and "nats" will be used, respectively. This
change enables more flexibility in configuring the Docker environment
for the project.
The `run` target has also been modified to use the correct broker
configuration file based on the MF_BROKER_TYPE variable. The sed
command in the `run` target now replaces the placeholder in the
docker/docker-compose.yml file with the appropriate broker
configuration file.
This commit improves the Makefile to support custom Docker profiles
and ensures the correct broker configuration file is used when
running the project.
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
* Fix queue binding issue in RabbitMQ pubsub
The commit fixes an issue in the RabbitMQ pubsub implementation where the queue binding was not correctly set up. Instead of using the topic as the queue name, the commit now uses a unique client ID generated by combining the topic and subscriber ID. This ensures that each subscriber has its own dedicated queue. The commit also updates the queue binding to use the correct queue name.
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
* Refactor Docker config editing in Makefile
The commit refactors the `edit_docker_config` function in the Makefile to improve readability and maintainability. The changes include:
- Removing unnecessary conditionals related to the `rabbitmq` broker
These changes ensure that the Docker configuration is correctly updated based on the specified MQTT broker type.
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
* Fix failing tests on RabbitMQ
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
* Refactor MQTT_BROKER comment in docker-compose.yml
The MQTT_BROKER comment in the docker-compose.yml file has been updated to provide a more accurate description of its functionality. The comment now states that the MQTT_BROKER handles MQTT communication between MQTT adapters and the message broker, instead of Mainflux services. This change improves clarity and aligns with the actual purpose of the MQTT_BROKER.
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
* Rename `MF_BROKER` to `MF_MESSAGE_BROKER`
The Makefile and Semaphore configuration files have been refactored to update the variable names related to the message broker type.
These changes ensure consistency and clarity in the codebase by using more descriptive variable names related to the message broker type.
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
* Fix Docker profile configuration for nats_rabbitmq
Update the Docker profile configuration for nats_rabbitmq by replacing the NATS URL in the .env file with the correct value.
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
* Rename MF_BROKER_URL to MF_MESSAGE_BROKER_URL
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
* Fix MQTT QoS level in pubsub.go
The MQTT QoS level in the pubsub.go file was set to 1, which is the
default level. However, since NATS supports up to QoS 1, I updated the
QoS level comment to reflect this.
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
* Refactor NewPublisher to accept QoS parameter
The NewPublisher function in the pkg/messaging/mqtt/publisher.go file has been refactored to accept a new parameter, qos, which represents the Quality of Service level for MQTT message publishing. This change allows for more flexibility in configuring the MQTT publisher.
The NewPublisher function now has the following signature:
```go
func NewPublisher(address string, qos uint8, timeout time.Duration) (messaging.Publisher, error)
```
This change ensures that the MQTT publisher can be created with the desired QoS level, enhancing the reliability and delivery guarantees of the published messages.
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
* Fix test assertions in pubsub_test.go
The test assertions in the pubsub_test.go file were incorrect. This commit fixes the assertions to properly compare the expected and received message values.
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
* Test configurable MQTT broker
Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
---------
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
2023-10-19 22:01:09 +03:00
|
|
|
- MF_MESSAGE_BROKER_TYPE=rabbitmq make mqtt
|
2023-07-26 17:27:11 +03:00
|
|
|
|
2023-10-24 18:22:53 +03:00
|
|
|
- name: Compile Check For Redis
|
|
|
|
dependencies:
|
|
|
|
- Setup
|
|
|
|
task:
|
|
|
|
jobs:
|
|
|
|
- name: Compile For Redis
|
|
|
|
commands:
|
|
|
|
- MF_ES_STORE_TYPE=redis make mqtt
|