Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: 'confluent-kafka-dotnet build pipeline'

env:
DOTNET_CLI_TELEMETRY_OPTOUT: 'true'

on:
push:
pull_request:

jobs:

build-test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-13] # macos-13 for x86_x64 arch
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
- name: Build and test
run: |
dotnet nuget add source --username user --password ${{ github.token }} --store-password-in-clear-text --name github https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
dotnet test -c Release /p:TreatWarningsAsErrors=true test/Confluent.Kafka.UnitTests/Confluent.Kafka.UnitTests.csproj

package:
needs: [build-test]
runs-on: windows-latest
steps:

- name: Show default environment variables
run: |
echo "The job_id is: $GITHUB_JOB" # reference the default environment variables
echo "The id of this action is: $GITHUB_ACTION" # reference the default environment variables
echo "The run id is: $GITHUB_RUN_ID"
echo "The GitHub Actor's username is: $GITHUB_ACTOR"
echo "GitHub SHA: $GITHUB_SHA"
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
- name: Build and create packages
run: |
dotnet nuget add source --username user --password ${{ github.token }} --store-password-in-clear-text --name github https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
dotnet build Confluent.Kafka.sln -c Release

# Different packaging for tagged vs untagged builds
$proj_version = (dotnet msbuild ./src/Confluent.Kafka/Confluent.Kafka.csproj -getproperty:VersionPrefix)
if ($env:GITHUB_REF -match '^refs/tags/') {
$tag_version = $env:GITHUB_REF -replace '^refs/tags/v', ''
if ($tag_version -ne $proj_version) {
Write-Output "::error title=Version mismatch::Tag version '$tag_version' does not match project version '$proj_version'."
exit 1
}
} else {
$version_components = $proj_version -split '\+'
$version_args = @("/p:Version=$($version_components[0])-ci-$env:GITHUB_RUN_ID+$($version_components[1])")
}

dotnet pack src/Confluent.Kafka/Confluent.Kafka.csproj --output dist -c Release @version_args

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: dist/

# Publish NuGet packages when a tag is pushed.
# Tests need to succeed for all components and on all platforms first,
# including having a tag name that matches the version number.
publish-release:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
needs: package
runs-on: ubuntu-latest
steps:
- name: Download NuGet package artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: dist
- name: Publish to NuGet
run: |
dotnet nuget push "dist/Confluent.Kafka*.nupkg" --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --api-key ${{ github.token }}
4 changes: 2 additions & 2 deletions src/Confluent.Kafka/Confluent.Kafka.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageReadmeFile>README.md</PackageReadmeFile>
<Title>Confluent.Kafka</Title>
<AssemblyName>Confluent.Kafka</AssemblyName>
<VersionPrefix>2.11.1</VersionPrefix>
<VersionPrefix>2.11.1.1-RC1+gr</VersionPrefix>
<TargetFrameworks>netstandard2.0;net462;net6.0;net8.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand All @@ -25,7 +25,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="librdkafka.redist" Version="2.11.1">
<PackageReference Include="librdkafka.redist" Version="2.11.1.1-RC1+gr">
<PrivateAssets Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">None</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand Down
Loading