Skip to content

Commit

Permalink
ref(ci): Add Rust CI (#324)
Browse files Browse the repository at this point in the history
* add rust ci

* patch rdkafka in arroyo as well

* run kafka for rust ci
  • Loading branch information
untitaker authored Jan 17, 2024
1 parent 6002cee commit 36eaee3
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 17 deletions.
18 changes: 1 addition & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,7 @@ jobs:
with:
python-version: ${{ matrix.python }}
- name: Run Zookeeper and Kafka
run: |
docker run \
--name sentry_zookeeper \
-d --network host \
-e ZOOKEEPER_CLIENT_PORT=2181 \
confluentinc/cp-zookeeper:6.2.0
docker run \
--name sentry_kafka \
-d --network host \
-e KAFKA_ZOOKEEPER_CONNECT=127.0.0.1:2181 \
-e KAFKA_LISTENERS=INTERNAL://0.0.0.0:9093,EXTERNAL://0.0.0.0:9092 \
-e KAFKA_ADVERTISED_LISTENERS=INTERNAL://127.0.0.1:9093,EXTERNAL://127.0.0.1:9092 \
-e KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT \
-e KAFKA_INTER_BROKER_LISTENER_NAME=INTERNAL \
-e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 \
confluentinc/cp-kafka:6.2.0
run: sh scripts/run-kafka.sh
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/rust-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Rust

on:
push:
branches:
- main
- release/**

pull_request:

jobs:
lint:
name: "Linting"
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
name: Checkout code
- name: Run linter
run: cd rust-arroyo && cargo check && cargo fmt --check

test:
name: "Tests"
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
name: Checkout code
- name: Run Zookeeper and Kafka
run: sh scripts/run-kafka.sh
- name: Run tests
run: cd rust-arroyo && cargo test
3 changes: 3 additions & 0 deletions rust-arroyo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ parking_lot = "0.12.1"

[dev-dependencies]
tracing-subscriber = "0.3.18"

[patch.crates-io]
rdkafka = { git = "https://github.com/fede1024/rust-rdkafka" }
18 changes: 18 additions & 0 deletions scripts/run-kafka.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

docker run \
--name sentry_zookeeper \
-d --network host \
-e ZOOKEEPER_CLIENT_PORT=2181 \
confluentinc/cp-zookeeper:6.2.0

docker run \
--name sentry_kafka \
-d --network host \
-e KAFKA_ZOOKEEPER_CONNECT=127.0.0.1:2181 \
-e KAFKA_LISTENERS=INTERNAL://0.0.0.0:9093,EXTERNAL://0.0.0.0:9092 \
-e KAFKA_ADVERTISED_LISTENERS=INTERNAL://127.0.0.1:9093,EXTERNAL://127.0.0.1:9092 \
-e KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT \
-e KAFKA_INTER_BROKER_LISTENER_NAME=INTERNAL \
-e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 \
confluentinc/cp-kafka:6.2.0

0 comments on commit 36eaee3

Please sign in to comment.