Skip to content

Merge pull request #4 from cinemataztic/kill-process-repeated-attempt… #159

Merge pull request #4 from cinemataztic/kill-process-repeated-attempt…

Merge pull request #4 from cinemataztic/kill-process-repeated-attempt… #159

Workflow file for this run

# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Node.js CI
on:
push:
pull_request:
env:
KAFKA_BROKERS: localhost:9092
jobs:
test:
runs-on: ubuntu-latest
services:
zookeeper:
image: confluentinc/cp-zookeeper:latest
ports:
- 2181:2181
env:
ZOOKEEPER_CLIENT_PORT: 2181
kafka:
image: confluentinc/cp-kafka:latest
ports:
- 29092:29092
- 9092:9092
env:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_AUTO_CREATE_TOPICS_ENABLE: true
KAFKA_DELETE_TOPIC_ENABLE: true
KAFKA_NUM_PARTITIONS: 8
KAFKA_DEFAULT_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_MIN_INSYNC_REPLICAS: 1
options: --health-cmd="kafka-topics --bootstrap-server localhost:9092 --list || exit 1" --health-interval=10s --health-timeout=5s --health-retries=5
schema-registry:
image: confluentinc/cp-schema-registry:latest
ports:
- 8081:8081
env:
SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: PLAINTEXT://kafka:29092
SCHEMA_REGISTRY_HOST_NAME: schema-registry
SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: zookeeper:2181
options: --health-cmd="curl -s http://localhost:8081/subjects" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@master
with:
node-version: 20.14.0
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Deploy 'cinemataztic-value' avro schema to schema-registry service
run: |
echo '{
"schema": "{\"type\":\"record\",\"name\":\"HelloCinemataztic\",\"fields\":[{\"name\":\"message\",\"type\":\"string\"}]}"
}' > schema.json
echo "Deploying 'cinemataztic-value' avro schema to schema-registry"
curl -X POST -H "Content-Type: application/vnd.schemaregistry.v1+json" --data @schema.json http://localhost:8081/subjects/cinemataztic-value/versions
- name: Run tests
run: npm run test:ci --if-present