-
Notifications
You must be signed in to change notification settings - Fork 53
461 lines (406 loc) · 16.1 KB
/
tests.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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
name: Execute Tests
on:
workflow_dispatch:
inputs:
NEO4J_VERSION:
description: 'Neo4j version to be released'
required: true
type: string
pull_request:
paths:
- bin/gcloud/*
- internal/*
branches:
- dev
env:
GCLOUD_SERVICE_KEY: ${{ secrets.GCLOUD_SERVICE_KEY }}
CLOUDSDK_CORE_PROJECT: ${{ secrets.CLOUDSDK_CORE_PROJECT }}
CLOUDSDK_COMPUTE_ZONE: "europe-west2-b"
CLOUDSDK_COMPUTE_REGION: "europe-west2"
GO_TEST_COUNT: 1
GO_TEST_TIMEOUT: 20m
GO_TEST_FORMAT: json
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AZURE_STORAGE_ACCOUNT_NAME: ${{ secrets.AZURE_STORAGE_ACCOUNT_NAME }}
AZURE_STORAGE_ACCOUNT_KEY: ${{ secrets.AZURE_STORAGE_ACCOUNT_KEY }}
GCP_SERVICE_ACCOUNT_CRED: ${{ secrets.GCLOUD_SERVICE_KEY }}
BLOOM_LICENSE: ${{ secrets.BLOOM_LICENSE }}
IPS_USERNAME: ${{ secrets.IPS_USERNAME }}
IPS_EMAIL: ${{ secrets.IPS_EMAIL }}
jobs:
current-date:
name: Current Date
runs-on: ubuntu-latest
steps:
- name: Set Current Date
id: currentDate
run: |
CURRENT_DATE=$(date +'%Y-%m-%d-%s')
echo "CURRENT_DATE=${CURRENT_DATE}" >> $GITHUB_OUTPUT
outputs:
CURRENT_DATE: ${{ steps.currentDate.outputs.CURRENT_DATE }}
gke-setup:
name: Debian GKE Creation
runs-on: ubuntu-latest
needs:
- current-date
env:
CURRENT_DATE: ${{ needs.current-date.outputs.CURRENT_DATE }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Authenticate Service Account
id: serviceAccount
run: |
./bin/gcloud/auth
- name: Create GKE Cluster
run: |
export CLOUDSDK_CONTAINER_CLUSTER=ghactions-${CURRENT_DATE}
./bin/gcloud/create_cluster
outputs:
CLOUDSDK_CONTAINER_CLUSTER: "ghactions-${{ env.CURRENT_DATE }}"
gke-setup-redhat:
name: RedHat GKE Creation
runs-on: ubuntu-latest
needs:
- current-date
env:
CURRENT_DATE: ${{ needs.current-date.outputs.CURRENT_DATE }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Authenticate Service Account
id: serviceAccount
run: |
./bin/gcloud/auth
- name: Create GKE Cluster
run: |
export CLOUDSDK_CONTAINER_CLUSTER=ghactions-redhat-${CURRENT_DATE}
./bin/gcloud/create_cluster
outputs:
CLOUDSDK_CONTAINER_CLUSTER_REDHAT: "ghactions-redhat-${{ env.CURRENT_DATE }}"
build-reverseproxy-backup:
name: ReverseProxy and Backup Docker Image build
runs-on: ubuntu-latest
needs:
- current-date
env:
CURRENT_DATE: ${{ needs.current-date.outputs.CURRENT_DATE }}
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: europe-west2-docker.pkg.dev
username: _json_key
password: ${{ secrets.GCLOUD_SERVICE_KEY }}
- name: Build and push reverse proxy image
uses: docker/build-push-action@v5
with:
context: "{{defaultContext}}:neo4j-reverse-proxy"
push: true
tags: "${{ vars.ARTIFACT_REGISTRY_REPO_NAME }}/reverseproxy:${{ env.CURRENT_DATE }}"
provenance: false
- name: Build and push backup image
uses: docker/build-push-action@v5
with:
context: "{{defaultContext}}:neo4j-admin"
push: true
tags: "${{ vars.ARTIFACT_REGISTRY_REPO_NAME }}/neo4j-admin:${{ env.CURRENT_DATE }}"
provenance: false
build-args: |
IMAGE=${{ vars.ARTIFACT_REGISTRY_REPO_NAME }}/neo4j:enterprise-dev
DISTRIBUTION=debian
- name: Build and push red hat backup image
uses: docker/build-push-action@v5
with:
context: "{{defaultContext}}:neo4j-admin"
push: true
tags: "${{ vars.ARTIFACT_REGISTRY_REPO_NAME }}/neo4j-admin:ubi9-${{ env.CURRENT_DATE }}"
provenance: false
build-args: |
IMAGE=${{ vars.ARTIFACT_REGISTRY_REPO_NAME }}/neo4j:enterprise-dev-ubi9
DISTRIBUTION=redhat
run-enterprise-tests:
name: Debian Enterprise tests
needs:
- gke-setup
- build-reverseproxy-backup
- current-date
runs-on: ubuntu-latest
env:
NEO4J_EDITION: "enterprise"
CLOUDSDK_CONTAINER_CLUSTER: ${{ needs.gke-setup.outputs.CLOUDSDK_CONTAINER_CLUSTER }}
NEO4J_DOCKER_IMG: "${{ vars.ARTIFACT_REGISTRY_REPO_NAME }}/neo4j:enterprise-dev"
NEO4J_REVERSE_PROXY_IMG: "${{ vars.ARTIFACT_REGISTRY_REPO_NAME }}/reverseproxy:${{ needs.current-date.outputs.CURRENT_DATE }}"
NEO4J_DOCKER_BACKUP_IMG: "${{ vars.ARTIFACT_REGISTRY_REPO_NAME }}/neo4j-admin:${{ needs.current-date.outputs.CURRENT_DATE }}"
container:
image: ${{ vars.ARTIFACT_REGISTRY_REPO_NAME }}/githubactions:latest
credentials:
username: _json_key
password: ${{ secrets.GCLOUD_SERVICE_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v4
- id: 'gcloud-auth'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCLOUD_SERVICE_KEY }}'
- id: 'get-credentials'
uses: 'google-github-actions/get-gke-credentials@v2'
with:
cluster_name: ${{ needs.gke-setup.outputs.CLOUDSDK_CONTAINER_CLUSTER }}
location: ${{ env.CLOUDSDK_COMPUTE_ZONE }}
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 363.0.0'
- name: Set up gotestfmt
run: go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
- name: Run Enterprise Integration and Unit tests
run: |
mkdir -p .kube
cat ${KUBECONFIG} > .kube/config
CURRENT_DIRECTORY=$(pwd)
export KUBECONFIG="${CURRENT_DIRECTORY}/.kube/config"
echo "printing kubeconfig path $KUBECONFIG"
export IPS_PASS=$(gcloud auth print-access-token)
go test -json -v -timeout ${GO_TEST_TIMEOUT} ./internal/integration_tests/ 2>&1 | tee /tmp/gotest.log | gotestfmt
go test -json -v -timeout ${GO_TEST_TIMEOUT} ./internal/unit_tests/ 2>&1 | tee /tmp/gotest.log | gotestfmt
run-community-tests:
name: Debian Community Tests
needs:
- gke-setup
- build-reverseproxy-backup
- current-date
runs-on: ubuntu-latest
env:
NEO4J_EDITION: "community"
CLOUDSDK_CONTAINER_CLUSTER: ${{ needs.gke-setup.outputs.CLOUDSDK_CONTAINER_CLUSTER }}
NEO4J_REVERSE_PROXY_IMG: "${{ vars.ARTIFACT_REGISTRY_REPO_NAME }}/reverseproxy:${{ needs.current-date.outputs.CURRENT_DATE }}"
NEO4J_DOCKER_IMG: "${{ vars.ARTIFACT_REGISTRY_REPO_NAME }}/neo4j:community-dev"
NEO4J_DOCKER_BACKUP_IMG: "${{ vars.ARTIFACT_REGISTRY_REPO_NAME }}/neo4j-admin:${{ needs.current-date.outputs.CURRENT_DATE }}"
container:
image: ${{ vars.ARTIFACT_REGISTRY_REPO_NAME }}/githubactions:latest
credentials:
username: _json_key
password: ${{ secrets.GCLOUD_SERVICE_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v4
- id: 'gcloud-auth'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCLOUD_SERVICE_KEY }}'
- id: 'get-credentials'
uses: 'google-github-actions/get-gke-credentials@v2'
with:
cluster_name: ${{ needs.gke-setup.outputs.CLOUDSDK_CONTAINER_CLUSTER }}
location: ${{ env.CLOUDSDK_COMPUTE_ZONE }}
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 363.0.0'
- name: Set up gotestfmt
run: go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
- name: Run Community Integration and Unit tests
run: |
mkdir -p .kube
cat ${KUBECONFIG} > .kube/config
CURRENT_DIRECTORY=$(pwd)
export KUBECONFIG="${CURRENT_DIRECTORY}/.kube/config"
echo "printing kubeconfig path $KUBECONFIG"
export IPS_PASS=$(gcloud auth print-access-token)
go test -json -v -timeout ${GO_TEST_TIMEOUT} ./internal/integration_tests/ 2>&1 | tee /tmp/gotest.log | gotestfmt
go test -json -v -timeout ${GO_TEST_TIMEOUT} ./internal/unit_tests/ 2>&1 | tee /tmp/gotest.log | gotestfmt
run-enterprise-tests-redhat:
name: RedHat Enterprise Tests
needs:
- gke-setup-redhat
- build-reverseproxy-backup
- current-date
runs-on: ubuntu-latest
env:
NEO4J_EDITION: "enterprise"
CLOUDSDK_CONTAINER_CLUSTER: ${{ needs.gke-setup-redhat.outputs.CLOUDSDK_CONTAINER_CLUSTER_REDHAT }}
NEO4J_DOCKER_IMG: "${{ vars.ARTIFACT_REGISTRY_REPO_NAME }}/neo4j:enterprise-dev-ubi9"
NEO4J_REVERSE_PROXY_IMG: "${{ vars.ARTIFACT_REGISTRY_REPO_NAME }}/reverseproxy:${{ needs.current-date.outputs.CURRENT_DATE }}"
NEO4J_DOCKER_BACKUP_IMG: "${{ vars.ARTIFACT_REGISTRY_REPO_NAME }}/neo4j-admin:ubi9-${{ needs.current-date.outputs.CURRENT_DATE }}"
container:
image: ${{ vars.ARTIFACT_REGISTRY_REPO_NAME }}/githubactions:latest
credentials:
username: _json_key
password: ${{ secrets.GCLOUD_SERVICE_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v4
- id: 'gcloud-auth'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCLOUD_SERVICE_KEY }}'
- id: 'get-credentials'
uses: 'google-github-actions/get-gke-credentials@v2'
with:
cluster_name: ${{ env.CLOUDSDK_CONTAINER_CLUSTER }}
location: ${{ env.CLOUDSDK_COMPUTE_ZONE }}
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 363.0.0'
- name: Set up gotestfmt
run: go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
- name: Run Enterprise Integration and Unit tests for Red Hat
run: |
mkdir -p .kube
cat ${KUBECONFIG} > .kube/config
CURRENT_DIRECTORY=$(pwd)
export KUBECONFIG="${CURRENT_DIRECTORY}/.kube/config"
echo "printing kubeconfig path $KUBECONFIG"
export IPS_PASS=$(gcloud auth print-access-token)
go test -json -v -timeout ${GO_TEST_TIMEOUT} ./internal/integration_tests/ 2>&1 | tee /tmp/gotest.log | gotestfmt
go test -json -v -timeout ${GO_TEST_TIMEOUT} ./internal/unit_tests/ 2>&1 | tee /tmp/gotest.log | gotestfmt
run-community-tests-redhat:
name: RedHat Community Tests
needs:
- gke-setup-redhat
- build-reverseproxy-backup
- current-date
runs-on: ubuntu-latest
env:
NEO4J_EDITION: "community"
CLOUDSDK_CONTAINER_CLUSTER: ${{ needs.gke-setup-redhat.outputs.CLOUDSDK_CONTAINER_CLUSTER_REDHAT }}
NEO4J_DOCKER_IMG: "${{ vars.ARTIFACT_REGISTRY_REPO_NAME }}/neo4j:community-dev-ubi9"
NEO4J_REVERSE_PROXY_IMG: "${{ vars.ARTIFACT_REGISTRY_REPO_NAME }}/reverseproxy:${{ needs.current-date.outputs.CURRENT_DATE }}"
NEO4J_DOCKER_BACKUP_IMG: "${{ vars.ARTIFACT_REGISTRY_REPO_NAME }}/neo4j-admin:ubi9-${{ needs.current-date.outputs.CURRENT_DATE }}"
container:
image: ${{ vars.ARTIFACT_REGISTRY_REPO_NAME }}/githubactions:latest
credentials:
username: _json_key
password: ${{ secrets.GCLOUD_SERVICE_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v4
- id: 'gcloud-auth'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCLOUD_SERVICE_KEY }}'
- id: 'get-credentials'
uses: 'google-github-actions/get-gke-credentials@v2'
with:
cluster_name: ${{ env.CLOUDSDK_CONTAINER_CLUSTER }}
location: ${{ env.CLOUDSDK_COMPUTE_ZONE }}
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 363.0.0'
- name: Set up gotestfmt
run: go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
- name: Run Community Integration and Unit tests for Red Hat
run: |
mkdir -p .kube
cat ${KUBECONFIG} > .kube/config
CURRENT_DIRECTORY=$(pwd)
export KUBECONFIG="${CURRENT_DIRECTORY}/.kube/config"
echo "printing kubeconfig path $KUBECONFIG"
export IPS_PASS=$(gcloud auth print-access-token)
go test -json -v -timeout ${GO_TEST_TIMEOUT} ./internal/integration_tests/ 2>&1 | tee /tmp/gotest.log | gotestfmt
go test -json -v -timeout ${GO_TEST_TIMEOUT} ./internal/unit_tests/ 2>&1 | tee /tmp/gotest.log | gotestfmt
gke-delete:
name: Debian GKE Cluster Deletion
runs-on: ubuntu-latest
if: always()
env:
CLOUDSDK_CONTAINER_CLUSTER: ${{ needs.gke-setup.outputs.CLOUDSDK_CONTAINER_CLUSTER }}
needs:
- run-enterprise-tests
- run-community-tests
- gke-setup
steps:
- name: Checkout
uses: actions/checkout@v4
- id: 'gcloud-auth'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCLOUD_SERVICE_KEY }}'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 363.0.0'
- name: Delete GKE Cluster
run: |
./bin/gcloud/delete_cluster
gke-delete-redhat:
name: RedHat GKE Cluster Deletion
runs-on: ubuntu-latest
if: always()
env:
CLOUDSDK_CONTAINER_CLUSTER: ${{ needs.gke-setup-redhat.outputs.CLOUDSDK_CONTAINER_CLUSTER_REDHAT }}
needs:
- run-enterprise-tests-redhat
- run-community-tests-redhat
- gke-setup-redhat
steps:
- name: Checkout
uses: actions/checkout@v4
- id: 'gcloud-auth'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCLOUD_SERVICE_KEY }}'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 363.0.0'
- name: Delete GKE Cluster
run: |
./bin/gcloud/delete_cluster
packaging:
name: Packaging and Release
needs:
- run-community-tests
- run-community-tests-redhat
- run-enterprise-tests
- run-enterprise-tests-redhat
runs-on: ubuntu-latest
if: ${{ github.ref_name == 'dev' && success() && github.event_name == 'workflow_dispatch' && (github.actor == 'harshitsinghvi22' || github.actor == 'bfeshti ') }}
env:
NEO4J_VERSION: ${{ inputs.NEO4J_VERSION }}
HELM_REPO_NAME: ${{ vars.HELM_REPO_NAME }}
container:
image: ${{ vars.ARTIFACT_REGISTRY_REPO_NAME }}/githubactions:latest
options: --user 1001
credentials:
username: _json_key
password: ${{ secrets.GCLOUD_SERVICE_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: '0'
fetch-tags: true
token: ${{ secrets.GH_TOKEN }}
ref: dev
- name: Version Updates
run: |
git config --global user.email [email protected]
git config --global user.name "Harshit Singhvi"
./bin/gcloud/version_updates
- name: GPG Key Signing
run: |
export AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID_GPG }}
export AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY_GPG }}
export ROLE_ARN_GPG=${{ secrets.ROLE_ARN_GPG }}
export SECRET_ID_GPG=${{ secrets.SECRET_ID_GPG }}
./bin/gcloud/gpg_signing
- name: Upload Helm Charts
run: |
export AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID_HELM }}
export AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY_HELM }}
export AWS_REGION="us-east-1"
export PACKAGE_SIGNING_KEY=${{ secrets.PACKAGE_SIGNING_KEY }}
export PACKAGE_SIGNING_PASSPHRASE=${{ secrets.PACKAGE_SIGNING_PASSPHRASE }}
./bin/gcloud/package_upload
- name: Update index.yaml
run: |
./bin/gcloud/index_yaml_update