Skip to content

Commit

Permalink
ci: Add github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ukdave committed Dec 17, 2024
1 parent 6ad67ec commit 81d321d
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: CI

on:
push:
pull_request:
branches: ["main"]

jobs:
test:
strategy:
fail-fast: false
matrix:
crystal: [1.11.2, 1.12.2, 1.13.3, 1.14.0]
runs-on: ubuntu-latest

services:
kafka:
image: bitnami/kafka:latest
ports:
- 9092:9092
- 9094:9094
env:
KAFKA_CFG_NODE_ID: 0
KAFKA_CFG_PROCESS_ROLES: controller,broker
KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: 0@kafka:9093
KAFKA_CFG_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093,EXTERNAL://:9094
KAFKA_CFG_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,EXTERNAL://localhost:9094
KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,EXTERNAL:PLAINTEXT,PLAINTEXT:PLAINTEXT
KAFKA_CFG_CONTROLLER_LISTENER_NAMES: CONTROLLER

steps:
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: ${{ matrix.crystal }}

- name: Install librdkafka
run: sudo -n apt-get install -qy librdkafka-dev

- name: Download source
uses: actions/checkout@v4

- name: Check formatting
run: crystal tool format --check

- name: Run unit tests
run: crystal spec -v --color spec/kafka spec/rdkafka

- name: Run integration tests
run: |
for test in spec/integration/*_spec.cr; do
crystal spec -v --color ${test};
done
timeout-minutes: 2

0 comments on commit 81d321d

Please sign in to comment.