-
Notifications
You must be signed in to change notification settings - Fork 3
153 lines (124 loc) · 3.42 KB
/
quality.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
name: quality
on:
push:
branches:
- main
tags:
- "*"
pull_request:
branches:
- main
workflow_dispatch:
permissions:
actions: none
checks: none
contents: read
deployments: none
issues: none
packages: none
pull-requests: none
repository-projects: none
security-events: none
statuses: none
jobs:
fmt-go:
name: fmt/go
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: "^1.21.9"
- name: Run make fmt/go
run: make fmt/go
- name: Check for unstaged files
run: ./ci/scripts/check_unstaged.sh
fmt-prettier:
name: fmt/prettier
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: "18"
- name: Install prettier
run: npm install --global prettier
- name: Run make fmt/prettier
run: make fmt/prettier
- name: Check for unstaged files
run: ./ci/scripts/check_unstaged.sh
lint-go:
name: lint/go
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: "^1.21.9"
- name: Install golangci-lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \
| sh -s -- -b $(go env GOPATH)/bin v1.57.2
# Linting needs to be done on each build variation of GOOS.
- name: Run make lint/go/linux
run: make lint/go/linux
# The windows and darwin builds include the same files.
- name: Run make lint/go/other
run: make lint/go/other
test-go:
name: "test/go"
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "^1.21.9"
- name: Echo Go Cache Paths
id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
- name: Go Build Cache
uses: actions/cache@v3
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.**', '**.go') }}
- name: Go Mod Cache
uses: actions/cache@v3
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
- name: Test
run: make test/go
lint-c:
name: lint/c
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run make lint/c
run: make lint/c
- name: Ensure DEBUG is disabled
run: |
# look for uncommented "#define DEBUG" in bpf/handler.c
if grep -q "^#define DEBUG" bpf/handler.c; then
echo "DEBUG is enabled in bpf/handler.c"
exit 1
fi
lint-shellcheck:
name: lint/shellcheck
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install shellcheck
run: sudo apt install -y shellcheck
- name: Run make lint/shellcheck
run: make lint/shellcheck