File tree Expand file tree Collapse file tree 2 files changed +62
-23
lines changed
Expand file tree Collapse file tree 2 files changed +62
-23
lines changed Original file line number Diff line number Diff line change @@ -14,33 +14,14 @@ jobs:
1414 with :
1515 go-version : 1.13
1616
17- - name : Check out code into the Go module directory
17+ - name : Check out code
1818 uses : actions/checkout@v2
1919
20- - name : Verify dependencies
21- shell : bash
22- run : |
23- go mod verify
24- go mod download
20+ - name : Download dependencies
21+ run : go mod download
2522
2623 - name : Run tests
27- shell : bash
28- run : |
29- assert-nothing-changed() {
30- local diff
31- git checkout -- .
32- "$@" >/dev/null || true
33- if ! diff="$(git diff -U1 --color --exit-code)"; then
34- printf '\n\e[31mError: running `\e[1m%s\e[22m` results in modifications that you must check into version control:\e[0m\n%s\n' "$*" "$diff" >&2
35- return 1
36- fi
37- }
38-
39- STATUS=0
40- go test -race ./... || STATUS=$?
41- assert-nothing-changed go fmt ./... || STATUS=$?
42- assert-nothing-changed go mod tidy || STATUS=$?
43- exit $STATUS
24+ run : go test -race ./...
4425
4526 - name : Build
4627 run : go build -v ./cmd/gh
Original file line number Diff line number Diff line change 1+ name : Lint
2+ on :
3+ push :
4+ paths :
5+ - ' **.go'
6+ - go.mod
7+ - go.sum
8+
9+ jobs :
10+ lint :
11+ runs-on : ubuntu-latest
12+
13+ steps :
14+ - name : Set up Go 1.13
15+ uses : actions/setup-go@v1
16+ with :
17+ go-version : 1.13
18+
19+ - name : Check out code
20+ uses : actions/checkout@v2
21+
22+ - name : Verify dependencies
23+ run : |
24+ go mod verify
25+ go mod download
26+
27+ LINT_VERSION=1.24.0
28+ curl -fsSL https://github.com/golangci/golangci-lint/releases/download/v${LINT_VERSION}/golangci-lint-${LINT_VERSION}-linux-amd64.tar.gz | \
29+ tar xz --strip-components 1 --wildcards \*/golangci-lint
30+ mkdir -p bin && mv golangci-lint bin/
31+
32+ - name : Run checks
33+ run : |
34+ STATUS=0
35+ assert-nothing-changed() {
36+ local diff
37+ "$@" >/dev/null || return 1
38+ if ! diff="$(git diff -U1 --color --exit-code)"; then
39+ printf '\e[31mError: running `\e[1m%s\e[22m` results in modifications that you must check into version control:\e[0m\n%s\n\n' "$*" "$diff" >&2
40+ git checkout -- .
41+ STATUS=1
42+ fi
43+ }
44+
45+ assert-nothing-changed go fmt ./...
46+ assert-nothing-changed go mod tidy
47+
48+ bin/golangci-lint run --out-format tab --issues-exit-code 0 | while read -r loc linter msg; do
49+ line="${loc#*:}"
50+ printf '::warning file=%s,line=%s,col=%s::%s\n' \
51+ "${loc%%:*}" "${line%%:*}" "${loc##*:}" \
52+ "[$linter] $msg"
53+ done
54+
55+ exit $STATUS
56+
57+ - name : Build
58+ run : go build -v ./cmd/gh
You can’t perform that action at this time.
0 commit comments