-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwercker.yml
86 lines (80 loc) · 2.9 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
box: blueoceans/golang:1.10.3
build:
steps:
- script:
name: set -x
code: set -x
- setup-go-workspace:
package-dir: github.com/michilu/cel-spec-go
- 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: go module
code: |
( type go1.11rc2 > /dev/null 2>&1 ) || go get golang.org/dl/go1.11rc2 && go1.11rc2 download
- script:
name: version
code: |
go1.11rc2 version
- script:
name: build
code: |
make
./cel-spec-go version
go1.11rc2 build
./cel-spec-go version
- script:
name: test
code: |
make test
./cel-spec-go gen
./cel-spec-go gen
#after-steps:
#- slack-notifier:
# url: $SLACK_URL
lint:
steps:
- script:
name: set -x
code: set -x
- setup-go-workspace:
package-dir: github.com/michilu/cel-spec-go
- 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
( 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
#after-steps:
#- slack-notifier:
# url: $SLACK_URL