|
| 1 | +name: DevBox CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + paths: |
| 6 | + - 'devbox/**' |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + level: |
| 10 | + description: 'Test level' |
| 11 | + type: choice |
| 12 | + options: [lint, smoke, full] |
| 13 | + default: smoke |
| 14 | + |
| 15 | +concurrency: |
| 16 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 17 | + cancel-in-progress: true |
| 18 | + |
| 19 | +permissions: |
| 20 | + contents: read |
| 21 | + |
| 22 | +env: |
| 23 | + AUTOMQ_DEV_HOME: ${{ github.workspace }} |
| 24 | + |
| 25 | +jobs: |
| 26 | + lint: |
| 27 | + name: Lint |
| 28 | + runs-on: ubuntu-latest |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v4 |
| 31 | + |
| 32 | + - name: Install just |
| 33 | + uses: extractions/setup-just@v2 |
| 34 | + |
| 35 | + - name: Validate justfile |
| 36 | + working-directory: devbox |
| 37 | + run: just --list |
| 38 | + |
| 39 | + - name: Validate docker-compose |
| 40 | + working-directory: devbox |
| 41 | + run: | |
| 42 | + for p in single cluster cluster4 cluster5 tabletopic analytics; do |
| 43 | + echo "=== Profile: $p ===" |
| 44 | + docker compose -f docker-compose.yml --profile $p config --services |
| 45 | + done |
| 46 | +
|
| 47 | + - name: Validate config generation |
| 48 | + working-directory: devbox |
| 49 | + run: | |
| 50 | + # Generate cluster-id without kafka-storage.sh |
| 51 | + mkdir -p .devbox |
| 52 | + echo "test-cluster-id" > .devbox/cluster-id |
| 53 | +
|
| 54 | + # Single node, no features |
| 55 | + just generate-config 1 "" |
| 56 | + grep -q "node.id=0" .devbox/config/node-0.properties |
| 57 | + grep -q "controller.quorum.voters=0@node-0:9093" .devbox/config/node-0.properties |
| 58 | + ! grep -q "broker.rack" .devbox/config/node-0.properties |
| 59 | + echo "✓ Single node config OK" |
| 60 | +
|
| 61 | + # 3-node cluster with zerozone |
| 62 | + just generate-config 3 "zerozone" |
| 63 | + grep -q "broker.rack=az-0" .devbox/config/node-0.properties |
| 64 | + grep -q "broker.rack=az-1" .devbox/config/node-1.properties |
| 65 | + grep -q "broker.rack=az-2" .devbox/config/node-2.properties |
| 66 | + grep -q "zonerouter" .devbox/config/node-0.properties |
| 67 | + grep -q "controller.quorum.voters=0@node-0:9093,1@node-1:9093,2@node-2:9093" .devbox/config/node-0.properties |
| 68 | + echo "✓ Cluster + zerozone config OK" |
| 69 | +
|
| 70 | + # Tabletopic feature |
| 71 | + just generate-config 1 "tabletopic" |
| 72 | + grep -q "automq.table.topic.catalog.type=rest" .devbox/config/node-0.properties |
| 73 | + echo "✓ Tabletopic config OK" |
| 74 | +
|
| 75 | + # Combined features |
| 76 | + just generate-config 1 "tabletopic zerozone" |
| 77 | + grep -q "automq.table.topic" .devbox/config/node-0.properties |
| 78 | + grep -q "zonerouter" .devbox/config/node-0.properties |
| 79 | + grep -q "broker.rack" .devbox/config/node-0.properties |
| 80 | + echo "✓ Combined features config OK" |
| 81 | +
|
| 82 | + smoke: |
| 83 | + name: Smoke |
| 84 | + needs: lint |
| 85 | + runs-on: ubuntu-latest |
| 86 | + timeout-minutes: 20 |
| 87 | + steps: |
| 88 | + - uses: actions/checkout@v4 |
| 89 | + |
| 90 | + - uses: actions/setup-java@v4 |
| 91 | + with: |
| 92 | + distribution: temurin |
| 93 | + java-version: 17 |
| 94 | + |
| 95 | + - uses: extractions/setup-just@v2 |
| 96 | + |
| 97 | + - name: Gradle build |
| 98 | + run: ./gradlew :core:build :tools:build :shell:build -x test |
| 99 | + |
| 100 | + - name: Start single node |
| 101 | + working-directory: devbox |
| 102 | + run: just start |
| 103 | + |
| 104 | + - name: Wait for healthy |
| 105 | + run: | |
| 106 | + for i in $(seq 1 30); do |
| 107 | + S=$(docker inspect --format='{{.State.Health.Status}}' node-0 2>/dev/null) |
| 108 | + [ "$S" = "healthy" ] && echo "✓ node-0 healthy" && exit 0 |
| 109 | + sleep 5 |
| 110 | + done |
| 111 | + echo "Timeout waiting for node-0" && docker logs node-0 | tail -50 && exit 1 |
| 112 | +
|
| 113 | + - name: Topic operations |
| 114 | + working-directory: devbox |
| 115 | + run: | |
| 116 | + just topic-create ci-test |
| 117 | + just topic-list 2>&1 | grep ci-test |
| 118 | + just topic-describe ci-test 2>&1 | grep "PartitionCount: 1" |
| 119 | + echo "✓ Topic operations OK" |
| 120 | +
|
| 121 | + - name: Produce and consume |
| 122 | + run: | |
| 123 | + echo -e "ci-msg-1\nci-msg-2" | docker exec -i node-0 bash -c \ |
| 124 | + "KAFKA_HEAP_OPTS='-Xms256m -Xmx256m' KAFKA_JVM_PERFORMANCE_OPTS='' /opt/automq/bin/kafka-console-producer.sh --bootstrap-server localhost:9092 --topic ci-test" |
| 125 | + docker exec node-0 bash -c \ |
| 126 | + "KAFKA_HEAP_OPTS='-Xms256m -Xmx256m' KAFKA_JVM_PERFORMANCE_OPTS='' /opt/automq/bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic ci-test --from-beginning --max-messages 2 --timeout-ms 15000" \ |
| 127 | + 2>&1 | grep ci-msg-1 |
| 128 | + echo "✓ Produce/consume OK" |
| 129 | +
|
| 130 | + - name: Bin passthrough |
| 131 | + working-directory: devbox |
| 132 | + run: | |
| 133 | + just bin kafka-broker-api-versions.sh --bootstrap-server localhost:9092 2>&1 | grep -q "ApiVersion" |
| 134 | + echo "✓ Bin passthrough OK" |
| 135 | +
|
| 136 | + - name: JMX operations |
| 137 | + working-directory: devbox |
| 138 | + run: | |
| 139 | + just jmx -e domains 2>&1 | grep -q "kafka.server" |
| 140 | + just jmx -e 'beans -d kafka.server' 2>&1 | grep -q "kafka.server" |
| 141 | + echo "✓ JMX operations OK" |
| 142 | +
|
| 143 | + - name: Stop |
| 144 | + if: always() |
| 145 | + working-directory: devbox |
| 146 | + run: just stop |
| 147 | + |
| 148 | + full: |
| 149 | + name: Full |
| 150 | + needs: lint |
| 151 | + runs-on: ubuntu-latest |
| 152 | + timeout-minutes: 30 |
| 153 | + steps: |
| 154 | + - uses: actions/checkout@v4 |
| 155 | + |
| 156 | + - uses: actions/setup-java@v4 |
| 157 | + with: |
| 158 | + distribution: temurin |
| 159 | + java-version: 17 |
| 160 | + |
| 161 | + - uses: extractions/setup-just@v2 |
| 162 | + |
| 163 | + - name: Gradle build |
| 164 | + run: ./gradlew :core:build :tools:build :shell:build -x test |
| 165 | + |
| 166 | + - name: Test tabletopic |
| 167 | + working-directory: devbox |
| 168 | + run: | |
| 169 | + just start 1 tabletopic |
| 170 | + for i in $(seq 1 30); do |
| 171 | + S=$(docker inspect --format='{{.State.Health.Status}}' node-0 2>/dev/null) |
| 172 | + [ "$S" = "healthy" ] && break; sleep 5 |
| 173 | + done |
| 174 | + curl -sf http://localhost:8181/v1/config > /dev/null |
| 175 | + echo "✓ Iceberg REST OK" |
| 176 | + for i in $(seq 1 30); do |
| 177 | + curl -sf http://localhost:8081/ > /dev/null && echo "✓ Schema Registry OK" && break |
| 178 | + sleep 5 |
| 179 | + done |
| 180 | + grep -q "automq.table.topic" .devbox/config/node-0.properties |
| 181 | + echo "✓ Tabletopic config merged" |
| 182 | + just stop |
| 183 | +
|
| 184 | + - name: Test 4-node cluster (3 controller + 1 broker) |
| 185 | + working-directory: devbox |
| 186 | + run: | |
| 187 | + just start 4 |
| 188 | + # Verify role configs |
| 189 | + grep -q "process.roles=broker,controller" .devbox/config/node-0.properties |
| 190 | + grep -q "process.roles=broker,controller" .devbox/config/node-1.properties |
| 191 | + grep -q "process.roles=broker,controller" .devbox/config/node-2.properties |
| 192 | + grep -q "^process.roles=broker$" .devbox/config/node-3.properties |
| 193 | + grep -q "controller.quorum.voters=0@node-0:9093,1@node-1:9093,2@node-2:9093" .devbox/config/node-0.properties |
| 194 | + echo "✓ Role configs correct" |
| 195 | + # Wait for healthy |
| 196 | + for node in 0 1 2 3; do |
| 197 | + for i in $(seq 1 30); do |
| 198 | + S=$(docker inspect --format='{{.State.Health.Status}}' node-${node} 2>/dev/null) |
| 199 | + [ "$S" = "healthy" ] && echo "✓ node-${node} healthy" && break |
| 200 | + sleep 5 |
| 201 | + done |
| 202 | + done |
| 203 | + # Test topic operations |
| 204 | + just topic-create mixed-ci-test |
| 205 | + just topic-describe mixed-ci-test 2>&1 | grep -E "Leader: [0123]" |
| 206 | + echo "✓ Mixed cluster (3 controller + 1 broker) OK" |
| 207 | + just stop |
| 208 | +
|
| 209 | + - name: Test zerozone config |
| 210 | + working-directory: devbox |
| 211 | + run: | |
| 212 | + just start 5 zerozone |
| 213 | + grep -q "broker.rack=az-0" .devbox/config/node-0.properties |
| 214 | + grep -q "broker.rack=az-1" .devbox/config/node-1.properties |
| 215 | + grep -q "broker.rack=az-2" .devbox/config/node-2.properties |
| 216 | + grep -q "broker.rack=az-0" .devbox/config/node-3.properties |
| 217 | + grep -q "broker.rack=az-1" .devbox/config/node-4.properties |
| 218 | + echo "✓ ZeroZone broker.rack round-robin OK" |
| 219 | + just stop |
0 commit comments