-
Notifications
You must be signed in to change notification settings - Fork 33
127 lines (108 loc) · 3.25 KB
/
pr.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
name: PR validation
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
lint-test:
name: Validate code and charts
runs-on: ubuntu-20.04
container:
image: ghcr.io/dell/csi-baremetal/csi-baremetal-devkit:latest
env:
EUID: 0
EGID: 0
USER_NAME: root
STDOUT: true
volumes:
- /root:/root
- /tmp:/tmp
- /var/run/docker.sock:/var/run/docker.sock
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set go_version variable
run: echo "go_version=`echo "$(go version)" | grep -oE '[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}'`" >> $GITHUB_ENV
- name: Load dep cache
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: go-dep-${{ env.go_version }}-${{ hashFiles('**/go.sum') }}
restore-keys: go-dep-${{ env.go_version }}-
- name: Load build and linter cache
uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/.cache/golangci-lint
key: go-build-${{ env.go_version }}-${{ hashFiles('**/go.sum') }}-${{ hashFiles('**/pkg') }}
restore-keys: |
go-build-${{ env.go_version }}-${{ hashFiles('**/go.sum') }}
go-build-${{ env.go_version }}-
- name: Get dependencies
run: make dependency
- name: Lint code
run: GOGC=300 make lint
- name: Run Tests
run: CI=false make test
- name: Coverage
run: make coverage
- name: Upload coverage report to artifacts
uses: actions/[email protected]
with:
name: coverage.html
path: ./coverage.html
- name: Upload coverage report to codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.out
flags: unittests
verbose: true
- name: Build binaries
run: |
make DRIVE_MANAGER_TYPE=basemgr build
make DRIVE_MANAGER_TYPE=loopbackmgr build-drivemgr
make DRIVE_MANAGER_TYPE=idracmgr build-drivemgr
- name: Test sanity
run: |
make test-sanity
gen-files-validate:
name: Generated files should be consistent
runs-on: ubuntu-20.04
container:
image: ghcr.io/dell/csi-baremetal/csi-baremetal-devkit:latest
env:
EUID: 0
EGID: 0
USER_NAME: root
STDOUT: true
volumes:
- /root:/root
- /tmp:/tmp
- /var/run/docker.sock:/var/run/docker.sock
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Compile proto files
run: make compile-proto
- name: Generate CRD
run: |
make install-controller-gen
make generate-deepcopy
- name: Verify Changed files
uses: tj-actions/[email protected]
id: changed_files
with:
files: |
api/generated/v1/*.go
api/v1/*/*.go
'.(go)$'
- name: Display changed files
if: steps.changed_files.outputs.files_changed == 'true'
run: |
echo "Changed files: ${{ steps.changed_files.outputs.changed_files }}"
- name: Perform action when files change.
if: steps.changed_files.outputs.files_changed == 'true'
run: |
exit 1