Repository navigation
168 lines (150 loc) · 5.62 KB
/
Copy pathci.yml
File metadata and controls
168 lines (150 loc) · 5.62 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
name: CI
on:
push:
branches: [ main ]
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: [ "18", "20", "22", "24" ]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node }}
cache: npm
- run: npm ci
- name: Build
run: npm run build
- name: Typecheck
run: npm run typecheck
- name: Test
run: npm test
lint:
name: Static analysis (ESLint)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: "22"
cache: npm
- run: npm ci
- name: ESLint
run: npm run lint
coverage:
name: Coverage gate (>=90% lines)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: "22"
cache: npm
- run: npm ci
# Build first: the nestjs tests import the built @babelqueue/bullmq workspace
# package (now linked locally via the ^1.0.0 dependency), so its dist/ must exist.
- name: Build
run: npm run build
- name: Coverage
run: npm run coverage
conformance:
name: Conformance suite in sync
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Verify vendored conformance matches the canonical suite
# @babelqueue/sqs, @babelqueue/azure-service-bus, @babelqueue/pulsar, @babelqueue/kafka,
# @babelqueue/artemis, @babelqueue/redis and @babelqueue/rabbitmq each vendor the conformance
# suite (for their binding tests); guard every copy against drift.
run: |
git clone --depth 1 --branch v1.3.0 https://github.com/BabelQueue/conformance.git "$RUNNER_TEMP/conformance"
for pkg in sqs azure-service-bus pulsar kafka artemis redis rabbitmq; do
diff -u "$RUNNER_TEMP/conformance/CONFORMANCE_VERSION" "packages/$pkg/test/conformance/CONFORMANCE_VERSION"
diff -ru "$RUNNER_TEMP/conformance/manifest.json" "packages/$pkg/test/conformance/manifest.json"
diff -ru "$RUNNER_TEMP/conformance/fixtures" "packages/$pkg/test/conformance/fixtures"
diff -ru "$RUNNER_TEMP/conformance/schema" "packages/$pkg/test/conformance/schema"
done
echo "Vendored conformance is in sync with the canonical suite."
integration:
name: Integration (live Kafka + Artemis)
# Opt-in, not a required check: runs on push to main and on demand, never on pull requests,
# and is deliberately NOT in ci-green's needs.
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
timeout-minutes: 20
services:
kafka:
image: apache/kafka:3.9.0
ports:
- 9092:9092
env:
KAFKA_NODE_ID: 1
KAFKA_PROCESS_ROLES: broker,controller
KAFKA_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
KAFKA_CONTROLLER_QUORUM_VOTERS: 1@localhost:9093
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
options: >-
--health-cmd "/opt/kafka/bin/kafka-broker-api-versions.sh --bootstrap-server localhost:9092"
--health-interval 10s --health-timeout 10s --health-retries 12 --health-start-period 20s
artemis:
image: apache/activemq-artemis:2.37.0
ports:
- 5672:5672
- 61616:61616
env:
ARTEMIS_USER: artemis
ARTEMIS_PASSWORD: artemis
options: >-
--health-cmd "/var/lib/artemis-instance/bin/artemis check node --up --user artemis --password artemis"
--health-interval 10s --health-timeout 10s --health-retries 12 --health-start-period 20s
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: "22"
cache: npm
- run: npm ci
# kafkajs and rhea are optional peers of the adapters, so they are not workspace dependencies;
# install them for this job only (pinned) without touching package.json / the lockfile.
- name: Install optional peers
run: npm install --no-save kafkajs@2.2.4 rhea@3.0.5
- name: Kafka integration tests
working-directory: packages/kafka
env:
BQ_INTEGRATION: "1"
BQ_KAFKA_BROKERS: localhost:9092
run: node --import tsx --test test/kafka-integration.test.ts
- name: Artemis integration tests
working-directory: packages/artemis
env:
BQ_INTEGRATION: "1"
BQ_ARTEMIS_HOST: localhost
BQ_ARTEMIS_PORT: "5672"
BQ_ARTEMIS_USER: artemis
BQ_ARTEMIS_PASSWORD: artemis
run: node --import tsx --test test/artemis-integration.test.ts
ci-green:
name: CI green
runs-on: ubuntu-latest
needs: [test, lint, coverage, 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