-
Notifications
You must be signed in to change notification settings - Fork 8
/
wercker.yml
163 lines (126 loc) · 6.01 KB
/
wercker.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
box: node:6.11
build-api:
steps:
- script:
cwd: image-crusher-api
name: install dependencies
code: |
npm install -g yarn
export YARN_CACHE=$WERCKER_CACHE_DIR/yarn
HOME=$YARN_CACHE yarn --pure-lockfile
- script:
cwd: image-crusher-api
name: build
code: yarn build
- script:
cwd: image-crusher-api
name: test
code: yarn test
- script:
cwd: image-crusher-api
name: install production node_modules
code: |
rm -r node_modules
HOME=$YARN_CACHE yarn --pure-lockfile --production=true
- script:
cwd: image-crusher-api
name: prepare bundle
code: |
chmod +x ./script/prepareFunctions.sh
./script/prepareFunctions.sh
- script:
name: prepare env
code: |
node -e "console.log(JSON.parse(process.env.GC_JSON_KEY_FILE).client_email)" > ./account
node -e "console.log(JSON.parse(process.env.GC_JSON_KEY_FILE).project_id)" > ./project
build-worker:
steps:
- script:
cwd: image-crusher-worker
name: install dependencies
code: |
npm install -g yarn
export YARN_CACHE=$WERCKER_CACHE_DIR/yarn
HOME=$YARN_CACHE yarn --pure-lockfile
- script:
cwd: image-crusher-worker
name: build
code: yarn run build
- script:
cwd: image-crusher-worker
name: benchmark
code: node -e "require('./lib/__benchmark__/index.js')"
# - script:
# cwd: image-crusher-worker
# name: test
# code: env NODE_ENV=ASYNC_POLYFILL yarn run test
- script:
cwd: image-crusher-worker
name: install production node_modules
code: |
rm -r node_modules
HOME=$YARN_CACHE yarn --pure-lockfile --production=true
- script:
name: prepare env
code: |
node -e "console.log(JSON.parse(process.env.GC_JSON_KEY_FILE).client_email)" > ./account
node -e "console.log(JSON.parse(process.env.GC_JSON_KEY_FILE).project_id)" > ./project
deploy-api:
box:
id: google/cloud-sdk
steps:
- script:
name: Activate service account
code: |
echo $GC_JSON_KEY_FILE >> secret.json
CLOUDSDK_PYTHON_SITEPACKAGES=1 gcloud auth activate-service-account $( cat account ) --key-file secret.json --project $( cat project )
- script:
name: create bucket
code: gsutil mb -c STANDARD -l EUROPE-WEST1 -p $( cat project ) gs://platane-image-crusher-lambda-function || echo 1
- script:
name: deploy function get
code: |
gcloud beta functions deploy get --source ./image-crusher-api/dist/get --memory=128MB --timeout 120s --entry-point run --stage-bucket platane-image-crusher-lambda-function --trigger-http
gcloud beta functions describe get
- script:
name: deploy function getJob
code: |
gcloud beta functions deploy getJob --source ./image-crusher-api/dist/getJob --memory=256MB --timeout 120s --entry-point run --stage-bucket platane-image-crusher-lambda-function --trigger-http
gcloud beta functions describe getJob
- script:
name: deploy function create
code: |
gcloud beta functions deploy create --source ./image-crusher-api/dist/create --memory=512MB --timeout 120s --entry-point run --stage-bucket platane-image-crusher-lambda-function --trigger-http
gcloud beta functions describe create
- script:
name: deploy function pushSolution
code: |
gcloud beta functions deploy pushSolution --source ./image-crusher-api/dist/pushSolution --memory=512MB --timeout 120s --entry-point run --stage-bucket platane-image-crusher-lambda-function --trigger-http
gcloud beta functions describe pushSolution
- script:
name: deploy function publishToStorage
code: |
gcloud beta functions deploy publishToStorage --source ./image-crusher-api/dist/publishToStorage --memory=512MB --timeout 120s --entry-point run --stage-bucket platane-image-crusher-lambda-function --trigger-http
gcloud beta functions describe publishToStorage
- script:
name: deploy function migration
code: |
gcloud beta functions deploy migration --source ./image-crusher-api/dist/migration --memory=512MB --timeout 120s --entry-point run --stage-bucket platane-image-crusher-lambda-function --trigger-topic notopic
gcloud beta functions describe migration
deploy-worker:
box:
id: google/cloud-sdk
steps:
- script:
name: Activate service account
code: |
echo $GC_JSON_KEY_FILE >> secret.json
CLOUDSDK_PYTHON_SITEPACKAGES=1 gcloud auth activate-service-account $( cat account ) --key-file secret.json --project $( cat project )
- script:
name: create bucket
code: gsutil mb -c STANDARD -l EUROPE-WEST1 -p $( cat project ) gs://platane-image-crusher-lambda-function || echo 1
- script:
name: deploy function worker
code: |
gcloud beta functions deploy worker --source ./image-crusher-worker/dist/worker --memory=1GB --timeout 540s --entry-point run --stage-bucket platane-image-crusher-lambda-function --trigger-http
gcloud beta functions describe worker