Skip to content

Commit

Permalink
Merge pull request #2 from Fresa/upgrade-to-latest-protocol-version
Browse files Browse the repository at this point in the history
Upgrade to latest protocol version
  • Loading branch information
Fresa authored Jan 21, 2022
2 parents f5d243e + 10df6ef commit 5bb6fc0
Show file tree
Hide file tree
Showing 30 changed files with 716 additions and 341 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @Fresa
38 changes: 38 additions & 0 deletions .github/version_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
mode: ContinuousDelivery
# Conventional Commits https://www.conventionalcommits.org/en/v1.0.0/
# https://regex101.com/r/Ms7Vx6/2
major-version-bump-message: "(build|chore|ci|docs|doc|feat|fix|perf|refactor|revert|style|test)(\\([a-z]+\\))?(!: .+|: (.+\\n\\n)+BREAKING CHANGE: .+)"
# https://regex101.com/r/Oqhi2m/1
minor-version-bump-message: "(feat)(\\([a-z]+\\))?: .+"
# https://regex101.com/r/f5C4fP/1
patch-version-bump-message: "(build|chore|ci|docs|doc|fix|perf|refactor|revert|style|test)(\\([a-z]+\\))?: .+"
# Match nothing
no-bump-message: ^\b$
continuous-delivery-fallback-tag: ''
branches:
development:
increment: Patch
# Everything except main and master
regex: ^(?!(main|master)$)
track-merge-target: true
source-branches: []
feature:
# Match nothing
regex: ^\b$
develop:
# Match nothing
regex: ^\b$
main:
source-branches: []
release:
# Match nothing
regex: ^\b$
pull-request:
# Match nothing
regex: ^\b$
hotfix:
# Match nothing
regex: ^\b$
support:
# Match nothing
regex: ^\b$
109 changes: 109 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Continuous Delivery

on:
push:
branches:
- '**'

jobs:
test:
name: Build & Test
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
- name: Build
run: dotnet build -c Release
- name: Test
run: dotnet test -c Release --no-build --verbosity normal

