-
Notifications
You must be signed in to change notification settings - Fork 268
394 lines (328 loc) · 14.5 KB
/
verify.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
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
name: Verify Build Workflow
on:
push:
paths-ignore:
- '.gitignore'
- 'LICENSE'
- 'README*'
- 'docs/**'
- '.github/workflows/**'
branches: [ main ]
pull_request:
paths-ignore:
- '.gitignore'
- 'LICENSE'
- 'README*'
- 'docs/**'
branches: [ main ]
concurrency:
# Only run once for latest commit per ref and cancel other (previous) runs.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-verify:
name: Verify Application Build
runs-on: ubuntu-22.04
if: github.repository_owner == 'Apicurio' && !contains(github.event.*.labels.*.name, 'DO NOT MERGE')
steps:
- name: Checkout Code with Ref '${{ github.ref }}'
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'
# Open-Source Machine emulator that allows you to emulate multiple CPU architectures on your machine
- name: Set up QEMU
if: github.event_name == 'push'
uses: docker/setup-qemu-action@v1
# Docker CLI plugin for extended build capabilities with BuildKit
- name: Set up Docker Buildx
if: github.event_name == 'push'
id: buildx
uses: docker/setup-buildx-action@v1
- name: Inspect builder
if: github.event_name == 'push'
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
- name: Run linter
run: ./scripts/validate-files.sh
- name: Verify docs generation
run: |
if [ -n "$(git status --untracked-files=no --porcelain docs)" ]; then
echo "Docs needs to be regenerated. Run 'mvn clean install -pl docs -am -DskipTests' and commit the resulting files in the 'docs' folder."
git --no-pager diff docs
exit 1
fi
- name: Build and Test Application
run: ./mvnw clean package --no-transfer-progress -Pprod -DskipTests=false -DskipCommitIdPlugin=false -Dmaven.wagon.httpconnectionManager.maxTotal=30 -Dmaven.wagon.http.retryHandler.count=5
- name: Login to DockerHub Registry
if: github.event_name == 'push'
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Login to Quay.io Registry
if: github.event_name == 'push'
run: docker login -u "${{ secrets.QUAY_USERNAME }}" -p "${{ secrets.QUAY_PASSWORD }}" quay.io
- name: Build and Push Application Multi-arch Images
if: github.event_name == 'push'
run: |
docker buildx build --push -f ./distro/docker/target/docker/Dockerfile.jvm -t docker.io/apicurio/apicurio-registry:latest-snapshot -t quay.io/apicurio/apicurio-registry:latest-snapshot --platform linux/amd64,linux/arm64,linux/s390x,linux/ppc64le ./distro/docker/target/docker
- name: Google Chat Notification (Always)
if: github.event_name == 'push' && always()
uses: Co-qn/google-chat-notification@b9227d9daa4638c9782a5bd16c4abb86268127a1
with:
name: ${{ github.job }}
url: ${{ secrets.GOOGLE_CHAT_WEBHOOK }}
status: ${{ job.status }}
- name: Google Chat Notification (Error)
if: github.event_name == 'push' && failure()
uses: Co-qn/google-chat-notification@b9227d9daa4638c9782a5bd16c4abb86268127a1
with:
name: ${{ github.job }}
url: ${{ secrets.GOOGLE_CHAT_WEBHOOK_ERRORS }}
status: ${{ job.status }}
build-verify-ui:
name: Verify UI Build
runs-on: ubuntu-22.04
if: github.repository_owner == 'Apicurio' && !contains(github.event.*.labels.*.name, 'DO NOT MERGE')
steps:
- name: Checkout Code with Ref '${{ github.ref }}'
uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
cache-dependency-path: 'ui/**/package-lock.json'
# Open-Source Machine emulator that allows you to emulate multiple CPU architectures on your machine
- name: Set up QEMU
if: github.event_name == 'push'
uses: docker/setup-qemu-action@v1
# Docker CLI plugin for extended build capabilities with BuildKit
- name: Set up Docker Buildx
if: github.event_name == 'push'
id: buildx
uses: docker/setup-buildx-action@v1
- name: Inspect builder
if: github.event_name == 'push'
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
- name: Install Dependencies
working-directory: ui
run: npm install
- name: Lint
working-directory: ui
run: npm run lint
- name: Build
working-directory: ui
run: npm run build
- name: Package
working-directory: ui
run: npm run package
- name: Install Test Dependencies
working-directory: ui/tests
run: npm install
- name: Lint Tests
working-directory: ui/tests
run: npm run lint
- name: Login to DockerHub Registry
if: github.event_name == 'push'
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Login to Quay.io Registry
if: github.event_name == 'push'
run: docker login -u "${{ secrets.QUAY_USERNAME }}" -p "${{ secrets.QUAY_PASSWORD }}" quay.io
- name: Build and Push UI Multi-arch Images
if: github.event_name == 'push'
working-directory: ui
run: docker buildx build --push -f ./Dockerfile -t quay.io/apicurio/apicurio-registry-ui:latest-snapshot -t docker.io/apicurio/apicurio-registry-ui:latest-snapshot --platform linux/amd64,linux/arm64,linux/s390x,linux/ppc64le .
- name: Google Chat Notification (Always)
if: github.event_name == 'push' && always()
uses: Co-qn/google-chat-notification@b9227d9daa4638c9782a5bd16c4abb86268127a1
with:
name: ${{ github.job }}
url: ${{ secrets.GOOGLE_CHAT_WEBHOOK }}
status: ${{ job.status }}
- name: Google Chat Notification (Error)
if: github.event_name == 'push' && failure()
uses: Co-qn/google-chat-notification@b9227d9daa4638c9782a5bd16c4abb86268127a1
with:
name: ${{ github.job }}
url: ${{ secrets.GOOGLE_CHAT_WEBHOOK_ERRORS }}
status: ${{ job.status }}
build-native-images:
name: Build and Test Native images
runs-on: ubuntu-22.04
if: github.repository_owner == 'Apicurio' && !contains(github.event.*.labels.*.name, 'DO NOT MERGE')
steps:
- name: Checkout Code with Ref '${{ github.ref }}'
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
- name: Workaround jackson-coreutils
run: |
# upstream issue: https://github.com/java-json-tools/jackson-coreutils/issues/59
rm -rf ~/.m2/repository/com/github/java-json-tools
mkdir -p /tmp/coreutils-workaround
( cd /tmp/coreutils-workaround && mvn dependency:get -DremoteRepositories=https://repo1.maven.org/maven2 -Dartifact=com.github.java-json-tools:jackson-coreutils:2.0 )
- name: Build Application
run: ./mvnw clean package -pl app,distro/docker -am -Pprod -DskipTests=true -DskipCommitIdPlugin=false -Dmaven.wagon.httpconnectionManager.maxTotal=30 -Dmaven.wagon.http.retryHandler.count=5 --no-transfer-progress
- name: Build Native executables
env:
SKIP_TESTS: "true"
run: |
./mvnw package --no-transfer-progress -Pnative -Dquarkus.native.container-build=true -Pprod -DskipTests=true
- name: Build and Push Temporary image for testing
env:
IMAGE_REPO: ttl.sh/${{ github.sha }}
# maximum allowed
IMAGE_TAG: 1d
run: |
docker build --push -f ./distro/docker/target/docker/Dockerfile.native -t ttl.sh/${{ github.sha }}/apicurio/apicurio-registry-native:1d app/
- name: Setup Minikube
uses: manusa/[email protected]
with:
minikube version: 'v1.31.1'
kubernetes version: 'v1.26.3'
github token: ${{ secrets.GITHUB_TOKEN }}
driver: docker
- name: Prepare minikube tunnel
run: minikube tunnel &> /dev/null &
- name: Run Integration Tests - Native
run: ./mvnw verify -am -Pci --no-transfer-progress -Pintegration-tests -Dregistry-in-memory-image=ttl.sh/${{ github.sha }}/apicurio/apicurio-registry-native:1d -Premote-mem -pl integration-tests -Dmaven.javadoc.skip=true
- name: Run Integration Tests - Native - Auth
run: ./mvnw verify -am -Pauth --no-transfer-progress -Pintegration-tests -Dregistry-in-memory-image=ttl.sh/${{ github.sha }}/apicurio/apicurio-registry-native:1d -Premote-mem -pl integration-tests -Dmaven.javadoc.skip=true
- name: Collect logs
if: failure()
run: ./.github/scripts/collect_logs.sh
- name: Upload tests logs artifacts
if: failure()
uses: actions/[email protected]
with:
name: tests-logs
path: artifacts
- name: Login to DockerHub Registry
if: github.event_name == 'push'
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Login to Quay.io Registry
if: github.event_name == 'push'
run: docker login -u "${{ secrets.QUAY_USERNAME }}" -p "${{ secrets.QUAY_PASSWORD }}" quay.io
- name: Build and Push Native Images
env:
IMAGE_REPO: quay.io
IMAGE_TAG: latest-snapshot
if: github.event_name == 'push'
run: |
docker build --push -f ./distro/docker/target/docker/Dockerfile.native \
-t quay.io/apicurio/apicurio-registry-native:latest-snapshot \
-t docker.io/apicurio/apicurio-registry-native:latest-snapshot \
app/
- name: List All The Images
run: docker images
- name: Google Chat Notification (Always)
if: github.event_name == 'push' && always()
uses: Co-qn/google-chat-notification@b9227d9daa4638c9782a5bd16c4abb86268127a1
with:
name: ${{ github.job }}
url: ${{ secrets.GOOGLE_CHAT_WEBHOOK }}
status: ${{ job.status }}
- name: Google Chat Notification (Error)
if: github.event_name == 'push' && failure()
uses: Co-qn/google-chat-notification@b9227d9daa4638c9782a5bd16c4abb86268127a1
with:
name: ${{ github.job }}
url: ${{ secrets.GOOGLE_CHAT_WEBHOOK_ERRORS }}
status: ${{ job.status }}
build-verify-python-sdk:
name: Verify Python SDK
runs-on: ubuntu-22.04
if: github.repository_owner == 'Apicurio' && !contains(github.event.*.labels.*.name, 'DO NOT MERGE')
steps:
- name: Checkout Code with Ref '${{ github.ref }}'
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install Poetry
uses: snok/install-poetry@d45b6d76012debf457ab49dffc7fb7b2efe8071d
- name: Install the package
working-directory: python-sdk
run: make install
- name: Check linting
working-directory: python-sdk
run: make lint-check
- name: Build Registry
run: mvn clean package -pl app -am -Dskip.npm -DskipTests=true --no-transfer-progress
- name: Run the tests
working-directory: python-sdk
run: make test
build-verify-go-sdk:
name: Verify Go SDK
runs-on: ubuntu-22.04
if: github.repository_owner == 'Apicurio' && !contains(github.event.*.labels.*.name, 'DO NOT MERGE')
steps:
- name: Checkout Code with Ref '${{ github.ref }}'
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'
- name: Go - Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.20'
- name: Build Registry
run: mvn clean package -pl app -am -Dskip.npm -DskipTests=true --no-transfer-progress
- name: Run the tests
working-directory: go-sdk
run: make test
notify-sdk:
if: github.repository_owner == 'Apicurio' && github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.*.labels.*.name, 'DO NOT MERGE')
runs-on: ubuntu-22.04
strategy:
matrix:
language: [ js ]
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@b2feaf19c27470162a626bd6fa8438ae5b263721
id: changes
with:
base: main
filters: |
openapi:
- 'app/src/main/resources-unfiltered/META-INF/resources/api-specifications/registry/v3/openapi.json'
- name: Repository Dispatch
if: steps.changes.outputs.openapi == 'true'
uses: peter-evans/repository-dispatch@ce5485de42c9b2622d2ed064be479e8ed65e76f4
with:
token: ${{ secrets.ACCESS_TOKEN }}
repository: Apicurio/apicurio-registry-client-sdk-${{ matrix.language }}
event-type: on-oas-updated
client-payload: '{"openapi_file_path": "app/src/main/resources-unfiltered/META-INF/resources/api-specifications/registry/v3/openapi.json"}'
# Trigger a deployment workflow in the apicurio-operate-first repository, which will
# deploy the `latest-snapshot` version of registry into the 3scale OpenShift cluster
# that we just built and pushed in the steps above.
trigger-3scale-deploy:
needs: [build-verify, build-verify-ui]
if: github.event_name == 'push'
uses: apicurio/apicurio-3scale-gitops/.github/workflows/deploy_latest_registry.yml@main
secrets: inherit