This repository has been archived by the owner on Mar 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
252 lines (214 loc) · 6.81 KB
/
ci.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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
---
name: CI
on:
schedule:
- cron: '0 12 * * 0'
push:
branches:
- main
tags:
- v[0-9]+.[0-9]+.[0-9]+*
pull_request:
permissions:
contents: write
packages: write
checks: write
pull-requests: write
repository-projects: read
env:
NODE_OPTIONS: '—-max_old_space_size=4096'
jobs:
cache_pnpm:
name: Cache PNPM
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.ROBOT_TOKEN }}
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'pnpm'
cache-dependency-path: 'pnpm-lock.yaml'
- name: Install dependencies
run: make init
CI_checks:
runs-on: ubuntu-latest
needs: cache_pnpm
strategy:
matrix:
action: ['lint', 'format', 'test', 'build']
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.ROBOT_TOKEN }}
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'pnpm'
cache-dependency-path: 'pnpm-lock.yaml'
- run: make init
- name: lint
if: matrix.action == 'lint'
run: make lint
- name: format
if: matrix.action == 'format'
run: make format
- name: test
if: matrix.action == 'test'
run: make test
- name: build
if: matrix.action == 'build'
run: make build
- name: Check for changes
id: check_changes
run: |
git config --global user.email "[email protected]"
git config --global user.name "CI Bot"
git diff --exit-code || echo "::set-output name=changes::true"
- uses: stefanzweifel/git-auto-commit-action@v5
if: steps.check_changes.outputs.changes == 'true' && github.event_name == 'pull_request'
with:
commit_message: 'chore: lint/format'
token: ${{ secrets.ROBOT_TOKEN }}
E2E:
name: E2E Tests
needs: cache_pnpm
runs-on: ubuntu-20.04
env:
GOPRIVATE: github.com/percona,github.com/percona/percona-everest-backend,github.com/percona/percona-everest-cli,github.com/percona/everest-operator
steps:
- uses: actions/checkout@v3
with:
path: FE
token: ${{ secrets.ROBOT_TOKEN }}
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'pnpm'
cache-dependency-path: FE/pnpm-lock.yaml
- name: Set up Helm
uses: azure/setup-helm@v2
with:
version: 'v3.0.0'
- name: Checkout CLI repo
uses: percona-platform/checkout@v3
with:
repository: percona/percona-everest-cli
ref: 'main'
path: CLI
- name: Configure git for private modules
env:
ROBOT_TOKEN: ${{ secrets.ROBOT_TOKEN }}
run: git config --global url."https://percona-platform-robot:${ROBOT_TOKEN}@github.com".insteadOf "https://github.com"
- name: Set up Go release
uses: percona-platform/setup-go@v4
with:
go-version: 1.20.x
- name: Set GO_VERSION environment variable
run: |
go version
echo "GO_VERSION=$(go version)" >> $GITHUB_ENV
- name: Create KIND cluster
uses: helm/[email protected]
- name: Add Helm Percona repository
run: |
helm repo add percona https://percona.github.io/percona-helm-charts/
- name: Install Helm PMM chart
run: |
helm install pmm --set secret.pmm_password='admin',service.type=ClusterIP percona/pmm
- name: Echo PMM credentials
run: |
echo -n MONITORING_URL=$("http://" && kubectl get svc/monitoring-service -o json | jq -r '.spec.clusterIP') >> $GITHUB_ENV
- name: Run Provisioning
run: |
cd CLI
go run cmd/everest/main.go install \
--operator.mongodb \
--operator.postgresql \
--operator.xtradb-cluster \
--skip-wizard \
--namespaces everest-ui
- name: Adding psmdb namespace
run: |
cd CLI
go run cmd/everest/main.go install \
--operator.mongodb \
--operator.postgresql=false \
--operator.xtradb-cluster=false \
--skip-wizard \
--namespaces everest-psmdb-only
- name: Adding pxc namespace
run: |
cd CLI
go run cmd/everest/main.go install \
--operator.mongodb=false \
--operator.postgresql=false \
--operator.xtradb-cluster \
--skip-wizard \
--namespaces everest-pxc-only
- name: Adding pg namespace
run: |
cd CLI
go run cmd/everest/main.go install \
--operator.mongodb=false \
--operator.postgresql \
--operator.xtradb-cluster=false \
--skip-wizard \
--namespaces everest-pg-only
- name: Change token
run: |
cd CLI
echo "EVEREST_K8_TOKEN=$(go run cmd/everest/main.go token reset --json | jq .token -r)" >> $GITHUB_ENV
- name: Expose Everest backend
run: |
kubectl port-forward -n everest-system deployment/percona-everest 8080:8080 &
- name: Run Everest
run: |
cd FE
make init
pnpm --filter "@percona/everest" dev &
- name: Install Chromium for Playwright
run: |
cd FE/apps/everest
npx playwright install chromium
- name: Run integration tests
env:
EVEREST_LOCATION_BUCKET_NAME: '${{ secrets.EVEREST_LOCATION_BUCKET_NAME }}'
EVEREST_LOCATION_ACCESS_KEY: '${{ secrets.EVEREST_LOCATION_ACCESS_KEY }}'
EVEREST_LOCATION_SECRET_KEY: '${{ secrets.EVEREST_LOCATION_SECRET_KEY }}'
EVEREST_LOCATION_REGION: '${{ secrets.EVEREST_LOCATION_REGION }}'
EVEREST_LOCATION_URL: '${{ secrets.EVEREST_LOCATION_URL }}'
MONITORING_USER: 'admin'
MONITORING_PASSWORD: 'admin'
run: |
cd FE
pnpm --filter "@percona/everest" e2e
- name: Archive test results
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results
path: FE/apps/everest/.e2e/test-results/
- name: Archive report
if: always()
uses: actions/upload-artifact@v3
with:
name: playwright-report
path: FE/apps/everest/.e2e/playwright-report/
- name: Run debug commands on failure
if: ${{ failure() }}
run: |
kubectl -n everest-system logs deployment/percona-everest