release:
name: Create Release
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# Fetches entire history, so we can analyze commits since last tag
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.7
with:
versionSpec: '5.x'
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/execute@v0
with:
useConfigFile: true
configFilePath: .github/version_config.yml
- name: Determine Release Info
id: release
run: |
from_tag=$(git tag --points-at ${{ steps.gitversion.outputs.versionSourceSha }} | grep -m 1 ^v[0-9]*\.[0-9]*\.[0-9]* | head -1)
[[ -z "$from_tag" ]] && \
from_ref_exclusive=${{ steps.gitversion.outputs.versionSourceSha }} || \
from_ref_exclusive=$from_tag
[[ -z "${{ steps.gitversion.outputs.preReleaseTag }}" ]] && \
is_prerelease=false || \
is_prerelease=true
[[ $is_prerelease == true ]] && \
version=${{ steps.gitversion.outputs.majorMinorPatch }}-pre-${{ steps.gitversion.outputs.commitsSinceVersionSource }} || \
version=${{ steps.gitversion.outputs.majorMinorPatch }}
echo "::set-output name=is_prerelease::$is_prerelease"
echo "::set-output name=tag::v$version"
echo "::set-output name=version::$version"
echo "::set-output name=from_ref_exclusive::$from_ref_exclusive"
- name: Create Tag
uses: actions/github-script@v3
with:
script: |
github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ steps.release.outputs.tag }}",
sha: "${{ steps.gitversion.outputs.sha }}"
});
- name: Generate Release Notes
id: release_notes
uses: Fresa/release-notes-generator@v0
with:
version: ${{ steps.release.outputs.tag }}
from_ref_exclusive: ${{ steps.release.outputs.from_ref_exclusive }}
to_ref_inclusive: ${{ steps.release.outputs.tag }}
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
body: ${{ steps.release_notes.outputs.release_notes }}
tag_name: ${{ steps.release.outputs.tag }}
prerelease: ${{ steps.release.outputs.is_prerelease }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update Latest Minor Tag
uses: EndBug/latest-tag@v1
if: steps.release.outputs.is_prerelease == 'false'
with:
tag-name: v${{ steps.gitversion.outputs.major }}
description: ${{ steps.release.outputs.tag }}
- name: Update Latest Patch Tag
uses: EndBug/latest-tag@v1
if: steps.release.outputs.is_prerelease == 'false'
with:
tag-name: v${{ steps.gitversion.outputs.major }}.${{ steps.gitversion.outputs.minor }}
description: ${{ steps.release.outputs.tag }}
- name: Pack
env:
release_notes: ${{ steps.release_notes.outputs.release_notes }}
run: dotnet pack src/Kafka.TestFramework/Kafka.TestFramework.csproj -c Release -o nuget-packages -p:PackageVersion=${{ steps.release.outputs.version }} -p:PackageReleaseNotes="$release_notes"
- name: Publish to nuget.org
run: dotnet nuget push nuget-packages/Kafka.TestFramework.${{ steps.release.outputs.version }}.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json
16 changes: 12 additions & 4 deletions Kafka.TestFramework.sln
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30011.22
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{0EEC4A41-7C67-4580-8A21-BFA01B2415F1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{93A69F6A-D895-4A0E-9241-655EF7A9EEDA}"
ProjectSection(SolutionItems) = preProject
appveyor.yml = appveyor.yml
.github\workflows\ci.yml = .github\workflows\ci.yml
.github\CODEOWNERS = .github\CODEOWNERS
README.md = README.md
version = version
.github\version_config.yml = .github\version_config.yml
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kafka.TestFramework.Tests", "tests\Kafka.TestFramework.Tests\Kafka.TestFramework.Tests.csproj", "{FCFCC73C-B0A6-4D4E-A765-9A94303D00AD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kafka.TestFramework", "src\Kafka.TestFramework\Kafka.TestFramework.csproj", "{161B63C2-B654-4611-AAC8-28B54B5F3C9D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Confluent.Kafka.1.1.0.Tests", "tests\Confluent.Kafka.1.1.0.Tests\Confluent.Kafka.1.1.0.Tests.csproj", "{12646283-CC9E-4D45-8E89-F52337C790B6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -30,12 +33,17 @@ Global
{161B63C2-B654-4611-AAC8-28B54B5F3C9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{161B63C2-B654-4611-AAC8-28B54B5F3C9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{161B63C2-B654-4611-AAC8-28B54B5F3C9D}.Release|Any CPU.Build.0 = Release|Any CPU
{12646283-CC9E-4D45-8E89-F52337C790B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{12646283-CC9E-4D45-8E89-F52337C790B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{12646283-CC9E-4D45-8E89-F52337C790B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{12646283-CC9E-4D45-8E89-F52337C790B6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{FCFCC73C-B0A6-4D4E-A765-9A94303D00AD} = {0EEC4A41-7C67-4580-8A21-BFA01B2415F1}
{12646283-CC9E-4D45-8E89-F52337C790B6} = {0EEC4A41-7C67-4580-8A21-BFA01B2415F1}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B432BD60-300C-4955-9D44-011413D52F2D}
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Kafka.TestFramework
An in-memory test framework for Kafka clients which can be used to subscribe on request messages and respond with response messages. The test server can be used in-memory or connected to clients over TCP.

[![Build status](https://ci.appveyor.com/api/projects/status/3by56qq57a8or5a2?svg=true)](https://ci.appveyor.com/project/Fresa/kafka-testframework)

[![Build history](https://buildstats.info/appveyor/chart/Fresa/kafka-testframework)](https://ci.appveyor.com/project/Fresa/kafka-testframework/history)
[![Continuous Delivery](https://github.com/Fresa/Kafka.TestFramework/actions/workflows/ci.yml/badge.svg)](https://github.com/Fresa/Kafka.TestFramework/actions/workflows/ci.yml)

## Download
https://www.nuget.org/packages/kafka.testframework

## Getting Started
The test framework can be used in-memory or by setting up a TCP socket that the kafka client can connect to. See the [`integration tests`](https://github.com/Fresa/Kafka.TestFramework/blob/master/tests/Kafka.TestFramework.Tests).

### v2.x
Now supports [Kafka.Protocol](https://github.com/Fresa/Kafka.Protocol) v2.x.
34 changes: 0 additions & 34 deletions appveyor.yml

This file was deleted.

7 changes: 0 additions & 7 deletions scripts/set-version-tag-in-git.ps1

This file was deleted.

77 changes: 0 additions & 77 deletions scripts/set-version.ps1

This file was deleted.

20 changes: 0 additions & 20 deletions scripts/update-release-notes.ps1

This file was deleted.

15 changes: 15 additions & 0 deletions src/Kafka.TestFramework/AsyncDisposableExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Kafka.TestFramework
{
internal static class AsyncDisposableExtensions
{
internal static Task DisposeAllAsync(
this IEnumerable<IAsyncDisposable> disposables)
=> disposables.Select(client => client.DisposeAsync())
.WhenAllAsync();
}
}
Loading

0 comments on commit 5bb6fc0

Please sign in to comment.