-
-
Notifications
You must be signed in to change notification settings - Fork 0
254 lines (228 loc) · 9.69 KB
/
Copy pathci.yml
File metadata and controls
254 lines (228 loc) · 9.69 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
name: CI
on:
push:
branches: [ main ]
pull_request:
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go: [ "1.24", "1.25" ]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version: ${{ matrix.go }}
check-latest: true
- name: Verify gofmt
run: |
unformatted=$(gofmt -l .)
if [ -n "$unformatted" ]; then
echo "These files are not gofmt-ed:"
echo "$unformatted"
exit 1
fi
- name: Vet & test core (zero dependencies)
run: |
go vet ./...
go test -race -count=1 ./...
- name: Build & vet transport modules
run: |
(cd redis && go build ./... && go vet ./...)
(cd amqp && go build ./... && go vet ./...)
# The SQS module's unit + conformance tests are network-free (fake
# client), so they run here across the Go matrix; the live ElasticMQ
# round-trip is `-tags=integration` in the integration job below.
(cd sqs && go build ./... && go vet ./... && go test -race -count=1 ./...)
# The Redis idempotency store (ADR-0022) floors at Go 1.24 (the core's floor);
# its unit tests are broker-free (a fake client seam), so it runs across the whole
# Go matrix; the live Redis path skips unless BABELQUEUE_TEST_REDIS is set.
(cd idempotency-redis && go build ./... && go vet ./... && go test -race -count=1 ./...)
- name: Build & vet the Go 1.25 modules (otel, idempotency-postgres)
# Both floor at Go 1.25 (their security-fixed dependencies — otel/sdk, pgx and
# x/crypto — require it), so they build/test only on matrix entries that satisfy
# that floor. The OpenTelemetry module (ADR-0025) uses an in-memory span recorder;
# the Postgres idempotency store (ADR-0022) uses go-sqlmock, and its live DB path
# skips unless BABELQUEUE_TEST_PG is set.
if: ${{ matrix.go == '1.25' }}
run: |
(cd otel && go build ./... && go vet ./... && go test -race -count=1 ./...)
(cd idempotency-postgres && go build ./... && go vet ./... && go test -race -count=1 ./...)
- name: Build & vet the Azure Service Bus module
# This module floors at Go 1.25 (its security-fixed golang.org/x/net requires it), so
# it builds/tests only on matrix entries that satisfy that floor (its unit +
# conformance tests are network-free — a fake client).
if: ${{ matrix.go == '1.25' }}
run: |
(cd azureservicebus && go build ./... && go vet ./... && go test -race -count=1 ./...)
- name: Build & vet the Apache Pulsar module
# The pure-Go pulsar-client-go (no CGo, no libpulsar) sits behind this module's Go
# 1.25 floor (pulsar-client-go and golang.org/x/net require it), so it builds/tests
# only on matrix entries that satisfy that floor (its unit tests are network-free —
# a fake client).
if: ${{ matrix.go == '1.25' }}
run: |
(cd pulsar && go build ./... && go vet ./... && go test -race -count=1 ./...)
- name: Build & vet the Apache Kafka module
# The pure-Go segmentio/kafka-go (no CGo, no librdkafka) sits behind this module's Go
# 1.24 floor; its unit tests are network-free (fake Writer/Reader).
run: |
(cd kafka && go build ./... && go vet ./... && go test -race -count=1 ./...)
- name: Build & vet the Apache ActiveMQ Artemis module
# The pure-Go Azure/go-amqp (AMQP 1.0, no CGo); this module floors at Go 1.25, so it
# builds/tests only on matrix entries that satisfy that floor. Its unit tests are
# network-free (fake Sender/Receiver/Client seam).
if: ${{ matrix.go == '1.25' }}
run: |
(cd artemis && go build ./... && go vet ./... && go test -race -count=1 ./...)
- name: Build & vet the asynq adapter module
# hibiken/asynq requires Go 1.24+ — every matrix entry satisfies it; its unit +
# conformance tests are network-free (a fake Enqueuer seam — no Redis).
run: |
(cd asynq && go build ./... && go vet ./... && go test -race -count=1 ./...)
- name: Build & vet the machinery adapter module
# RichardKnop/machinery v2 needs Go 1.22+; this module floors at 1.24. Its unit +
# conformance tests are network-free (fake Sender/Registrar seams — no broker).
run: |
(cd machinery && go build ./... && go vet ./... && go test -race -count=1 ./...)
lint:
name: Static analysis (staticcheck)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version: "stable"
check-latest: true
- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@latest
- name: staticcheck (core + transport modules)
run: |
staticcheck ./...
(cd redis && staticcheck ./...)
(cd amqp && staticcheck ./...)
(cd sqs && staticcheck ./...)
(cd azureservicebus && staticcheck ./...)
(cd pulsar && staticcheck ./...)
(cd kafka && staticcheck ./...)
(cd artemis && staticcheck ./...)
(cd asynq && staticcheck ./...)
(cd machinery && staticcheck ./...)
(cd idempotency-postgres && staticcheck ./...)
(cd idempotency-redis && staticcheck ./...)
coverage:
name: Coverage gate (>=90%)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version: "stable"
check-latest: true
- name: Core coverage gate
run: bash scripts/check-coverage.sh 90
integration:
runs-on: ubuntu-latest
services:
redis:
image: redis:7
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s --health-timeout 3s --health-retries 5
rabbitmq:
image: rabbitmq:3
ports:
- 5672:5672
options: >-
--health-cmd "rabbitmq-diagnostics -q ping"
--health-interval 10s --health-timeout 5s --health-retries 10
# Free, SQS-compatible broker for the SQS transport's live round-trip.
# The native image is shell-less, so readiness is polled by a TCP-probe
# step below rather than a container `--health-cmd`.
elasticmq:
image: softwaremill/elasticmq-native:1.6.11
ports:
- 9324:9324
# PostgreSQL for the idempotency-postgres store's live claim/concurrency tests.
postgres:
image: postgres:16
env:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 5s --health-timeout 3s --health-retries 5
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version: "stable"
- name: Redis transport integration tests
working-directory: redis
env:
REDIS_URL: redis://localhost:6379/0
run: go test -race -count=1 ./...
- name: RabbitMQ transport integration tests
working-directory: amqp
env:
AMQP_URL: amqp://guest:guest@localhost:5672/
run: go test -race -count=1 ./...
- name: Wait for ElasticMQ
run: |
for i in $(seq 1 30); do
if (echo > /dev/tcp/localhost/9324) >/dev/null 2>&1; then
echo "ElasticMQ port 9324 open"; exit 0
fi
sleep 2
done
echo "ElasticMQ did not open port 9324"; exit 1
- name: Amazon SQS transport integration tests (ElasticMQ)
working-directory: sqs
env:
SQS_ENDPOINT: http://localhost:9324
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
run: go test -tags=integration -race -count=1 ./...
- name: Redis idempotency store integration tests
working-directory: idempotency-redis
env:
BABELQUEUE_TEST_REDIS: redis://localhost:6379/0
run: go test -race -count=1 ./...
- name: PostgreSQL idempotency store integration tests
working-directory: idempotency-postgres
env:
BABELQUEUE_TEST_PG: postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable
run: go test -race -count=1 ./...
conformance:
name: Conformance suite in sync
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Verify vendored conformance matches the canonical suite
run: |
git clone --depth 1 --branch v1.0.0 https://github.com/BabelQueue/conformance.git "$RUNNER_TEMP/conformance"
diff -u "$RUNNER_TEMP/conformance/CONFORMANCE_VERSION" "testdata/conformance/CONFORMANCE_VERSION"
diff -ru "$RUNNER_TEMP/conformance/manifest.json" "testdata/conformance/manifest.json"
diff -ru "$RUNNER_TEMP/conformance/fixtures" "testdata/conformance/fixtures"
diff -ru "$RUNNER_TEMP/conformance/schema" "testdata/conformance/schema"
echo "Vendored conformance is in sync with the canonical suite."
ci-green:
name: CI green
runs-on: ubuntu-latest
needs: [test, lint, coverage, integration, conformance]
if: ${{ always() }}
steps:
- name: Fail if any required job did not pass
run: |
if ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}; then
echo "A required job failed or was cancelled."
exit 1
fi