-
Notifications
You must be signed in to change notification settings - Fork 7
154 lines (147 loc) · 4.8 KB
/
ci.yml
File metadata and controls
154 lines (147 loc) · 4.8 KB
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
154
name: CI
on:
push:
pull_request:
permissions:
contents: read
jobs:
test:
name: Test
runs-on: ubuntu-latest
environment: ci
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: "go.mod"
- name: Install system dependencies for eBPF build
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
libelf-dev \
clang \
llvm \
libbpf-dev
- name: test kubectl plugin build for all platforms
run: make kubectl-plugin-cross
- run: make test
- name: Upload unit-tests coverage to Codecov
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
name: unit-tests
directory: coverage
flags: unit-tests
verbose: true
helm-unittest:
name: Helm unittest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5.0.0
with:
version: v3.19.0
- name: Install Helm-unittest
# Pin version to 1.0.2 due to https://github.com/helm-unittest/helm-unittest/issues/790
run: helm plugin install https://github.com/helm-unittest/helm-unittest --version 1.0.2
- run: make helm-unittest
linter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y \
pip \
build-essential \
libelf-dev \
clang \
llvm \
libbpf-dev
pip install pre-commit
- name: Cache precommit linters
id: cache-precommit-linters
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: |
~/.cache/pre-commit/
key: ${{ runner.os }}-precommit-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Generate eBPF code
run: make generate-ebpf
- name: Install linters
run: |
pre-commit install --install-hooks
- name: Run linters
run: |
pre-commit run --show-diff-on-failure --color=always --all-files
commitlint:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
env:
COMMITLINT_VERSION: "20.5.0"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: false
- name: Cache commitlint
id: cache-commitlint
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: |
node_modules
package.json
package-lock.json
key: ${{ runner.os }}-commitlint-${{ env.COMMITLINT_VERSION }}
- name: Install commitlint
if: steps.cache-commitlint.outputs.cache-hit != 'true'
run: npm install -D @commitlint/cli@${{ env.COMMITLINT_VERSION }} @commitlint/config-conventional@${{ env.COMMITLINT_VERSION }}
- name: Print versions
run: |
git --version
node --version
npm --version
npx commitlint --version
- name: Validate PR commits with commitlint
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
verify-generated-code:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: "go.mod"
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
libelf-dev \
clang \
llvm \
libbpf-dev \
protobuf-compiler
- name: Generate files
run: make generate
- name: Check working tree is clean
run: |
if ! git diff --quiet; then
echo "generated files are not up to date. Run: make generate"
echo ""
echo "Diff:"
git --no-pager diff
exit 1
fi