-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
109 lines (95 loc) · 3.01 KB
/
Taskfile.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
version: '3'
tasks:
codegen:
cmds:
- go run github.com/dkinzler/kit/codegen@latest {{.CLI_ARGS}}
test:
cmds:
- go test ./...
run-inmem:
cmds:
- go run ./cmd/api --inmem --debug {{.CLI_ARGS}}
run-emulators:
env:
FIREBASE_PROJECT_ID: demo-project
FIREBASE_AUTH_EMULATOR_HOST: localhost:9099
FIRESTORE_EMULATOR_HOST: localhost:8080
cmds:
- task: start-firebase-emulators-background
- defer: { task: stop-firebase-emulators }
- sleep 5
- go run ./cmd/api --emulators --debug
test-emulators:
env:
FIREBASE_PROJECT_ID: demo-project
FIREBASE_AUTH_EMULATOR_HOST: localhost:9099
FIRESTORE_EMULATOR_HOST: localhost:8080
cmds:
- |
firebase -P "demo-project" -c "tools/firebase_emulator/firebase.json" emulators:exec "\
go test -v -count=1 ./internal/links/datastore/firestore && \
go test -v -count=1 ./internal/boards/datastore/firestore"
api-test:
env:
API_ADDRESS: localhost:9001
FIREBASE_PROJECT_ID: demo-project
FIREBASE_AUTH_EMULATOR_HOST: localhost:9099
FIRESTORE_EMULATOR_HOST: localhost:8080
cmds:
- task: start-firebase-emulators-background
- defer: { task: stop-firebase-emulators }
- sleep 5
- go run ./cmd/api --emulators --debug &
- defer: pkill -f api
- sleep 5
- go test -v ./test/api
start-firebase-emulators:
dir: tools/firebase_emulator
cmds:
- firebase emulators:start
start-firebase-emulators-background:
dir: tools/firebase_emulator
cmds:
- firebase emulators:start &
stop-firebase-emulators:
cmds:
- lsof -t -i :4401 | xargs --no-run-if-empty kill
firebase-helpers:
env:
FIREBASE_PROJECT_ID: demo-project
FIREBASE_AUTH_EMULATOR_HOST: localhost:9099
FIRESTORE_EMULATOR_HOST: localhost:8080
cmds:
- go run ./tools/firebase_emulator/helpers {{.CLI_ARGS}}
docker-build:
cmds:
- docker build -t {{default .DEFAULT_TAG .TAG}} .
vars:
DEFAULT_TAG: "linkboards-api:latest"
# Deploy the API using Google Cloud Run
# Note that for this to work you will have to setup a google cloud project,
# build and upload a docker image of this application to a image repository,
# possibly setup Firebase services, etc..
gcloud-deploy:
cmds:
- |
gcloud run deploy {{.SERVICE}} \
--image {{.IMAGE}} \
--allow-unauthenticated \
--memory {{.MEMORY}} \
--cpu {{.CPU}} \
--concurrency {{.CONCURRENCY}} \
--max-instances {{.MAXINSTANCES}} \
--region {{.REGION}} \
--project {{.PROJECT_ID}} \
vars:
# set this to your google cloud project id
PROJECT_ID: example-project
# set this to the path of the docker image
IMAGE: europe-west3-docker.pkg.dev/example/linkboards-api:latest
SERVICE: linkboardsapi
REGION: europe-west3
MEMORY: 512M
CPU: 1
CONCURRENCY: 80
MAXINSTANCES: 4