forked from virtual-kubelet/node-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (76 loc) · 2.22 KB
/
test.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
name: Go
on:
push:
branches: [ master, release-0.2 ]
pull_request:
branches: [ master, release-0.2 ]
env:
GO111MODULE: on
GOLANGCI_LINT_VERSION: 1.42.1
jobs:
test:
strategy:
matrix:
go-versions: [1.15.x, 1.16.x, 1.17.x]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-mod-
- uses: actions/cache@v1
with:
path: ~/.build/go-cache
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-build-
- name: go env
run: go env
- name: Fetch dependencies
run: go get
- name: Run tests
run: go test ./...
- name: Build
run: go build
lint:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: 1.17.x
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-mod-
- uses: actions/cache@v1
with:
path: ~/.build/go-cache
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-build-
- uses: actions/cache@v1
id: bin
with:
path: ~/bin/
key: golangi-lint-${{ env.GOLANGCI_LINT_VERSION }}
- name: Install golangci-lint
if: steps.bin.outputs.cache-hit != 'true'
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ~/bin/ v${GOLANGCI_LINT_VERSION}
- name: Precompile packages
run: go build ./...
- name: Lint
run: ~/bin/golangci-lint run --disable-all -v -E govet -E misspell -E gofmt -E ineffassign -E golint