-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwercker.yml
277 lines (265 loc) · 8.77 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
go:
box: blueoceans/golang:1.14.0
steps:
- script:
name: set -x
code: set -x
- setup-go-workspace:
package-dir: github.com/michilu/boilerplate
- script:
name: setup cache for go
code: |
mkdir -p "$WERCKER_CACHE_DIR/go"
[ -z "$(go env GOPATH)" ] && export GOPATH=$WERCKER_CACHE_DIR/go || export GOPATH=$WERCKER_CACHE_DIR/go:$(go env GOPATH)
export PATH=$WERCKER_CACHE_DIR/go/bin:$PATH
- script:
name: version
code: go version
- script:
name: go build
code: |
make golang
./$(basename $(go list)) version
- script:
name: test `go get`
code: |
make go-get || ( git diff go.mod; fail 'you need "GO111MODULE=on go get -u"' )
./$(basename $(go list)) version
go-get:
box: golang
steps:
- script:
name: set -x
code: set -x
- script:
name: version
code: go version
- script:
name: go get
code: go get -v -u github.com/michilu/boilerplate
- script:
name: test
code: boilerplate version
gopherjs:
box: blueoceans/golang:1.14.0
steps:
- script:
name: set -x
code: set -x
- setup-go-workspace:
package-dir: github.com/michilu/boilerplate
- script:
name: setup cache for go
code: |
mkdir -p "$WERCKER_CACHE_DIR/go"
[ -z "$(go env GOPATH)" ] && export GOPATH=$WERCKER_CACHE_DIR/go || export GOPATH=$WERCKER_CACHE_DIR/go:$(go env GOPATH)
export PATH=$WERCKER_CACHE_DIR/go/bin:$PATH
- script:
name: install GopherJS
code: ( type gopherjs > /dev/null 2>&1 ) || go get -u github.com/gopherjs/gopherjs
- script:
name: version
code: |
go version
gopherjs version
- script:
name: gopherjs build
code: make gopherjs
- script:
name: output
code: tar czvf $WERCKER_OUTPUT_DIR/go.tar.gz ./*
dart:
box: michilu/dart:2.0.0
steps:
- script:
name: set -x
code: set -x
- install-packages:
packages: tar
- script:
name: input
code: tar xzvf go.tar.gz
- npm-install
- script:
name: setup cache for dart
code: export PUB_CACHE=$WERCKER_CACHE_DIR/pub_cache
- script:
name: version
code: dart --version
- script:
name: build
code: make dart
end-to-end:
box:
id: michilu/alpine-chrome
entrypoint: /bin/sh -c
cmd: bash
steps:
- script:
name: set -x
code: set -x
- ytet5uy4/apk-add:
update: true
packages: curl jq tar py2-pip
- maestrohealthcaretechnologies/pip-install:
requirements_file:
packages_list: yq
- script:
name: run server
code: (cd $(jq -r .hosting.public firebase.json) && python -m SimpleHTTPServer) &
- script:
name: versions
code: chromium-browser --version
- script:
name: take a screenshot
# https://www.chromium.org/for-testers/enable-logging<Paste>
# https://chromium.googlesource.com/chromium/src/+/master/base/logging.h#343
code: |
yq -r '"http://localhost:8000"+.screenshot[]' assets/path.yaml|xargs bash -c \
'chromium-browser --headless --disable-gpu --no-sandbox \
--enable-logging=stderr --v=2 \
--screenshot=$(echo $0|tr / -).${WERCKER_GIT_COMMIT:0:7}.png --hide-scrollbars --window-size=412,732 \
$0'
put-to-slack:
box: golang
steps:
- script:
name: set -x
code: set -x
- setup-go-workspace
- script:
name: setup cache for go
code: |
mkdir -p "$WERCKER_CACHE_DIR/go"
if [ -z "$(go env GOPATH)" ]; then
export GOPATH=$WERCKER_CACHE_DIR/go
else
export GOPATH=$WERCKER_CACHE_DIR/go:$(go env GOPATH)
fi
export PATH=$WERCKER_CACHE_DIR/go/bin:$PATH
- script:
name: put to slack
code: |
( type slackcli > /dev/null 2>&1 ) || go get github.com/cixtor/slackcli
slackcli version
find . -maxdepth 1 -type f -name "*.png" -exec slackcli files.upload ci {} \;
branch-deploy:
box:
id: michilu/netlifyctl
entrypoint: /bin/sh -c
cmd: bash
steps:
- script:
name: set -x
code: set -x
- ytet5uy4/apk-add:
update: true
packages: curl jq
- script:
name: deploy to netlify
code: |
target=$(jq -r .hosting.public firebase.json)
netlifyctl deploy --access-token $NETLIFY_TOKEN --yes --base-directory $target --draft --site-id ${NETLIFY_BRANCH_DEPLOY_SITE_ID} --message ${WERCKER_GIT_COMMIT:0:7} | tee /tmp/netlifyctl.txt
ls -al $target
- script:
name: lighthouse
code: |
url=$(grep netlify.com /tmp/netlifyctl.txt | tr -d ' ')
bot="https://builder-dot-lighthouse-ci.appspot.com/stream?url=${url}"
curl -s ${bot} | grep 'data: done' | awk '{print $3}' | tee /tmp/lighthouse-html.txt
out=/tmp/lighthouse.json
curl -s -o ${out} $(curl -s "${bot}&format=json" | grep 'data: done' | awk '{print $3}')
version=$(cat ${out}|jq -r '.lighthouseVersion')
if [[ ${version} =~ ^3\. ]] ;then :;else fail "unsupported version: ${version}"; fi
- script:
name: lighthouse results
code: |
out=/tmp/slack-message.txt
echo branch-deploy to $(grep netlify.com /tmp/netlifyctl.txt | tr -d ' ') > ${out}
cat /tmp/lighthouse.json | jq -r '.categories[]|[.title,.score]|@tsv' >> ${out}
cat /tmp/lighthouse-html.txt >> ${out}
cat ${out}
after-steps:
- shoya/slack-notifier:
# https://app.wercker.com/steps/shoya/slack-notifier
url: $SLACK_URL
custom_message: $(cat /tmp/slack-message.txt)
deploy:
box: devillex/docker-firebase
steps:
- script:
name: set -x
code: set -x
- npm-install:
options: -g firebase-tools
- script:
name: version
code: firebase --version
- devillexio/firebase-deploy:
project: $FIREBASE_PROJECT
token: $FIREBASE_TOKEN
- install-packages:
packages: jq python-pip python-dev
- maestrohealthcaretechnologies/pip-install:
requirements_file:
packages_list: yq
- script:
name: lighthouse
code: |
export url=$(yq -r '"https://"+.deploy[]+"/"' assets/path.yaml)
bot="https://builder-dot-lighthouse-ci.appspot.com/stream?url=${url}"
curl -s ${bot} | grep 'data: done' | awk '{print $3}' | tee /tmp/lighthouse-html.txt
curl -s $(curl -s "${bot}&format=json" | grep 'data: done' | awk '{print $3}') | jq -r '.categories[]|[.title,.score]|@csv' | tr -d '"' | tr ',' '\t' | tee /tmp/lighthouse.txt
- script:
name: lighthouse results
code: |
out=/tmp/slack-message.txt
echo deploy to ${url} > ${out}
cat /tmp/lighthouse.txt >> ${out}
cat /tmp/lighthouse-html.txt >> ${out}
cat ${out}
after-steps:
- shoya/slack-notifier:
# https://app.wercker.com/steps/shoya/slack-notifier
url: $SLACK_URL
custom_message: $(cat /tmp/slack-message.txt)
lint:
box: blueoceans/golang:1.11.2
steps:
- script:
name: set -x
code: set -x
- setup-go-workspace:
package-dir: github.com/michilu/boilerplate
- script:
name: setup cache for go
code: |
mkdir -p "$WERCKER_CACHE_DIR/go"
[ -z "$(go env GOPATH)" ] && export GOPATH=$WERCKER_CACHE_DIR/go || export GOPATH=$WERCKER_CACHE_DIR/go:$(go env GOPATH)
export PATH=$WERCKER_CACHE_DIR/go/bin:$PATH
- script:
name: Install golint
code: ( type golint > /dev/null 2>&1 ) || go get golang.org/x/lint/golint
- script:
name: Install reviewdog
code: |
( type reviewdog > /dev/null 2>&1 ) || go get github.com/haya14busa/reviewdog/cmd/reviewdog
reviewdog -version
- script:
name: reviewdog
code: |
if [ -f .git/FETCH_HEAD ]; then
export CI_PULL_REQUEST=$(awk -F/ '{print $3}' .git/FETCH_HEAD)
export CI_REPO_OWNER=${WERCKER_GIT_OWNER}
export CI_REPO_NAME=${WERCKER_GIT_REPOSITORY}
export CI_COMMIT=${WERCKER_GIT_COMMIT}
go list ./... | xargs -L1 golint | reviewdog -f=golint -ci=common
else
THRESHOLD_WARN=${REVIEWDOG_THRESHOLD_WARN-5}
THRESHOLD_FAIL=${REVIEWDOG_THRESHOLD_FAIL-10}
LINTLINES=$(go list ./... | xargs -L1 golint | reviewdog -f=golint -diff="git diff remotes/origin/master" | tee /tmp/lint_results.txt | wc -l | tr -d " ")
cat /tmp/lint_results.txt
if [ "$LINTLINES" -ge "${THRESHOLD_FAIL}" ]; then echo "Time to tidy up: $LINTLINES lint warnings." > "$WERCKER_REPORT_MESSAGE_FILE"; fail "Time to tidy up."; fi
if [ "$LINTLINES" -ge "${THRESHOLD_WARN}" ]; then echo "You should be tidying soon: $LINTLINES lint warnings." > "$WERCKER_REPORT_MESSAGE_FILE"; warn "You should be tidying soon."; fi
if [ "$LINTLINES" -gt 0 ]; then echo "You are fairly tidy: $LINTLINES lint warnings." > "$WERCKER_REPORT_MESSAGE_FILE"; fi
fi