initial tests, test on push, makefile

This commit is contained in:
Mark Chmarny 2020-06-17 07:07:14 -07:00
parent 2435f0b342
commit 4ed987ab1e
9 changed files with 126 additions and 26 deletions

47
.github/workflows/release-on-tag.yaml vendored Normal file
View File

@ -0,0 +1,47 @@
name: Release
on:
push:
tags:
- 'v*' # v0.8.1
jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Setup
id: go
uses: actions/setup-go@v2
with:
go-version: ^1.14
- name: Checkout
id: setup
uses: actions/checkout@v2
- name: Tidy
run: |
go mod tidy
go mod vendor
- name: Test
run: go test -v -count=1 -race ./...
- name: Version
id: get_version
run: echo ::set-env name=RELEASE_VERSION::$(echo ${GITHUB_REF:10})
- name: Release
id: release-step
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: Automatic go Dapr client release
draft: false
prerelease: false

31
.github/workflows/test-on-push.yaml vendored Normal file
View File

@ -0,0 +1,31 @@
name: Test
on:
push:
jobs:
build:
name: Test Push
runs-on: ubuntu-latest
steps:
- name: Setup
id: go
uses: actions/setup-go@v2
with:
go-version: ^1.14
- name: Checkout
id: setup
uses: actions/checkout@v2
- name: Tidy
run: |
go mod tidy
go mod vendor
- name: Test
run: go test -v -count=1 -race ./...

41
Makefile Normal file
View File

@ -0,0 +1,41 @@
RELEASE_VERSION =v0.8.0
.PHONY: mod test service client lint protps tag lint clean, help
all: test
protps: ## Downloads proto files from dapr/dapr, generates gRPC clients
bin/protogen
mod: ## Updates the go modules
go mod tidy
test: mod ## Tests the entire project
go test -v -count=1 -race ./...
# go test -v -count=1 -run TestInvokeServiceWithContent ./...
service: mod ## Runs the uncompiled example service code
dapr run --app-id serving \
--protocol grpc \
--app-port 50001 \
go run example/serving/main.go
client: mod ## Runs the uncompiled example client code
dapr run --app-id caller \
--components-path example/client/comp \
go run example/client/main.go
lint: ## Lints the entire project
golangci-lint run --timeout=3m
tag: ## Creates release tag
git tag $(RELEASE_VERSION)
git push origin $(RELEASE_VERSION)
clean: ## Cleans go and generated files in ./dapr/proto/
go clean
rm -fr ./dapr/proto/common/v1/*
rm -fr ./dapr/proto/runtime/v1/*
help: ## Display available commands
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk \
'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

View File

@ -16,12 +16,17 @@ The `example` folder contains a Dapr enabled `serving` app a `client` app that u
```
cd example/serving
dapr run --app-id serving --protocol grpc --app-port 50001 go run main.go
dapr run --app-id serving \
--protocol grpc \
--app-port 50001 \
go run main.go
```
2. Start the `client` app in the `example/client` directory
```
cd example/client
dapr run --app-id caller go run main.go --components-path ./components
dapr run --app-id caller \
--components-path ./comp \
go run main.go
```

View File

@ -1,11 +0,0 @@
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: messagebus
spec:
type: pubsub.redis
metadata:
- name: redisHost
value: localhost:6379
- name: redisPassword
value: ""

View File

@ -1,13 +0,0 @@
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: statestore
spec:
type: state.redis
metadata:
- name: redisHost
value: localhost:6379
- name: redisPassword
value: ""
- name: actorStateStore
value: "true"