Fix Kafka ci (#2283) #522
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: HealthChecks Kafka CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ master ] | |
paths: | |
- src/HealthChecks.Kafka/** | |
- test/HealthChecks.Kafka.Tests/** | |
- test/_SHARED/** | |
- .github/workflows/healthchecks_kafka_ci.yml | |
- Directory.Build.props | |
- Directory.Build.targets | |
tags-ignore: | |
- release-* | |
- preview-* | |
pull_request: | |
branches: [ master ] | |
paths: | |
- src/HealthChecks.Kafka/** | |
- test/HealthChecks.Kafka.Tests/** | |
- test/_SHARED/** | |
- .github/workflows/healthchecks_kafka_ci.yml | |
- Directory.Build.props | |
- Directory.Build.targets | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
zookeeper: | |
image: confluentinc/cp-zookeeper:latest | |
ports: | |
- 2181:2181 | |
env: | |
ZOOKEEPER_CLIENT_PORT: 2181 | |
ZOOKEEPER_TICK_TIME: 2000 | |
kafka: | |
image: confluentinc/cp-kafka:latest | |
ports: | |
- 9092:9092 | |
- 29092:29092 | |
env: | |
KAFKA_ADVERTISED_HOST_NAME: localhost | |
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 | |
KAFKA_BROKER_ID: 1 | |
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092,PLAINTEXT_HOST://localhost:29092 | |
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT | |
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT | |
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
6.0.x | |
7.0.x | |
8.0.x | |
- name: Restore | |
run: | | |
dotnet restore ./src/HealthChecks.Kafka/HealthChecks.Kafka.csproj && | |
dotnet restore ./test/HealthChecks.Kafka.Tests/HealthChecks.Kafka.Tests.csproj | |
- name: Check formatting | |
run: | | |
dotnet format --no-restore --verify-no-changes --severity warn ./src/HealthChecks.Kafka/HealthChecks.Kafka.csproj || (echo "Run 'dotnet format' to fix issues" && exit 1) && | |
dotnet format --no-restore --verify-no-changes --severity warn ./test/HealthChecks.Kafka.Tests/HealthChecks.Kafka.Tests.csproj || (echo "Run 'dotnet format' to fix issues" && exit 1) | |
- name: Build | |
run: | | |
dotnet build --no-restore ./src/HealthChecks.Kafka/HealthChecks.Kafka.csproj && | |
dotnet build --no-restore ./test/HealthChecks.Kafka.Tests/HealthChecks.Kafka.Tests.csproj | |
- name: Test | |
run: > | |
dotnet test | |
./test/HealthChecks.Kafka.Tests/HealthChecks.Kafka.Tests.csproj | |
--no-restore | |
--no-build | |
--collect "XPlat Code Coverage" | |
--results-directory .coverage | |
-- | |
DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover | |
- name: Upload Coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
flags: Kafka | |
directory: .coverage |