-
Notifications
You must be signed in to change notification settings - Fork 1
209 lines (199 loc) · 5.45 KB
/
test-action.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
name: test-action
on:
pull_request:
push:
branches:
- main
jobs:
default:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
permissions: {}
name: Install Kyverno CLI and test presence in path
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: Install Kyverno CLI
uses: ./
- name: Check install
run: kyverno version
- name: Check root directory
shell: bash
run: |
if [[ $(git diff --stat) != '' ]]; then
echo 'should be clean'
exit 1
else
exit 0
fi
verify:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
permissions: {}
name: Install Kyverno CLI with cosign verification and test presence in path
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: Install Cosign
uses: sigstore/cosign-installer@4959ce089c160fddf62f7b42464195ba1a56d382 # v3.6.0
- name: Install Kyverno CLI
uses: ./
with:
verify: true
- name: Check install
run: kyverno version
- name: Check root directory
shell: bash
run: |
if [[ $(git diff --stat) != '' ]]; then
echo 'should be clean'
exit 1
else
exit 0
fi
release:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
permissions: {}
name: Install Kyverno CLI and test presence in path from GitHub
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: Install Kyverno CLI
uses: kyverno/[email protected]
- name: Check install
run: kyverno version
- name: Check root directory
shell: bash
run: |
if [[ $(git diff --stat) != '' ]]; then
echo 'should be clean'
exit 1
else
exit 0
fi
custom:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
permissions: {}
name: Install Kyverno CLI and test presence in path
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: Install Kyverno CLI
uses: ./
with:
release: 'v1.9.5'
- name: Check install
run: kyverno version
- name: Check root directory
shell: bash
run: |
if [[ $(git diff --stat) != '' ]]; then
echo 'should be clean'
exit 1
else
exit 0
fi
wrong_version:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
permissions: {}
name: Try to install a wrong version
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: Install Kyverno CLI
uses: ./
with:
release: honk
continue-on-error: true
custom_dir:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
permissions: {}
name: Install Kyverno CLI and test presence in path
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: Install Kyverno CLI
uses: ./
with:
install-dir: "$HOME/.kyvernotest"
- name: Check install
run: kyverno version
- name: Check install dir
shell: bash
run: |
[[ $(dirname "$(which kyverno)") == "$HOME/.kyvernotest" ]]
- name: Check root directory
shell: bash
run: |
[[ -z $(git diff --stat) ]]
custom_dir_root:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
permissions: {}
name: Install Kyverno CLI and test presence in path with custom root dir
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: Install Kyverno CLI
uses: ./
with:
install-dir: /usr/bin
use-sudo: true
- name: Check install
run: kyverno version
- name: Check install dir
shell: bash
run: |
[[ $(dirname "$(which kyverno)") == /usr/bin ]]
- name: Check root directory
shell: bash
run: |
[[ -z $(git diff --stat) ]]
main:
permissions: {}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
go_version:
- '1.21'
name: Try to install with go ${{ matrix.go_version }}
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: ${{ matrix.go_version }}
check-latest: true
- name: Install Kyverno CLI
uses: ./
with:
release: main
- name: Check install
run: kyverno version
required:
needs:
- default
- verify
- release
- custom
- wrong_version
- custom_dir
- custom_dir_root
- main
runs-on: ubuntu-latest
steps:
- run: echo "Required jobs success!"