Skip to content

Commit

Permalink
Implement stripe daemon and gRPC server with initial subset of comm…
Browse files Browse the repository at this point in the history
…ands (stripe#646)

stripe#638 add stripe daemon command, auth, docs generation, CI, and Version method
stripe#647 implement SamplesList method
stripe#648 implement SampleConfigs method
stripe#658 implement SampleCreate method
stripe#655 implement Login and LoginStatus methods
stripe#659 implement TriggersList method
stripe#663 implement Trigger method
stripe#667 implement LogsTail method
stripe#669 implement EventsResend method
stripe#676 implement Listen method
stripe#677 return UNAUTHENTICATED error code for some commands
stripe#678 write debug logs when methods are invoked
  • Loading branch information
vcheung-stripe authored May 24, 2021
1 parent 18da08e commit b9d4223
Show file tree
Hide file tree
Showing 69 changed files with 9,446 additions and 58 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ jobs:
uses: actions/checkout@v2
- name: Run Setup
run: make setup
- name: Install protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install protoc deps
run: |
go get github.com/golang/protobuf/protoc-gen-go
go get github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc
shell: bash
- name: Run Tests
run: make ci
shell: bash
46 changes: 44 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
SOURCE_FILES?=./...
TEST_PATTERN?=.
TEST_OPTIONS?=
PROTOC_FAILURE_MESSAGE="\nFailed to compile protobuf files: protoc exited with code $$?. Ensure you have the latest version of protoc: https://grpc.io/docs/protoc-installation/\n"

export GO111MODULE := on
export GOBIN := $(shell pwd)/bin
Expand Down Expand Up @@ -29,7 +30,7 @@ cover: test

# gofmt and goimports all go files
fmt:
find . -name '*.go' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done
find . -path ./rpc -prune -false -o -name '*.go' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done
.PHONY: fmt

# Run all the linters
Expand All @@ -49,7 +50,7 @@ go-mod-tidy:
.PHONY: go-mod-tidy

# Run all the tests and code checks
ci: build-all-platforms test lint go-mod-tidy
ci: build-all-platforms test lint go-mod-tidy protoc-ci
.PHONY: ci

# Build a beta version of stripe
Expand Down Expand Up @@ -111,4 +112,45 @@ clean:
rm -rf dist/
.PHONY: clean

# Handle all protobuf generation.
protoc:
@go get github.com/golang/protobuf/protoc-gen-go
@go get github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc
@go mod tidy
make protoc-gen-all
.PHONY: protoc

# Generate all files from protobuf definitions and compare against head.
# Because protoc comments its version in the files, ignore comments when
# diffing to avoid false positives.
protoc-ci: protoc-gen-all
@git diff HEAD
@git diff-index -G"^[^\/]|^[\/][^\/]" --quiet HEAD
.PHONY: proto-ci

protoc-gen-all: protoc-gen-code protoc-gen-docs
.PHONY: protoc-gen-all

# Generate protobuf go code
protoc-gen-code:
@protoc \
--go_out=plugins=grpc:./rpc \
--go_opt=module=github.com/stripe/stripe-cli/rpc \
--proto_path ./rpc \
./rpc/*.proto \
|| (printf ${PROTOC_FAILURE_MESSAGE}; exit 1)
@echo "Successfully compiled proto files"
.PHONY: protoc-compile

# Generate protobuf docs
protoc-gen-docs:
@protoc \
--doc_out=./docs/rpc \
--doc_opt=markdown,commands.md \
--proto_path ./rpc \
./rpc/*.proto \
|| (printf ${PROTOC_FAILURE_MESSAGE}; exit 1)
@echo "Successfully generated proto docs"
.PHONY: protoc-docs

.DEFAULT_GOAL := build
Loading

0 comments on commit b9d4223

Please sign in to comment.