mirror of
https://github.com/absmach/magistrala.git
synced 2026-06-23 04:10:28 +00:00
MF-1830 - Switch to Semaphore 2.0 (#1829)
* Add pipeline Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> * Add pipeline Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> * Add Docker secret Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> * Remove function Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> * Remove function Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> * Modify block code Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> * Remove coverage on test block Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> * Fixes Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> * Update badge Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> * Remove repeated tests' Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> * Fix typo Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> * Fix typo Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> * Modify docker secrets Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> * Push docker images Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> --------- Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> Co-authored-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
This commit is contained in:
committed by
GitHub
parent
315c17628d
commit
2b78902e01
@@ -0,0 +1,711 @@
|
||||
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.20
|
||||
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_TOKEN
|
||||
- name: Check Generated Protocol Buffer Files
|
||||
dependencies: []
|
||||
run:
|
||||
when: "change_in(['things/policies/auth.proto', 'users/policies/auth.proto', 'pkg/messaging/message.proto'])"
|
||||
task:
|
||||
jobs:
|
||||
- name: Check Generated Protocol Buffer Files
|
||||
commands:
|
||||
- PROTOC_VERSION=23.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 users/policies/*.pb.go); do
|
||||
mv $p $p.tmp
|
||||
done
|
||||
for p in $(ls things/policies/*.pb.go); do
|
||||
mv $p $p.tmp
|
||||
done
|
||||
for p in $(ls pkg/messaging/*.pb.go); do
|
||||
mv $p $p.tmp
|
||||
done
|
||||
- protoc -I. --go_out=. --go_opt=paths=source_relative pkg/messaging/*.proto
|
||||
- protoc -I. --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative users/policies/*.proto
|
||||
- protoc -I. --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative things/policies/*.proto
|
||||
- |
|
||||
for p in $(ls users/policies/*.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 things/policies/*.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', 'things/policies/postgres/policies.go', 'things/policies/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 --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
|
||||
- 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_TOKEN
|
||||
- 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', 'things/policies/postgres/policies.go', 'things/policies/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 --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
|
||||
- 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_TOKEN
|
||||
- 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/policies/postgres/policies.go', 'things/policies/api/grpc/client.go', 'things/policies/service.go'])"
|
||||
dependencies:
|
||||
- Setup
|
||||
- Check Generated Protocol Buffer Files
|
||||
task:
|
||||
jobs:
|
||||
- name: Lint CoAP
|
||||
commands:
|
||||
- cd coap
|
||||
- cache restore linter
|
||||
- './bin/golangci-lint run --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
|
||||
- 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_TOKEN
|
||||
- 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/policies/postgres', 'things/policies/service.go'])"
|
||||
dependencies:
|
||||
- Setup
|
||||
- Check Generated Protocol Buffer Files
|
||||
task:
|
||||
jobs:
|
||||
- name: Lint HTTP
|
||||
commands:
|
||||
- cd http
|
||||
- cache restore linter
|
||||
- './bin/golangci-lint run --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
|
||||
- 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_TOKEN
|
||||
- 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/policies/postgres', 'things/policies/service.go','things/policies/postgres/policies.go', 'things/policies/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 --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
|
||||
- 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_TOKEN
|
||||
- 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/policies/postgres/policies.go', 'things/policies/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 --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
|
||||
- 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_TOKEN
|
||||
- name: Build WS
|
||||
dependencies:
|
||||
- Lint and Test WS
|
||||
run:
|
||||
when: "change_in(['ws', 'cmd/ws','things/policies/postgres', 'things/policies/service.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 --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
|
||||
- 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_TOKEN
|
||||
- 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/policies/postgres/policies.go', 'things/policies/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 --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
|
||||
- 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_TOKEN
|
||||
- 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 --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
|
||||
- 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_TOKEN
|
||||
- name: Build Provision
|
||||
dependencies:
|
||||
- Lint and Test Provision
|
||||
run:
|
||||
when: "change_in(['provision', 'cmd/provision','things/policies/postgres/policies.go', 'things/policies/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/policies/postgres/policies.go', 'things/policies/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 --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
|
||||
- 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_TOKEN
|
||||
- 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','things/policies/postgres/policies.go', 'things/policies/api/grpc/client.go', 'cmd/cassandra-reader', 'cmd/influxdb-reader', 'cmd/mongodb-reader', 'cmd/postgres-reader', 'cmd/timescale-reader', 'things/policies/service.go'])"
|
||||
dependencies:
|
||||
- Setup
|
||||
- Check Generated Protocol Buffer Files
|
||||
task:
|
||||
jobs:
|
||||
- name: Lint Readers
|
||||
commands:
|
||||
- cd readers
|
||||
- cache restore linter
|
||||
- './bin/golangci-lint run --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
|
||||
- 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_TOKEN
|
||||
- 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' ])"
|
||||
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','things/policies/postgres/policies.go', 'things/policies/api/grpc/client.go', 'cmd/cassandra-writer', 'cmd/influxdb-writer', 'cmd/mongodb-writer', 'cmd/postgres-writer', 'cmd/timescale-writer', 'cmd/smpp-notifier', 'cmd/smtp-notifier'])"
|
||||
dependencies:
|
||||
- Setup
|
||||
- Check Generated Protocol Buffer Files
|
||||
task:
|
||||
jobs:
|
||||
- name: Lint Consumers
|
||||
commands:
|
||||
- cd consumers
|
||||
- cache restore linter
|
||||
- './bin/golangci-lint run --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
|
||||
- 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_TOKEN
|
||||
- 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'])"
|
||||
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 --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
|
||||
- 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_TOKEN
|
||||
- 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 --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
|
||||
- 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_TOKEN
|
||||
- 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/policies/postgres/policies.go', 'things/policies/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 --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
|
||||
- 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_TOKEN
|
||||
- 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 --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
|
||||
- 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 --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
|
||||
- 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 --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
|
||||
- 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 --no-config --disable-all --enable gosimple,errcheck,govet,unused,goconst,godot --timeout 3m'
|
||||
- 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_BROKER_TYPE=rabbitmq make mqtt
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Mainflux
|
||||
|
||||
[![build][ci-badge]][ci-url]
|
||||
[](https://mainflux.semaphoreci.com/projects/mainflux)
|
||||
[![go report card][grc-badge]][grc-url]
|
||||
[![coverage][cov-badge]][cov-url]
|
||||
[![license][license]](LICENSE)
|
||||
|
||||
Reference in New Issue
Block a user