-
Notifications
You must be signed in to change notification settings - Fork 183
203 lines (189 loc) · 5.93 KB
/
pull_requests.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
name: PRs checks
on:
pull_request:
branches:
- main
- "release-v[0-9]+"
- "release-v[0-9]+.[0-9]+"
jobs:
docs-changed:
runs-on: ubuntu-22.04
outputs:
any_changed: ${{ steps.changed-files.outputs.any_changed }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if documentation related files changed
id: changed-files
uses: tj-actions/changed-files@v44
with:
files: |
**/*.md
images/*
ci/*
.github/*
**/Makefile
.*
chart-changed:
runs-on: ubuntu-22.04
outputs:
any_changed: ${{ steps.changed-files.outputs.any_changed }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if Helm Chart related files changed
id: changed-files
uses: tj-actions/changed-files@v44
with:
files: |
deploy/helm/sumologic/**/*
**/*.yaml
**/*.yml
**/go.mod
**/go.sum
**/*.go
ci/*
.github/*
**/Makefile
.*
tests/integration/kind_images.json
markdownlint:
runs-on: ubuntu-22.04
needs: [docs-changed]
env:
PRETTIER_VERSION: 3.2.5
steps:
- uses: actions/checkout@v4
- name: install markdownlint and prettier
if: needs.docs-changed.outputs.any_changed == 'true'
run: npm install -g markdownlint-cli prettier@${PRETTIER_VERSION}
- name: markdown-lint check
if: needs.docs-changed.outputs.any_changed == 'true'
run: make markdown-lint
shellcheck:
runs-on: ubuntu-22.04
env:
YQ_VERSION: 4.43.1
SHELLCHECK_VERSION: 0.9.0
steps:
- uses: actions/checkout@v4
- name: install shellcheck
run: |
curl --retry 10 --retry-max-time 120 --retry-delay 5 -Lo- https://github.com/koalaman/shellcheck/releases/download/v${{ env.SHELLCHECK_VERSION }}/shellcheck-v${{ env.SHELLCHECK_VERSION }}.linux.x86_64.tar.xz | tar -xJf -
sudo cp shellcheck-v${{ env.SHELLCHECK_VERSION }}/shellcheck /usr/local/bin && rm -rf shellcheck-v${{ env.SHELLCHECK_VERSION }}
- name: install yq
run: |
curl --retry 10 --retry-max-time 120 --retry-delay 5 -L -o /tmp/yq https://github.com/mikefarah/yq/releases/download/v${{ env.YQ_VERSION }}/yq_linux_amd64
chmod +x /tmp/yq
sudo mv /tmp/yq /usr/local/bin/yq
- name: shellcheck
run: make shellcheck
yamllint:
runs-on: ubuntu-22.04
needs: [chart-changed]
env:
PRETTIER_VERSION: 2.8.8
steps:
- uses: actions/checkout@v4
- name: install yamllint
if: needs.chart-changed.outputs.any_changed == 'true'
run: npm install -g prettier@${PRETTIER_VERSION}
- name: yamllint
if: needs.chart-changed.outputs.any_changed == 'true'
run: make yaml-lint
helmlint:
runs-on: ubuntu-22.04
needs: [chart-changed]
steps:
- uses: actions/checkout@v4
- name: Lint helm chart
if: needs.chart-changed.outputs.any_changed == 'true'
run: |
make helm-dependency-update
make helm-lint
markdown-link-check:
runs-on: ubuntu-22.04
needs: [docs-changed]
steps:
- uses: actions/checkout@v4
- uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
config-file: ".markdown_link_check.json"
use-quiet-mode: yes
check-modified-files-only: yes
base-branch: ${{ github.base_ref }}
md-links-lint:
runs-on: ubuntu-22.04
needs: [docs-changed]
steps:
- uses: actions/checkout@v4
- name: Lint markdown links
if: needs.docs-changed.outputs.any_changed == 'true'
run: |
make markdown-links-lint
check-configuration-keys:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install pyyaml
- run: |
make check-configuration-keys
lint-template-tests:
name: Lint template tests
runs-on: ubuntu-latest
needs: [chart-changed]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
if: needs.chart-changed.outputs.any_changed == 'true'
with:
go-version: "1.22"
cache: false
- name: golangci-lint
if: needs.chart-changed.outputs.any_changed == 'true'
uses: golangci/golangci-lint-action@v4
with:
version: v1.57.1
working-directory: ./tests/helm/
# Optional: golangci-lint command line arguments.
args: --timeout=10m --verbose
test:
runs-on: ubuntu-22.04
needs:
- helmlint
- chart-changed
steps:
- uses: actions/checkout@v4
- name: Setup go
if: needs.chart-changed.outputs.any_changed == 'true'
uses: actions/setup-go@v5
with:
go-version: "1.22"
cache-dependency-path: "**/go.sum"
- name: test
if: needs.chart-changed.outputs.any_changed == 'true'
run: make test-templates
run-integration-tests:
name: Run Integration Tests
needs: [chart-changed]
if: needs.chart-changed.outputs.any_changed == 'true'
uses: ./.github/workflows/workflow-integration-tests.yaml
integration-tests-success:
name: Integration tests succeded
runs-on: ubuntu-22.04
needs: [run-integration-tests]
if: ${{ always() }}
steps:
- name: Success
if: ${{ always() && (needs.run-integration-tests.result == 'success' || needs.run-integration-tests.result == 'skipped') }}
run: exit 0
- name: Failure
if: ${{ always() && !(needs.run-integration-tests.result == 'success' || needs.run-integration-tests.result == 'skipped') }}
run: exit 1