Skip to content
This repository has been archived by the owner on Mar 17, 2023. It is now read-only.

frantjc/grpc #35

Merged
merged 2 commits into from
Mar 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@ ARG prerelease=
ARG commit=
ARG repository=frantjc/sequence
ARG tag=latest
RUN go build -ldflags "-s -w -X github.com/frantjc/sequence/meta.Version=${version} -X github.com/frantjc/sequence/meta.Prerelease=${prerelease} -X github.com/frantjc/sequence/meta.Build=${commit} -X github.com/frantjc/sequence/meta.Repository=${repository} -X github.com/frantjc/sequence/meta.Tag=${tag} -X github.com/frantjc/sequence/meta.Digest=${digest}" -o /usr/local/bin ./cmd/sequence
RUN go build -ldflags "-s -w -X github.com/frantjc/sequence/meta.Version=${version} -X github.com/frantjc/sequence/meta.Prerelease=${prerelease} -X github.com/frantjc/sequence/meta.Build=${commit} -X github.com/frantjc/sequence/meta.Repository=${repository} -X github.com/frantjc/sequence/meta.Tag=${tag} -X github.com/frantjc/sequence/meta.Digest=${digest}" -o /usr/local/bin ./cmd/sqnc
RUN go build -ldflags "-s -w -X github.com/frantjc/sequence/meta.Version=${version} -X github.com/frantjc/sequence/meta.Prerelease=${prerelease} -X github.com/frantjc/sequence/meta.Build=${commit} -X github.com/frantjc/sequence/meta.Repository=${repository} -X github.com/frantjc/sequence/meta.Tag=${tag} -X github.com/frantjc/sequence/meta.Digest=${digest}" -o /usr/local/bin ./cmd/sqncshim
RUN set -e; for pkg in $(go list ./...); do \
go test -ldflags "-s -w -X github.com/frantjc/sequence/meta.Version=${version} -X github.com/frantjc/sequence/meta.Prerelease=${prerelease} -X github.com/frantjc/sequence/meta.Build=${commit} -X github.com/frantjc/sequence/meta.Repository=${repository} -X github.com/frantjc/sequence/meta.Tag=${tag} -X github.com/frantjc/sequence/meta.Digest=${digest}" -o /usr/local/test/bin/$(basename $pkg).test -c $pkg; \
done

FROM base AS sequence
COPY --from=bin /usr/local/bin/sqnc /usr/local/bin
ENTRYPOINT ["sqnc"]
COPY --from=bin /usr/local/bin /usr/local/bin
ENTRYPOINT ["sequence"]

FROM sequence AS test
COPY --from=bin /usr/local/test/bin /usr/local/test/bin
ARG SQNC_E2E
RUN set -e; for test in /usr/local/test/bin/*.test; do \
$test; \
done
Expand Down
20 changes: 13 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,28 @@ REPOSITORY ?= frantjc/sequence
MODULE ?= github.com/$(REPOSITORY)
TAG ?= latest

E2E ?= yes

DOCKER ?= docker

BUILD_ARGS ?= --build-arg repository=$(REPOSITORY) --build-arg SQNC_E2E=$(E2E) --build-arg tag=$(TAG) --build-arg commit=$(COMMIT)
BUILD_ARGS ?= --build-arg repository=$(REPOSITORY) --build-arg tag=$(TAG) --build-arg commit=$(COMMIT)

PROTOS ?= $(shell find . -type f -name *.proto)
PROTOC_ARGS ?= --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative

INSTALL ?= sudo install

.DEFAULT: sqnc

sqnc:
sequence sqnc sqncshim:
$(GO) build -ldflags "-s -w -X github.com/frantjc/sequence/meta.Build=$(COMMIT) -X github.com/frantjc/sequence/meta.Repository=$(REPOSITORY) -X github.com/frantjc/sequence/meta.Tag=$(TAG)" -o ./bin $(CURDIR)/cmd/$@
sudo install $(CURDIR)/bin/$@ $(BIN)
$(INSTALL) $(CURDIR)/bin/$@ $(BIN)

image img:
$(DOCKER) build -t $(REGISTRY)/$(REPOSITORY):$(TAG) $(BUILD_ARGS) .

test: image
$(DOCKER) build -t $(REGISTRY)/$(REPOSITORY):test $(BUILD_ARGS) --target=test .

bin bins binaries: sqnc
bin bins binaries: sequence sqnc

fmt lint pretty:
$(GO) fmt ./...
Expand All @@ -47,4 +50,7 @@ clean:
rm -rf bin/* vendor
docker system prune --volumes -a --filter label=sequence=true

.PHONY: sqnc image img test bin bins binaries fmt lint pretty vet vendor clean
protos:
protoc $(PROTOC_ARGS) $(PROTOS)

.PHONY: sequence sqnc image img test bin bins binaries fmt lint pretty vet vendor clean protos
1 change: 1 addition & 0 deletions api/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package api
1 change: 1 addition & 0 deletions api/types/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package types
149 changes: 149 additions & 0 deletions api/types/job.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions api/types/job.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
syntax = "proto3";

package sequence.types;

import "api/types/step.proto";

option go_package = "github.com/frantjc/sequence/api/types";

message Job {
repeated sequence.types.Step steps = 1;
}
144 changes: 144 additions & 0 deletions api/types/log.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions api/types/log.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
syntax = "proto3";

package sequence.types;

option go_package = "github.com/frantjc/sequence/api/types";

message Log {
string line = 1;
}
Loading