-
Notifications
You must be signed in to change notification settings - Fork 479
147 lines (125 loc) · 3.92 KB
/
main-pr.yaml
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
name: PR tests
concurrency:
# Run only for most recent commit in PRs but for all tags and commits on main
# Ref: https://docs.github.com/en/actions/using-jobs/using-concurrency
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }}
cancel-in-progress: true
on:
pull_request:
branches:
- main
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: setup golang
uses: actions/setup-go@v4
with:
go-version: '^1.20'
- name: cache go modules
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-codegen-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-build-codegen-
- name: Run linters
run: make lint
lint-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.11.0
- name: Add Helm repos
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add kong https://charts.konghq.com
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.4.0
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed)
if [[ -n "$changed" ]]; then
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Run chart-testing (lint)
run: ct lint --check-version-increment=false
- name: Create kind cluster
uses: helm/kind-action@v1.8.0
# if: steps.list-changed.outputs.changed == 'true'
# TODO for some reason, the earlier chart-testing logic is never seeing any changes, though running it locally
# does show changes. This remains a mystery between a lack of any debug logging, but simply running tests
# always is fine
- name: Run chart-testing (install)
run: ct install --charts charts/kong
integration-test:
runs-on: ubuntu-latest
env:
# Specify this here because these tests rely on ktf to run kind for cluster creation.
KIND_VERSION: v0.19.0
strategy:
matrix:
kubernetes-version:
- "1.19.16"
- "1.20.15"
- "1.21.14"
- "1.22.15"
- "1.23.13"
- "1.24.7"
- "1.25.9"
- "1.26.4"
- "1.27.1"
chart-name:
- kong
- ingress
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: setup helm
uses: azure/setup-helm@v3
with:
version: v3.11.0
- name: setup testing environment (kind-cluster)
env:
KUBERNETES_VERSION: ${{ matrix.kubernetes-version }}
run: ./scripts/test-env.sh
- name: run integration tests (integration)
env:
CHART_NAME: ${{ matrix.chart-name }}
run: ./scripts/test-run.sh
- name: run upgrade integration tests (integration-upgrade)
env:
CHART_NAME: ${{ matrix.chart-name }}
run: ./scripts/test-upgrade.sh
- name: cleanup integration tests (cleanup)
run: ./scripts/test-env.sh cleanup
# Workaround to allow checking the matrix tests as required tests without adding the individual cases
# Ref: https://github.com/orgs/community/discussions/26822#discussioncomment-3305794
passed:
runs-on: ubuntu-latest
needs:
- lint
- lint-test
- integration-test
if: always()
steps:
- if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
run: |
echo "Some jobs failed or were cancelled."
exit 1