-
Notifications
You must be signed in to change notification settings - Fork 61
558 lines (474 loc) · 14.5 KB
/
Copy pathci.yml
File metadata and controls
558 lines (474 loc) · 14.5 KB
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
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
name: CI
on:
pull_request:
paths:
- Makefile
- 'src/**'
- 'spec/**'
- 'shard.*'
- 'static/**'
- 'views/**'
- '.github/workflows/ci.yml'
- 'build/build_docs_in_ci'
- 'openapi/**'
push:
branches:
- main
- 'v[0-9]+.[0-9]+.x'
paths:
- Makefile
- 'src/**'
- 'spec/**'
- 'shard.*'
- 'static/**'
- 'views/**'
- '.github/workflows/ci.yml'
- 'build/build_docs_in_ci'
- 'openapi/**'
workflow_dispatch:
jobs:
format:
name: Format check
runs-on: ubuntu-latest
continue-on-error: true
container: 84codes/crystal:latest-ubuntu-24.04
steps:
- uses: actions/checkout@v6
- run: crystal tool format --check
lint:
name: Lint check
runs-on: ubuntu-latest
continue-on-error: true
container: 84codes/crystal:latest-ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v6
- run: shards install
- run: make lint
lint-js:
name: Lint javascript
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: latest
- name: Run standard
run: make lint-js
lint-openapi:
name: Lint OpenAPI
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: latest
- name: Run spectral
run: make lint-openapi
spec:
name: Spec
runs-on: ubuntu-latest
container: 84codes/crystal:latest-ubuntu-24.04
timeout-minutes: 10
steps:
- name: Print Crystal version
run: crystal -v
- name: Install dependencies
run: apt-get update && apt-get install -y liblz4-dev etcd-server
- name: Checkout
uses: actions/checkout@v6
- name: Spec
run: make test
spec_osx:
name: Spec macOS
runs-on: macos-15-xlarge
if: github.repository == 'cloudamqp/lavinmq'
timeout-minutes: 10
steps:
- name: Install dependencies
run: |
brew update
brew install crystal etcd
echo "/opt/homebrew/opt/etcd/bin" >> $GITHUB_PATH
env:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
- run: crystal --version
- uses: actions/checkout@v6
- name: Spec
run: make test
compile-changed-files:
name: Compile changed *.cr files independently
runs-on: ubuntu-latest
container: 84codes/crystal:latest-ubuntu-24.04
steps:
- name: Install dependencies
run: apt-get update && apt-get install -y liblz4-dev git
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Configure git safe directory
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Install shards
run: shards install --without-development
- name: Determine changed *.cr files
id: changed
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
base="${{ github.event.pull_request.base.sha }}"
head="${{ github.event.pull_request.head.sha }}"
else
base="${{ github.event.before }}"
head="${{ github.sha }}"
fi
if [ -z "$base" ] || [ "$base" = "0000000000000000000000000000000000000000" ]; then
base="$(git rev-parse "$head^")"
fi
files=$(git diff --name-only --diff-filter=ACMR "$base" "$head" -- 'src/**/*.cr' | tr '\n' ' ')
echo "files=$files" >> "$GITHUB_OUTPUT"
echo "Changed files: $files"
- name: Compile each changed file independently
if: steps.changed.outputs.files != ''
run: |
status=0
for f in ${{ steps.changed.outputs.files }}; do
if [ -f "$f" ]; then
echo "::group::crystal build --no-codegen $f"
crystal build --no-codegen --error-on-warnings -Dpreview_mt -Dexecution_context "$f" || status=1
echo "::endgroup::"
fi
done
exit $status
compile:
name: Compile LavinMQ
runs-on: ubuntu-latest
container: 84codes/crystal:latest-ubuntu-24.04
steps:
- name: Install dependencies
run: apt-get update && apt-get install -y liblz4-dev
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true
- name: Configure git safe directory
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Build lavinmq
run: make -j bin/lavinmq bin/lavinmqctl bin/stress DOCS= CRYSTAL_FLAGS="--release --error-on-warnings"
- name: Print build info
run: bin/lavinmq --build-info
- name: Upload bin/
uses: actions/upload-artifact@v7
with:
name: bin
path: bin/
path_filter:
name: Filters for frontend specs
runs-on: ubuntu-latest
outputs:
frontend_changed: ${{ steps.changes.outputs.js == 'true' || steps.changes.outputs.views == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v6
- uses: dorny/paths-filter@v4
id: changes
with:
filters: |
views:
- 'views/**'
js:
- '**/*.js'
spec_frontend:
name: Frontend specs
runs-on: ubuntu-24.04
needs: [compile, path_filter]
if: ${{ github.ref_name == 'main' || needs.path_filter.outputs.frontend_changed == 'true' }}
steps:
- name: Install LavinMQ dependencies
run: |
sudo apt-get update
sudo apt-get install -y make liblz4-1
- name: Download lavinmq
uses: actions/download-artifact@v8
with:
name: bin
path: bin
- name: Run LavinMQ in background
run: |
chmod +x bin/*
bin/lavinmq --data-dir=/tmp/amqp --bind=:: &
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 24
- name: Install playwright
run: npm install @playwright/test
- name: Install browsers
run: npx playwright install --with-deps
- name: Run tests
run: npx playwright test --config ./spec/frontend/playwright.config.js --reporter list
- uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 10
java-client-test:
name: RabbitMQ java client test
runs-on: ubuntu-24.04
needs: compile
continue-on-error: true
steps:
- name: Install LavinMQ dependencies
run: |
sudo apt-get update
sudo apt-get install -y make openjdk-21-jre-headless liblz4-1
- uses: actions/download-artifact@v8
with:
name: bin
path: bin
- name: Run LavinMQ in background
run: |
chmod +x bin/*
bin/lavinmq --data-dir=/tmp/amqp --bind=:: &
- name: Clone java client
uses: actions/checkout@v6
with:
repository: rabbitmq/rabbitmq-java-client
ref: v5.25.0
path: rabbitmq-java-client
- name: Get patch file
uses: actions/checkout@v6
with:
repository: cloudamqp/lavinmq
path: lavinmq
# only checkout the lint rules
sparse-checkout: |
.github/rabbitmq-java-client.patch
sparse-checkout-cone-mode: false
- name: Patch tests
run: |
cd rabbitmq-java-client
git apply ../lavinmq/.github/rabbitmq-java-client.patch
- name: Run tests
id: test
continue-on-error: true
run: |
cd rabbitmq-java-client
make deps
./mvnw verify -Dtest-broker.A.nodename=lavin@testhost -Dit.test=ClientTestSuite,FunctionalTestSuite -Drabbitmqctl.bin=../bin/lavinmqctl
- name: >-
Test outcome: ${{ steps.test.outcome }}
run: echo NOOP
bunny-test:
name: Bunny client test
runs-on: ubuntu-24.04
needs: compile
steps:
- name: Install LavinMQ dependencies
run: |
sudo apt-get update
sudo apt-get install -y liblz4-1
- name: Checkout LavinMQ for bunny_definitions.json
uses: actions/checkout@v6
- uses: actions/download-artifact@v8
with:
name: bin
path: bin
- name: Run LavinMQ in background
run: |
chmod +x bin/lavinmq
bin/lavinmq --data-dir /tmp/amqp &
- name: Import definitions
run: |
chmod +x bin/lavinmqctl
bin/lavinmqctl import_definitions .github/bunny_definitions.json
- name: Clone Bunny
uses: actions/checkout@v6
with:
repository: ruby-amqp/bunny
path: bunny
fetch-depth: 0
ref: 55bb3d2accc293911120ea7dc7330cf06eda41c2
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
working-directory: bunny
ruby-version: ruby
- name: Run specs
run: |
cd bunny
sed -i /rabbitmq_http_api_client/d Gemfile
bundle add rabbitmq_http_api_client --version=">= 3" --group=test --require=rabbitmq/http/client
bundle install
sed -i '211,212d' spec/lower_level_api/integration/queue_declare_spec.rb
sed -i '112,146d' spec/lower_level_api/integration/queue_declare_spec.rb
bundle exec rspec \
--pattern "spec/*/integration/*_spec.rb, spec/issues/*_spec.rb" \
--exclude-pattern "**/*/tls_*, **/*/connection_recovery_*, **/*/default_queue_type*"
ruby-http-api-test:
name: RabbitMQ HTTP API Ruby client test
runs-on: ubuntu-24.04
needs: compile
continue-on-error: true
if: github.event.pull_request.head.repo.full_name == github.repository
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y liblz4-1
- uses: actions/download-artifact@v8
with:
name: bin
path: bin
- name: Run LavinMQ in background
run: |
chmod +x bin/lavinmq
bin/lavinmq --data-dir /tmp/amqp &
- name: Clone HTTP API client
uses: actions/checkout@v6
with:
repository: cloudamqp/rabbitmq_http_api_client
token: ${{ secrets.PRIVATE_REPO_ACCESS }}
path: rabbitmq_http_api_client
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
working-directory: rabbitmq_http_api_client
ruby-version: 2.7.1
bundler-cache: true
- name: Run specs
run: |
cd rabbitmq_http_api_client
bundle exec rspec
go-http-api-test:
name: RabbitMQ HTTP API Go client test
runs-on: ubuntu-24.04
needs: compile
continue-on-error: true
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y liblz4-1
- uses: actions/download-artifact@v8
with:
name: bin
path: bin
- name: Run LavinMQ in background
run: |
chmod +x bin/*
bin/lavinmq --data-dir /tmp/amqp &
- name: Install Go
uses: actions/setup-go@v6
with:
go-version: 1.26.3
- name: Clone http client
uses: actions/checkout@v6
with:
repository: michaelklishin/rabbit-hole
ref: 2ed025ce479a5dfeaa6493eaa05f50284eb97c88
path: rabbit-hole
- name: Get patch file
uses: actions/checkout@v6
with:
repository: cloudamqp/lavinmq
path: lavinmq
# only checkout the lint rules
sparse-checkout: |
.github/rabbit-hole.patch
sparse-checkout-cone-mode: false
- name: Setup rabbit-hole
run: |
cd rabbit-hole
git apply ../lavinmq/.github/rabbit-hole.patch
bash bin/ci/before_build.sh
env:
RABBITHOLE_LAVINMQCTL: ../bin/lavinmqctl
- name: Run specs
run: |
cd rabbit-hole
go test -v ./...
release-mode-test:
name: Test in release mode
runs-on: ubuntu-24.04
needs: compile
continue-on-error: true
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y liblz4-1
- name: Checkout
uses: actions/checkout@v6
- uses: actions/download-artifact@v8
with:
name: bin
path: bin
- name: Run LavinMQ in background
run: |
chmod +x bin/lavinmq
bin/lavinmq --data-dir /tmp/amqp &
- name: Test the static HTTP controller
run: ./extras/static_requests.sh
freebsd-test:
if: false # Crystal is outdated in FreeBSD
name: Spec FreeBSD
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- name: Spec
uses: vmactions/freebsd-vm@v1
with:
usesh: true
prepare: pkg install -y crystal shards security/openssl curl gmake coreos-etcd34
run: gmake test
continue-on-error: true
stress:
name: Stress test
runs-on: ubuntu-24.04
needs: compile
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y liblz4-1
- name: Checkout
uses: actions/checkout@v6
- uses: actions/download-artifact@v8
with:
name: bin
path: bin
- name: Run LavinMQ in background
run: |
chmod +x bin/lavinmq
bin/lavinmq --data-dir /tmp/amqp --pidfile /tmp/lavinmq.pid >lavinmq.log 2>&1 &
- name: Run stress test
run: |
chmod +x bin/stress
bin/stress
- name: Shutdown LavinMQ
run: |
pid=$(cat /tmp/lavinmq.pid)
kill "$pid"
for _ in $(seq 1 10); do
kill -0 "$pid" 2>/dev/null || exit 0
sleep 1
done
echo "::warning::LavinMQ did not exit within 10s, sending SIGKILL"
kill -9 "$pid"
exit 1
- name: Print LavinMQ log
if: ${{ !cancelled() }}
run: cat lavinmq.log
- name: Check LavinMQ log for errors
if: ${{ !cancelled() }}
run: |
if grep -E '^[^ ]+ +(ERROR|FATAL) |^Unhandled exception' lavinmq.log; then
echo "::error::Found errors in LavinMQ log"
exit 1
fi