-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
1,517 additions
and
765 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,8 @@ | |
# | ||
# Copyright (c) 2022 AlertAvert.com. All rights reserved. | ||
# Author: Marco Massenzio ([email protected]) | ||
#name: Build | ||
# | ||
name: Build & Test | ||
|
||
on: | ||
push: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,59 @@ | ||
# Copyright (c) 2022 AlertAvert.com. All rights reserved. | ||
# (Reluctantly) Created by M. Massenzio, 2022-03-14 | ||
# Created by M. Massenzio, 2022-03-14 | ||
|
||
pkgs := ./api ./grpc ./pubsub ./server ./storage | ||
bin := build/bin | ||
out := $(bin)/sm-server | ||
tag := $(shell ./get-tag) | ||
image := massenz/statemachine | ||
module := $(shell go list -m) | ||
|
||
compose := docker/docker-compose.yaml | ||
dockerfile := docker/Dockerfile | ||
|
||
build: cmd/main.go | ||
go build -ldflags "-X main.Release=$(tag)" -o $(out) cmd/main.go | ||
# Source files & Test files definitions | ||
# | ||
# Edit only the packages list, when adding new functionality, | ||
# the rest is deduced automatically. | ||
# | ||
pkgs := ./api ./grpc ./pubsub ./server ./storage | ||
all_go := $(shell for d in $(pkgs); do find $$d -name "*.go"; done) | ||
test_srcs := $(shell for d in $(pkgs); do find $$d -name "*_test.go"; done) | ||
srcs := $(filter-out $(test_srcs),$(all_go)) | ||
|
||
# Builds the server | ||
# | ||
$(out): cmd/main.go $(srcs) | ||
go build -ldflags "-X $(module)/server.Release=$(tag)" -o $(out) cmd/main.go | ||
@chmod +x $(out) | ||
|
||
$(out): build | ||
build: $(out) | ||
|
||
# Convenience targets to run locally containers and | ||
# setup the test environments. | ||
# | ||
# TODO: will be replaced once we adopt TestContainers | ||
# (see Issue # 26) | ||
services: | ||
@docker-compose -f $(compose) up -d | ||
|
||
queues: | ||
@for queue in events notifications; do \ | ||
aws --no-cli-pager --endpoint-url=http://localhost:4566 --region us-west-2 \ | ||
aws --no-cli-pager --endpoint-url=http://localhost:4566 \ | ||
--region us-west-2 \ | ||
sqs create-queue --queue-name $$queue; done >/dev/null | ||
|
||
test: $(out) services queues | ||
ginkgo -p $(pkgs) | ||
test: $(srcs) $(test_srcs) services queues | ||
ginkgo $(pkgs) | ||
|
||
container: $(out) | ||
docker build -f $(dockerfile) -t $(image):$(tag) . | ||
|
||
# Runs test coverage and displays the results in browser | ||
cov: build services queues | ||
cov: $(srcs) $(test_srcs) | ||
@go test -coverprofile=/tmp/cov.out $(pkgs) | ||
@go tool cover -html=/tmp/cov.out | ||
|
||
clean: | ||
@rm $(out) | ||
@rm -f $(out) | ||
@docker-compose -f $(compose) down | ||
@docker rmi $(image):$(tag) | ||
@docker rmi $(shell docker images -q --filter=reference=$(image)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# Build configuration | ||
|
||
version = 0.5.1 | ||
version = 0.6.0 | ||
|
Oops, something went wrong.